An alternate, probably, more performant implementation would be to use a global object named connected_device declared in devices.interface:
_connected_device = None
def connected_device():
return _connected_device
def set_connected_device(dev=None):
global _connected_device
_connected_device = dev
The GUI can simply call set_connected_device on ever device connection/disconnection. Drivers that are interested in connected status can call connected_device()
That avoids the overhead of calling a function on every device driver.
|