Device

class Device(devicename, properties, **devicedata)

An instance of this should be created for each device controlled by this driver. The properties argument is a list of vectors controlling this device. devicedata will be an attribute dictionary of any hardware data that may be usefull.

async devclientevent(event, *args, **kwargs)

As default, does nothing and is not called.

If required, override this to handle any necessary device actions. This should be called from the driver ‘clientevent’ method if it is used.

async devhardware(*args, **kwargs)

As default, does nothing and is not called.

If required, override this to handle any necessary device actions. This should be called from the driver ‘hardware’ method if it is used.

async devsnoopevent(event, *args, **kwargs)

As default, does nothing and is not called.

If required, override this to handle any necessary device actions. This should be called from the driver ‘snoopevent’ method if it is used.

async send_delProperty(message='', timestamp=None)

Sending delProperty with this device method, (as opposed to the vector send_delProperty method) informs the client this device is not available, it also sets a device.enable attribute to False, which stops any data being transmitted between the client and this device. Setting device.enable to True re-enables communications. The message argument is any appropriate string which the client could display to the user. The timestamp should be either None or a datetime.datetime object. If the timestamp is None a UTC value will be inserted.

async send_device_message(message='', timestamp=None)

Send a message associated with this device, which the client could display. The timestamp should be either None or a datetime.datetime object. If the timestamp is None a UTC value will be inserted.

The Device is also a mapping, of vectorname:vectorobject, so to access a vector you could use device[‘vectorname’].

The device has attributes:

devicename

The given name of the device, this device object can be accessed from the driver as driver[devicename]

enable

Automatically set to False if the device is deleted by calling the device send_delProperty() method. The attribute should be set to True to re-enable the device, also for every property of the device, you will need to call the vector send_defVector() method to inform the client that the device and its properties are now available.

devicedata

Set from the device constructer as optional keyword arguments, can be used to pass in hardware data to the device object.

driver

The driver object, can be used to access driver.send_message() and driver.send_getProperties() methods if required, and also to access any other device using the driver mapping feature.