Here scenario / cases
There is a difference if a device gets started stopped or paused or modified:
- Code: Select all
start stop source action possible actions to device
at plugin start: start device ==> init, reset, load params
at plugin stop: stop device ==> stop devices, shutdown
while running:
device can be paused: disable/enable ==> keep it running, just don't do anything
device can be modified: edit device ==> new parameters for e.g. channels, offsets etc, no need to restart ..
device can be deleted: by user, or plugin, ==> stop device action, shutdown
In some of my plugins they are managing many devices. They send updates on a frequent basis from different sources (e.g. each RPI can send updates for each beacon: 10RPI *20beacons every 30 secs =~ 10 loops/sec through all plugin devices ) Each time a messages gets received the plugin needs to determine which indigo device it is
In order to do that it keeps a matching table ( e.g. MAC# to indigo ID) , instead of for each message looping through ALL plugin devices and trying to find a match
To keep this in sync the plugin needs to know if a device is active/paused/ deleted.
currently the only way I found to be reliable is to do a sync once every 1-2 minutes and to refresh the machting table physical device - indigo ID and catch exceptions if a device was deleted
So it would be nice if there is a ongoing supported way to know if a devices is active/deleted/ stopped/ active/ paused..
==> really missing is deleted.
-- paused: dev.enabled OK
-- plugin init: check variable set at startup and reset when entering runConcurrentThread OK
-- plugin stop: just learned you can set variable at the end of runConcurrentThread OK
-- device deleted was device deleted(), but set to be removed in the future. ??
Karl