M2M and remote device control
PatG
Posts: 42
Can anyone hook me up with some code examples of how to acheive this? There's really a dearth of practical examples on the website and in the manuals.
0
Comments
What are you exactly trying to do, not alot of information in your post... Thanks!
Thanks
Most the work of this feature is automatically handled for you. Master to Master communication is very simple for the programmer to implement. First you have to make sure both masters have different system numbers. By default the masters get shipped as system 1. You can have a system number from 1 - 65535. Once you set the masters system numbers, for the sake of this conversation we will say system 1 & 2. To link the masters together, you must put one of the masters IP address in the other master "URL LIST". So in other words, put systems 2 IP address in systems 1's URL LIST. You do not need to and should not put systems 1's IP address in systems 2 URL LIST, in other words you only need to do this in one of the masters. Once you do this, system 1 has access to all of the control points in system 2 and system 2 has access to all the control points to system 1. Now all you have to do is program normally. Netlinx Diagnostics is the tool you can use to set the system numbers plus populate the URL LISTS.
ip_client_open(dvClient.PORT,<IP>,<port>,IP_TCP)
will achieve the same thing as using the URL list in this situation? ( where I am opening the client in the controlling master )
If you must add to the URL list in code use this method.
// Directions...
ADD_URL_ENTRY
This function adds a URL entry to the specified device. The function requires a pre-initialized URL_STRUCT that will be sent to the specified device.
ADD_URL_ENTRY (DEV Device, URL_STRUCT Url)
Parameters:
Device - Device number of the device that stores the URL; typically the local Master (0:1:0).
If you currently connected to another Master, you can use <0:1:system number of remote master>.
Url - URL_STRUCT that will be programmed into the device
Result:
0: Success
-1: Specified device is invalid or is not online
-2: Time out occurred
-3: Function is already actively adding a URL entry (i.e. busy)
-4: Add failed
Note that NetLinx will automatically set bit 5 of the Flags member of the URL_STRUCT structure.
See GET_URL_LIST for a description of the URL_STRUCT structure.
DEFINE_START SECTION WOULD WORK...
FYI, is you use the ADD_URL_ENTRY (DEV Device, URL_STRUCT Url) system function that AMXJeff suggested that needs to be put in the code for the main master only and that doesn't need or require you to open a connection to your other master with an IP_CLIENT_OPEN or anything. Once the other master is in the URL list of the main master everything is taken care of for you. All you need to do is declare your devices in the masters that you want to run code in for those devices and then create event handlers.