DeviceNetwork
library allows you to work with devices that support the ADN protocol. It creates a hierarchy of connected devices and abstracts the user from the details of their physical connection. The current version of ADN supports devices' connection via USB and using an IP network. Moreover, some devices can be connected via other devices (e.g. by radio protocol).DeviceNetwork
library.DeviceNetwork
:ILibrary
;IDeviceFilter
using createFilter
;INetwork
using createNetwork
with the filled in filter;UpdateId
changes using getUpdateId
;ILibrary
allows the user to see the current version of the library using getVersion
, and set the required LogLevel
using setLogLevel
. LogLevel
=
Off
by default.INetwork
instance, create and fill in an instance of IDeviceFilter
. The device filter will be used for selecting devices to add to the network. With the filter, you can create an instance of INetwork
using ILibrary.createNetwork
.INetwork
instance with an empty filter.IDeviceFilter
selects devices to connect to the INetwork
instance. The filter uses the addition principle. You should create an empty filter and then add masks of devices to it that should be connected to the ADN instance.ILibrary.createFilter
to create an IDeviceFilter
, then use addUsbDevice
and addIpDevice
methods to add USB and IP devices to the filter. Both types of devices can be added to the same filter./* * Get a device filter for Antilatency USB Sockets (HMD Radio Socket and Wired USB Socket). */ private static Antilatency.DeviceNetwork.IDeviceFilter GetAntilatencyUsbSocketDevicesFilter(Antilatency.DeviceNetwork.ILibrary deviceNetworkLibrary) { var result = deviceNetworkLibrary.createFilter(); var usbDeviceFilter = new Antilatency.DeviceNetwork.UsbDeviceFilter() { vid = UsbVendorId.Antilatency, pid = 0x0000, pidMask = 0xFFFF }; result.addUsbDevice(usbDeviceFilter); return result; }
AllUsbDevices
, AllIpDevicesMask
and AllIpDevicesIp
constants.#region DeviceFilter samples /* * Get a device filter for all Antilatency USB devices. */ private static Antilatency.DeviceNetwork.IDeviceFilter GetAllUsbDevicesFilter(Antilatency.DeviceNetwork.ILibrary deviceNetworkLibrary) { var result = deviceNetworkLibrary.createFilter(); result.addUsbDevice(Antilatency.DeviceNetwork.Constants.AllUsbDevices); return result; }
/* * Get a device filter for all IP devices. */ private static Antilatency.DeviceNetwork.IDeviceFilter GetAllIpDevicesFilter(Antilatency.DeviceNetwork.ILibrary deviceNetworkLibrary) { var result = deviceNetworkLibrary.createFilter(); result.addIpDevice(Antilatency.DeviceNetwork.Constants.AllIpDevicesIp, Antilatency.DeviceNetwork.Constants.AllIpDevicesMask); return result; }
INetwork
is created, the user can get the IDeviceFilter
using the INetwork.getDeviceFilter
method and check the used masks and devices with getIpDeviceMask
, getIpDevice
and getUsbDevice
. Once an instance of INetwork
is created, the filter can only be read, not modified.IDeviceFilter
to assign specific Antilatency devices to specific ADN instances running on the same Host. To do this, you need to create as many non-overlapping filters as there are ADN instances running at the same time. You cannot create INetwork
objects with overlapping filters.UsbVendorId
.1
’ in the mask means that this bit in the connected device's pid must be equal to the corresponding bit in the target pid. A ‘0
’ in the mask means that the corresponding bit can have any value. Look at the example:INetwork
, you can represent the connection hierarchy of all devices, since you can find a parent for each node. To do this, use getNodes
and nodeGetParent
.INetwork
is working with node properties.nodeGetStringProperty
and nodeGetBinaryProperty
to read properties from the cache.nodeStartPropertyTask
method which returns IPropertyCotask
to start the property task.INetwork
is used when working with device Tasks. INetwork
methods are not used directly to start tasks, for this purpose, a mechanism of Cotasks and Cotask Constructors has been developed.INetwork
:getCurrentTime
is the current time of an INetwork
in nanoseconds.nodeGetCurrentOutofsyncTime
is the current time deviation between the specific device and a root node of ADN, in seconds. If the value is negative, then this device is not synchronized.NodeStatus
is the state of the node that should be checked before running any Task. The TaskRunning
and Idle
values indicate if any task is currently running on this node. If the device was disconnected or is unavailable, the nodeGetStatus
returns the Invalid
value, so no task can be executed on this device. The default NodeStatus
of a newly connected device is Idle
.INetwork.getUpdateId
. The increment of the counter shows possible changes in the INetwork
instance: you should update the list of connected devices using getNodes
and check their state by nodeGetStatus
.ICotaskConstructor
. A cotaskConstructor checks nodes for the task support and starts this task, then returns an ICotask
instance.DeviceNetwork
library contains the ICotask
and ICotaskConstructor
interfaces. Every cotask from other libraries inherits the ICotask.isTaskFinished
method, which checks if the corresponding task has completed. All CotaskConstructors inherit methods isSupported
(whether the task is supported) and findSupportedNodes
(find nodes that support it). The ICotaskConstructor
methods overlap the low-level methods of the INetwork
: no explicit use of nodeIsTaskSupported
and nodeStartTask
is required.IPropertyCotask
is started with INetwork.nodeStartPropertyTask
. Since this is also a task, you must first complete the device's previous task and then start this one. IPropertyCotask
gets property values directly from a device, not from a property cache. The cache is automatically updated.IPropertyCotask
allows you to read, write and delete properties. You can get a property name by index using getPropertyKey
. Use it to get the full set of properties on the device.null
.null
.sys/
property,getPropertyKey
,