Best practice for DEVICE_COMMUNICATING and DATA_INITIALIZED?
PsyenceFact
Posts: 29
I've been writing a NetLinx module for the Mode ColourStyle lighting controller which communicates over IP. I've got to the stage where the networking code is reasonably robust and am looking at ways of communicating the module status to other (UI) modules.
SNAPI defines channels 251 (DEVICE_COMMUNICATING) as being on whilst "Communication is established with device", and channel 252 (DATA_INITIALIZED) as being on whilst "Module data is synchronized with device".
At the moment I have 251 being set on and off in the device online and offline events. However if the device is offline, sending a command will bring it online (assuming there are no network issues) meaning that channel 251 is not a good inidicator of "communication readiness". For channel 252, I just set it on when the DEFINE_START activities have finished and don't touch it again.
I'd be interested to hear how other people use these channels, or indeed other ways of communicating the module state.
Andy
SNAPI defines channels 251 (DEVICE_COMMUNICATING) as being on whilst "Communication is established with device", and channel 252 (DATA_INITIALIZED) as being on whilst "Module data is synchronized with device".
At the moment I have 251 being set on and off in the device online and offline events. However if the device is offline, sending a command will bring it online (assuming there are no network issues) meaning that channel 251 is not a good inidicator of "communication readiness". For channel 252, I just set it on when the DEFINE_START activities have finished and don't touch it again.
I'd be interested to hear how other people use these channels, or indeed other ways of communicating the module state.
Andy
0
Comments
DATA_INITIALIZED is a bit murkier, but again, I would hold to the stricter from and say, it's on when your data fields match the device state after coming online. If it's off, you know what you have isn't reliable yet and needs to be queried.
the Device_Communicating is meant to tell the calling program that the module is able to and is in some state of contact with the device being controlled. The Data_Init is meant to tell the calling program that the module can query for data or that the module will now potentially be sending asyncronous data to/from the device being controlled.
The difference being that in a continuous communications scenario, the Device_Is_Commonuicating might indicate that the module is in the process of getting things going. In the other scenario where the device forces shut down of a socket once it sends its data, it might be considered a pilot light of communications.
I do think the concept is a bit fuzzy in practice though.
Andy