Specifying M2M system number at run time?
annuello
Junior Member
Hello,
I'm trying to make a master-to-master system where I send commands to a virtual device on the remote system. Usually this is a straight-forward process. However, I need to specify the remote system number at run time rather than compile time. *The same code will be deployed into several installations which all report to one RMS server, hence the need for unique system numbers, and my desire to avoid code changes & recompiling for every installation.
*
I'm hoping that I can specify the remote system number in an XML file (or persistent variable) and use that value. *Once the remote system number has been set up I don't expect/need it to change. Obviously I will still need to enter the remote system IP into the URL list for each installation.
I've been trying to figure this out for the last few days but with no success.
Yours,
Roger McLean
Swinburne University*
**
I'm trying to make a master-to-master system where I send commands to a virtual device on the remote system. Usually this is a straight-forward process. However, I need to specify the remote system number at run time rather than compile time. *The same code will be deployed into several installations which all report to one RMS server, hence the need for unique system numbers, and my desire to avoid code changes & recompiling for every installation.
*
I'm hoping that I can specify the remote system number in an XML file (or persistent variable) and use that value. *Once the remote system number has been set up I don't expect/need it to change. Obviously I will still need to enter the remote system IP into the URL list for each installation.
I've been trying to figure this out for the last few days but with no success.
Yours,
Roger McLean
Swinburne University*
**
Comments
-
Am I missing something here? As far as I'm aware based on your description, what you're trying to do is as simple as...
// Get system number from file, however you may want to implement it... nSystemNumber = SystemNumber_GetFromFile(sFileName) // Check that the controller has the right system number and update it if not... if(nSystemNumber <> get_system_number() { set_system_number(nSystemNumber) reboot(0) } -
Thanks for your quick reply. To clarify, I'm not trying to change the system number. I'm trying to avoid specifying in code. Perhap an example would make my idea clearer.Am I missing something here? As far as I'm aware based on your description, what you're trying to do is as simple as...//Typical M2M setup. Assume this is running on a system other than 123. define_device vdvLocalDevice = 33001:1:0 vdvRemoteDevice = 33001:1:123. //N.B. The system number is hard coded.
What I want to avoid is the hard-coding (compile time) of the vdvRemoteDevice system number. (123 in the above example.). I want to be able to specify the vdvRemoteDevice system number at run time. That way I can deploy this same code into many installations without having to modify the source for each and every installation.
I've tried using a dev variable (array with one element) which I can easily "fill out" at run time. However the device on the remote system does not respond when I send_command vdvRemoteDevice. I've tried using set_length_array() and rebuild_event() after setting up my dev variable, but that didn't seem to help. The IP for system 123 is in the URL list for the local system only, and system 123 shows up in the Online Tree when I choose the Show Network option.
Roger McLean
Swinburne University -
Aha, with you now. You've tried most of the things I can immediately think of to suggest, but I would suggest taking things back to first principles. Personally, I'd check that you get the expected functionality with vdvRemoteDevice specified in a define_device section and then try specifying vdvRemoteDevice as a non array dev variable. If these work, try using your dev array and targeting your send_command at vdvRemoteDevice[1]. If that works, it would be likely that your set_length_array statement isn't being called or is being called inappropriately.
-
I think that DEFINE_DEVICE is not a runtime event. Try defining a DEV variable. Then you can reassign the variable the system number during runtime device.system = 123. Not sure if device needs to be in DEFINE DEVICE to connected to remote master.
-
I think the problem you might be having is related to how the processors deal with devices. In order to generate events and track channel/level states, the processor needs to know that the device exists. (I'm not positive on the events, but I know that it won't track channels/levels if the device is not defined.) There might be a way to tell the processor to do this on the fly (I think there is a RELOAD_something command to regenerate event tables or something). I haven't played around much with this, but I have been dabbling with more M2M comms on a larger scale and I have to define shared devices on both processors for things to function.
I will try to find that reload command if I get a moment, but hopefully someone with more knowledge on the subject will post before then with more specific data.
Jeff -
I would try this:
1. Create a virtual device for your actual control.
2. Assign your remote device in a variable ... it could even read a config file at this point.
3. Combine the variable with the virtual.
You would have to make sure to also run the various SET_VIRTUAL_ commands if it has more than the default number of devices/levels/etc. -
Thank you all for your helpful replies. I tried them all, and the one that worked was Dave Hawthorne's solution. Here is an example of how to do it.
define_device vdvLocal = 33001:1:0 vdvRemote = 33002:1:0 //N.B. This is on our local master define_variable dev vdvVariableRemote //This variable will get set to vdvLocal on the remote master. define_function LoadRemoteSystemFromFile(){ integer iRemoteSystem ... if(iRemoteSystem != get_system_number()){ //just a saftey check vdvVariableRemote = vdvLocal vdvVariableRemote.system = iRemoteSystem combine_devices(vdvRemote, vdvVariableRemote) } } define_event button_event[dvTp,someButton]{ push:{ send_command vdvRemote,'blah blah blah' //The vdvLocal on the remote system receives this. } }
Thanks to all for your suggestions, and a double thanks to Dave.
Roger McLean
Swinburne University
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums