Phidget22 API Discovery and Enumeration
Posted: Tue Jul 11, 2023 11:01 am
I have been doing a deep dive into the discovery and enumeration mechanisms of the Phidget22 API after quite a while away from the ecosystem (I have Phidgets that are old enough that they don’t even appear on your Discontinued Products page ). As others before me have done here in the forums, I am using the Windows Control Panel as a baseline of sorts for guidance using observation and inference. I want to make sure that I have a solid grasp of the multithreaded event model using the code snippet below as a simple example:
Net.ServerAdded += Net_ServerAdded;
Net.ServerRemoved += Net_ServerRemoved;
_Manager.Attach += Manager_Attach;
_Manager.Detach += Manager_Detach;
Net.EnableServerDiscovery(Phidget22.ServerType.DeviceRemote);
_Manager.Open();
Not shown, but locks are employed in the event handlers.
I am specifically interested if Manager (attach) events for a Wireless VINT Hub (HUB5000_0) would ever be received before Net (added) events. I’ve not observed this to be true, but want to be very defensive in my approach.
Also of interest would be if Sensors ever attach before the Hub does for a Wireless VINT Hub (HUB5000_0). Again, I’ve not observed this to be the case, but don’t want to make any assumptions.
Is there any guarantee at all regarding the order the events are received (both intraobject and interobject)? It seems as if perhaps not, but want to verify. I may have missed it, but I didn't see anything in the documentation regarding such.
When trying to construct a hierarchical representation of a Phidget deployment, using the Phidget ‘Channel’ model is interesting in that it is of course a very denormalized / flattened view. Constructing a tree view using the event data is not a huge hurdle but when receiving event data that can be at any ‘level’ of a hierarchy, one must aware of that fact and be ready to build either top down or bottom up as the need arises.
Thanks.
Phidget22 - Version 1.16 - Built Jul 7 2023 09:13:43 / 1.16.20230707 / .NET 7.0
Net.ServerAdded += Net_ServerAdded;
Net.ServerRemoved += Net_ServerRemoved;
_Manager.Attach += Manager_Attach;
_Manager.Detach += Manager_Detach;
Net.EnableServerDiscovery(Phidget22.ServerType.DeviceRemote);
_Manager.Open();
Not shown, but locks are employed in the event handlers.
I am specifically interested if Manager (attach) events for a Wireless VINT Hub (HUB5000_0) would ever be received before Net (added) events. I’ve not observed this to be true, but want to be very defensive in my approach.
Also of interest would be if Sensors ever attach before the Hub does for a Wireless VINT Hub (HUB5000_0). Again, I’ve not observed this to be the case, but don’t want to make any assumptions.
Is there any guarantee at all regarding the order the events are received (both intraobject and interobject)? It seems as if perhaps not, but want to verify. I may have missed it, but I didn't see anything in the documentation regarding such.
When trying to construct a hierarchical representation of a Phidget deployment, using the Phidget ‘Channel’ model is interesting in that it is of course a very denormalized / flattened view. Constructing a tree view using the event data is not a huge hurdle but when receiving event data that can be at any ‘level’ of a hierarchy, one must aware of that fact and be ready to build either top down or bottom up as the need arises.
Thanks.
Phidget22 - Version 1.16 - Built Jul 7 2023 09:13:43 / 1.16.20230707 / .NET 7.0