|
Legrand / Raritan / Server Technology Xerus™ JSON-RPC API
|
Peripheral devices (external sensors and actuators) are handled by the peripheral.DeviceManager interface. The device manager has a fixed number of slots to which discovered sensors can be associated. Slots hold device settings like names and thresholds, and they define the order in which sensors are listed in other client interfaces like SNMP.
The peripheral device manager can either be accessed via its well-known RID /model/peripheraldevicemanager, or its reference can be retrieved by using the getPeripheralDeviceManager() method of the pdumodel.Pdu interface.
| Resource ID | Interface |
|---|---|
/model/peripheraldevicemanager | peripheral.DeviceManager |
/model/peripheraldeviceslot/<slot> | peripheral.DeviceSlot |
/model/peripheraldeviceslot/<slot>/device | sensors.NumericSensor |
| sensors.StateSensor | |
| sensors.Switch |
The Xerus controller scans for peripheral device packages connected to its sensor ports. Each discovered package implements one or more sensor functions, e.g. a temperature sensor.
The peripheral.DeviceManager interface implements the following methods for querying discovered devices, i.e. those that are currently present:
getDiscoveredPackages() returns references to all currently present peripheral device packages.
The entries in the list are of type peripheral.Package, or a specialized derived interface like peripheral.BatteryPoweredDevicePackage or peripheral.DoorHandleControllerPackage.
getDiscoveredPackageInfos() returns a list of package info structures.
It is equivalent to calling getPackageInfo() on each entry in the list from the previous method.
getDiscoveredDevices() returns a list with information about each currently present sensor function. Each entry contains a device ID and a topology position.
Note: The device member in the structures returned by this method is always a null reference.
Peripherals become "managed" by being assigned to a device slot, either automatically or manually. The slot holds persistent information like names and thresholds. Slot information is always available, regardless of whether the peripheral is currently present of not.
Slot information is queried with the following peripheral.DeviceSlot methods:
getSettings() returns the slot settings like name, description and properties.getDevice() returns the peripheral device assigned to this slot.
For an empty slot, the method returns a null value, otherwise it returns the same structure as getDiscoveredDevices() above. However, in this case the device field contains a reference to the actual sensor interface.
Depending on the type of the assigned peripheral, the device member can reference a sensors.NumericSensor, sensors.StateSensor or sensors.Switch.
Peripheral devices must be assigned to one of the device manager's slots in order to be used. A device associated with a slot can have settings (like name or location) and a reading.
Settings for a sensor slot can be retrieved with the getSettings() method and written with setSettings(). getDevice() returns information about the device associated with the slot (or null if the slot is unassigned), as well as a reference to the respective NumericSensor or StateSensor instance.
By default, newly discovered sensors are automatically associated with the first available slot. The assignment can be manually overridden with the assign() and unassign() methods of the PeripheralDeviceSlot interface:
Another option is the assignAddress() method, which identifies the assigned peripheral by its package type and an address (topology position and function type. This version has the advantage that it does not depend on concrete serial numbers, so it can be used to bulk-configure multiple setups with the same physical configuration: