Virtual Device API

A Task can expose “Virtual Devices”. The process emulate the virtual device by subscribing the Virtual Device events, processing events and sending the responses back.

Example Of Virtual Devices

There are several stock virtual device enabled Applications shipping with Liberty IoT Hub.

  • Denon Driver - Driver for Denon/Marantz receivers. User create a task, throw a receiver on the local network in, the task will expose a list of virtual devices, including:
    • A “On/Off” power device
    • A “Level Control” volume devices
    • Several “Multistate” devices for input/output channels selection, Surround mode selection etc
    • If multi-zone is used, devices for extra zones will also be exposed
  • Applications for combined devices and translated devices

Virtual devices are treated no different than other types of devices. Our Libre-Link technology will be able to group devices together only according to their logical capabilities. For example, a receiver volume can be bound to a Libre Remote button.

Theoretically, combined with our “I/O API”, any wifi/ethernet device can be driven by an application Task and exposed as a virtual device of a certain type.

Event Model

Task must subscribe and process virtual device events.

Libre_SetWaitVirtualDevice(id)

Subscribe virtual device events.

Parameters:

  • id - Integer, internal device ID.

Libre_ClearWaitVirtualDevice(id)

Unsubscribe virtual device events.

Parameters:

  • id - Integer, internal device ID.

Note: Only one task thread is allowed to subscribe virtual device events at any given time.

Control Signals

Virtual device may send control signals to other devices.

Libre_VirtualDeviceOnOffSet(id, onoff, source) Libre_VirtualDeviceLevelSet(id, level, source, transitionTime) Libre_VirtualDeviceStatusDeviceDown(id)

Event Acknowledgement

Once the event is processed, Task shall send back acknowledgement.

Depending on the type of virtual device, acknowledgement is sent back by explicitly calling the same API as control signals.

Status Report

At least during Task initialization, the virtual device may generate the initial status report.

Libre_VirtualDeviceOnOffReport(id, onoff, source) Libre_VirtualDeviceLevelReport(id, level, source)