Legrand / Raritan / Server Technology Xerus™ PDU JSON-RPC API
PeripheralDeviceSlot.idl
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*
3  * Copyright 2012 Raritan Inc. All rights reserved.
4  */
5 
6 #ifndef __PERIPHERAL_DEVICE_SLOT_IDL__
7 #define __PERIPHERAL_DEVICE_SLOT_IDL__
8 
9 #include <Sensor.idl>
10 #include <UserEvent.idl>
11 
12 /** Peripheral Devices */
13 module peripheral {
14 
15  /** peripheral device port types */
16  [unknown_fallback("UNSPECIFIED")]
17  enumeration PortType {
18  ONBOARD, ///< a built in, inaccessible port
19  DEV_PORT, ///< a sensor port on the device
20  ONEWIRE_HUB_PORT, ///< a port on a Hub
21  ONEWIRE_CHAIN_POS, ///< a chain position
22  REMOTE_HUB_PORT, ///< a RS485 remote hub port
23  WIRELESS_BRIDGE, ///< a wireless bridge, e.g. usb dongle
24  WIRELESS_DEVICE, ///< a wireless device
25  UNSPECIFIED, ///< device type is unknown
26  GATEWAY_SENSOR ///< a gateway sensor
27  };
28 
29  /** peripheral device position element, list forms position */
30  structure PosElement {
31  PortType portType; ///< type of the element
32  string port; ///< value of the element, a label
33  };
34 
35  /** peripheral device identification */
36  structure DeviceID {
37  string serial; ///< Serial number
38  sensors.Sensor.TypeSpec type; ///< device's type spec
39  boolean isActuator; ///< true if device is an actuator
40  int channel; ///< Channel number
41  };
42 
43  /** peripheral device position based address */
44  structure Address {
45  vector<PosElement> position; ///< Position within 1-wire topo
46  sensors.Sensor.TypeSpec type; ///< device's type spec
47  boolean isActuator; ///< true if device is an actuator
48  int channel; ///< Channel number
49  };
50 
51  /**
52  * A peripheral device is the collection of
53  * - device identification
54  * - device position
55  * - a flag indicating actuator type
56  * - device reference
57  */
58  valueobject Device {
59  DeviceID deviceID; ///< device identification
60  vector<PosElement> position; ///< Position within 1-wire topo
61  string packageClass; ///< physical package identifier
62  sensors.Sensor device; ///< device reference
63  };
64 
65  /** Peripheral Device Slot */
66  interface DeviceSlot {
67 
68  constant int ERR_INVALID_PARAMS = 1; ///< Invalid parameters
69  constant int ERR_NOT_SUPPORTED = 2; ///< Operation not supported
70 
71  constant int CHANNEL_INVALID = -1;///< Device has no channels
72 
73  /** user writeable location */
74  structure Location {
75  string x; ///< X coordinate
76  string y; ///< Y coordinate
77  string z; ///< Z coordinate (semantics depends on ZCoordMode)
78  };
79 
80  /** user configurable slot attributes */
81  structure Settings {
82  string name; ///< User-defined name
83  string description; ///< User-defined description
84  Location location; ///< user-defined device location
85  boolean useDefaultThresholds; ///< use default thresholds
86  map<string, string> properties; ///< sensor specific settings
87  };
88 
89  /** Event: The device attached to this slot has changed */
90  valueobject DeviceChangedEvent extends idl.Event {
91  Device oldDevice; ///< Device before change
92  Device newDevice; ///< Device after change
93  };
94 
95  /** Event: The slot settings have been changed */
96  valueobject SettingsChangedEvent extends event.UserEvent {
97  Settings oldSettings; ///< Settings before change
98  Settings newSettings; ///< Settings after change
99  };
100 
101  /**
102  * Returns the actual device reference.
103  * The reference becomes invalid due to assign/unassign method
104  * call. This conditions is also flagged by EVT_KEY_DEVICE_CHANGED
105  * event
106  */
108 
109  /**
110  * Associate this slot with a given (old or detected new) peripheral device.
111  *
112  * @param devid peripheral device identification
113  *
114  * @return 0 if OK
115  * @return ERR_INVALID_PARAMS if devid is unknown or invalid
116  */
117  int assign(in DeviceID devid);
118 
119  /**
120  * Associate this slot with an addressable (new) peripheral device.
121  *
122  * @param address peripheral device address
123  *
124  * @return 0 if OK
125  * @return ERR_INVALID_PARAMS if address is invalid
126  */
127  int assignAddress(in string packageClass, in Address address);
128 
129  /**
130  * Break the association for this slot.
131  * @return 0 if OK
132  * @return ERR_NOT_SUPPORTED if operation is not supported
133  * this is the case for sensors with
134  * complete position information
135  */
136  int unassign();
137 
138  /**
139  * Retrieve the user-defined settings.
140  *
141  * @return Slot settings
142  */
144 
145  /**
146  * Change the slot settings.
147  *
148  * @param settings New slot settings
149  *
150  * @return 0 if OK
151  * @return ERR_INVALID_PARAMS if any parameters are invalid
152  */
153  int setSettings(in Settings settings);
154 
155  };
156 
157 }
158 
159 #endif /* !__PERIPHERAL_DEVICE_SLOT_IDL__ */
Peripheral Device Slot.
Definition: PeripheralDeviceSlot.idl:66
int assignAddress(in string packageClass, in Address address)
Associate this slot with an addressable (new) peripheral device.
Device getDevice()
Returns the actual device reference.
Settings getSettings()
Retrieve the user-defined settings.
int assign(in DeviceID devid)
Associate this slot with a given (old or detected new) peripheral device.
int unassign()
Break the association for this slot.
int setSettings(in Settings settings)
Change the slot settings.
Sensor interface
Definition: Sensor.idl:15
Basic IDL definitions.
Definition: Event.idl:10
Peripheral Devices.
Definition: GatewaySensorManager.idl:17
PortType
peripheral device port types
Definition: PeripheralDeviceSlot.idl:17
@ REMOTE_HUB_PORT
a RS485 remote hub port
Definition: PeripheralDeviceSlot.idl:22
@ WIRELESS_BRIDGE
a wireless bridge, e.g. usb dongle
Definition: PeripheralDeviceSlot.idl:23
@ WIRELESS_DEVICE
a wireless device
Definition: PeripheralDeviceSlot.idl:24
@ UNSPECIFIED
device type is unknown
Definition: PeripheralDeviceSlot.idl:25
@ ONBOARD
a built in, inaccessible port
Definition: PeripheralDeviceSlot.idl:18
@ ONEWIRE_HUB_PORT
a port on a Hub
Definition: PeripheralDeviceSlot.idl:20
@ ONEWIRE_CHAIN_POS
a chain position
Definition: PeripheralDeviceSlot.idl:21
@ GATEWAY_SENSOR
a gateway sensor
Definition: PeripheralDeviceSlot.idl:26
@ DEV_PORT
a sensor port on the device
Definition: PeripheralDeviceSlot.idl:19
Sensors Model.
Definition: AccumulatingNumericSensor.idl:13
Common base for all events.
Definition: Event.idl:13
peripheral device position based address
Definition: PeripheralDeviceSlot.idl:44
sensors::Sensor TypeSpec type
device's type spec
Definition: PeripheralDeviceSlot.idl:46
boolean isActuator
true if device is an actuator
Definition: PeripheralDeviceSlot.idl:47
int channel
Channel number.
Definition: PeripheralDeviceSlot.idl:48
vector< PosElement > position
Position within 1-wire topo.
Definition: PeripheralDeviceSlot.idl:45
peripheral device identification
Definition: PeripheralDeviceSlot.idl:36
boolean isActuator
true if device is an actuator
Definition: PeripheralDeviceSlot.idl:39
string serial
Serial number.
Definition: PeripheralDeviceSlot.idl:37
int channel
Channel number.
Definition: PeripheralDeviceSlot.idl:40
sensors::Sensor TypeSpec type
device's type spec
Definition: PeripheralDeviceSlot.idl:38
Event: The device attached to this slot has changed.
Definition: PeripheralDeviceSlot.idl:90
Device oldDevice
Device before change.
Definition: PeripheralDeviceSlot.idl:91
Device newDevice
Device after change.
Definition: PeripheralDeviceSlot.idl:92
user writeable location
Definition: PeripheralDeviceSlot.idl:74
string x
X coordinate.
Definition: PeripheralDeviceSlot.idl:75
string y
Y coordinate.
Definition: PeripheralDeviceSlot.idl:76
string z
Z coordinate (semantics depends on ZCoordMode)
Definition: PeripheralDeviceSlot.idl:77
Event: The slot settings have been changed.
Definition: PeripheralDeviceSlot.idl:96
Settings oldSettings
Settings before change.
Definition: PeripheralDeviceSlot.idl:97
Settings newSettings
Settings after change.
Definition: PeripheralDeviceSlot.idl:98
user configurable slot attributes
Definition: PeripheralDeviceSlot.idl:81
map< string, string > properties
sensor specific settings
Definition: PeripheralDeviceSlot.idl:86
string name
User-defined name.
Definition: PeripheralDeviceSlot.idl:82
boolean useDefaultThresholds
use default thresholds
Definition: PeripheralDeviceSlot.idl:85
Location location
user-defined device location
Definition: PeripheralDeviceSlot.idl:84
string description
User-defined description.
Definition: PeripheralDeviceSlot.idl:83
A peripheral device is the collection of.
Definition: PeripheralDeviceSlot.idl:58
sensors::Sensor device
device reference
Definition: PeripheralDeviceSlot.idl:62
string packageClass
physical package identifier
Definition: PeripheralDeviceSlot.idl:61
vector< PosElement > position
Position within 1-wire topo.
Definition: PeripheralDeviceSlot.idl:60
DeviceID deviceID
device identification
Definition: PeripheralDeviceSlot.idl:59
peripheral device position element, list forms position
Definition: PeripheralDeviceSlot.idl:30
PortType portType
type of the element
Definition: PeripheralDeviceSlot.idl:31
string port
value of the element, a label
Definition: PeripheralDeviceSlot.idl:32
Complete sensor type specification.
Definition: Sensor.idl:169