Module "urn_schemas-upnp-org_device_BinaryLight_1"

Standard device; "urn:schemas-upnp-org:device:BinaryLight:1". When required, it returns a single function which generates a new device table on every call (it takes no parameters). The upnp.devicefactory module takes the device/service tables to build device/service objects.

Requires to implement the following elements;

  • device.statetodevice handler to update device status when the target value has changed on the UPnP side

Tables

BinaryLight fields/properties Members of the BinaryLight object

Functions

statefromdevice (self, power) Sets provided values into the UPnP device (software representation).
statetodevice (self, power, callback) Sets provided values into the actual device (hardware).


Tables

BinaryLight fields/properties
Members of the BinaryLight object

Fields

  • lastpower: (boolean) the last power value set in/received from the hardware

Functions

statefromdevice (self, power)
Sets provided values into the UPnP device (software representation). This method must be called from the devicedriver to update changes from the hardware to the UPnP device.

Parameters:

  • self: (table) binarylight device object
  • power: (boolean) powerstate to set (true = on)
statetodevice (self, power, callback)
Sets provided values into the actual device (hardware). This method must be overriden to communicate with the hardware.
NOTE: setting values in hardware might require use of a coroutine for a socket/IO scheduler. Hence the callback to allow the creation of (for example) a Copas task to send the command to the hardware over an outgoing TCP connection. If you do not do this when using possibly blocking IO calls, then the call might become a blocking call, freezing the entire engine.

Parameters:

  • self: (table) binarylight device object
  • power: (boolean) powerstate to set (true = on)
  • callback: (function) callback function to call when hardware has been updated (has no arguments)

Valid XHTML 1.0!