Legrand / Raritan / Server Technology Xerus™ JSON-RPC API
Loading...
Searching...
No Matches
SensorLogger.idl
1/* SPDX-License-Identifier: BSD-3-Clause */
2/*
3 * Copyright 2009 Raritan Inc. All rights reserved.
4 */
5
6#include <Sensor.idl>
7#include <PeripheralDeviceSlot.idl>
8#include <UserEvent.idl>
9
10/** Sensors Model */
11module sensors {
12
13 /**
14 * Sensor logger interface.
15 *
16 * The sensor log stores a fixed number of log records for each
17 * enabled sensor. Log records hold the minimum, maximum and average
18 * reading of all samples within the period as well as the most
19 * critical state.
20 *
21 * Record IDs start at 1 and grow continuously without wrap-around. To
22 * avoid race conditions it is allowed to request records that are no
23 * longer available, i.e. have rotated out of the log. Unavailable
24 * records come back empty (available = false, timestamp = 0). It is
25 * not OK to read past newestRecId.
26 *
27 * Log record periods are synchronized with the system time, so all
28 * devices with the same log settings and proper time configuration
29 * move to a new record simultaneously.
30 */
31 interface Logger {
32
33 /** Sensor logger info */
34 structure Info {
35 int samplePeriod; ///< Sample interval in milliseconds
36 int maxTotalRecords; ///< Maximum supported number of log records (number of
37 ///< logged sensors multiplied by log capacity)
38 int effectiveCapacity; ///< Effective log capacity; may be lower than the
39 ///< setting to meet the maxTotalRecords limit.
40 int oldestRecId; ///< ID of oldest record in buffer (0 if empty)
41 int newestRecId; ///< ID of newest record in buffer (0 if empty)
42 };
43
44 /** Sensor logger settings */
45 structure Settings {
46 boolean isEnabled; ///< \c true if sensor logging is enabled
47 int samplesPerRecord; ///< Number of samples per log record
48 int logCapacity; ///< Maximum number of log records in buffer
49 boolean backupEnabled; ///< \c true if backup to external storage is enabled
50 };
51
52 /** Set of logged sensors */
53 structure SensorSet {
54 /** List of numeric or state sensors */
56 /** List of peripheral device slots */
58 };
59
60 /** Event: Sensor logger info has changed */
61 valueobject InfoChangedEvent extends idl.Event {
62 Info oldInfo; ///< Info before change
63 Info newInfo; ///< Info after change
64 };
65
66 /** Event: Sensor logger settings have been changed */
67 valueobject SettingsChangedEvent extends event.UserEvent {
68 Settings oldSettings; ///< Settings before change
69 Settings newSettings; ///< Settings after change
70 };
71
72 /** Event: Set of logged sensors has been changed */
73 valueobject LoggedSensorsChangedEvent extends event.UserEvent {
74 SensorSet oldSensors; ///< Sensor set before change
75 SensorSet newSensors; ///< Sensor set after change
76 };
77
78 /**
79 * Retrieve the sensor logger info.
80 *
81 * @return Sensor logger info
82 */
84
85 /**
86 * Retrieve the sensor logger settings.
87 *
88 * @return Sensor logger settings
89 */
91
92 /**
93 * Change the sensor logger settings.
94 *
95 * @param settings New settings
96 *
97 * @return 0 if OK
98 * @return 1 if any parameters are invalid
99 */
100 int setSettings(in Settings settings);
101
102 /** Sensor state in log record */
103 constant int STATE_UNAVAILABLE = 0; ///< Unavailable
104 constant int STATE_OPEN = 1; ///< Circuit breaker open
105 constant int STATE_CLOSE = 2; ///< Circuit breaker closed
106 constant int STATE_BELOW_LOWER_CRITICAL = 3; ///< Numeric sensor below lower critical threshold
107 constant int STATE_BELOW_LOWER_WARNING = 4; ///< Numeric sensor below lower warning threshold
108 constant int STATE_NORMAL = 5; ///< Numeric sensor in normal range; normal operation
109 constant int STATE_ABOVE_UPPER_WARNING = 6; ///< Numeric sensor above upper warning threshold
110 constant int STATE_ABOVE_UPPER_CRITICAL = 7; ///< Numeric sensor above upper critical threshold
111 constant int STATE_ON = 8; ///< Power state on
112 constant int STATE_OFF = 9; ///< Power state off
113 constant int STATE_ALARMED = 10; ///< Alarmed
114 constant int STATE_OK = 11; ///< OK
115 constant int STATE_MARGINAL = 12; ///< Marginal
116 constant int STATE_FAIL = 13; ///< Fail
117 constant int STATE_YES = 14; ///< Yes
118 constant int STATE_NO = 15; ///< No
119 constant int STATE_STANDBY = 16; ///< Standby operation
120 constant int STATE_ONE = 17; ///< First source active
121 constant int STATE_TWO = 18; ///< Second source active
122 constant int STATE_IN_SYNC = 19; ///< Phases are in sync
123 constant int STATE_OUT_OF_SYNC = 20; ///< Phases are out of sync
124 constant int STATE_FAULT = 21; ///< Fault
125 constant int STATE_SELF_TEST = 22; ///< Sensor is currently testing itself
126 constant int STATE_I1_OPEN_FAULT = 23; ///< Inlet 1 switch open fault
127 constant int STATE_I1_SHORT_FAULT = 24; ///< Inlet 1 switch short fault
128 constant int STATE_I2_OPEN_FAULT = 25; ///< Inlet 2 switch open fault
129 constant int STATE_I2_SHORT_FAULT = 26; ///< Inlet 2 switch short fault
130 constant int STATE_WARNING = 27; ///< Warning
131 constant int STATE_CRITICAL = 28; ///< Critical
132 constant int STATE_NON_REDUNDANT = 29; ///< Non-redundant operation
133 constant int STATE_INACTIVE = 30; ///< Bypass inactive
134 constant int STATE_I1_SELECTED = 31; ///< Inlet 1 selected
135 constant int STATE_I2_SELECTED = 32; ///< Inlet 2 selected
136 constant int STATE_I1_SELECTED_AND_ACTIVE = 33; ///< Inlet 1 selected and active
137 constant int STATE_I2_SELECTED_AND_ACTIVE = 34; ///< Inlet 2 selected and active
138
139 /**
140 * Retrieve a set of log record timestamps.
141 *
142 * @param timestamps Result: Log record timestamps
143 * @param recid First record id
144 * @param count Number of records
145 *
146 * @return 0 if OK
147 * @return 1 if any record id is invalid
148 */
149 int getTimeStamps(out vector<time> timestamps,
150 in int recid, in int count);
151
152 /** Sensor log record */
153 structure Record {
154 boolean available; ///< Sensor was available for at least one sample
155 int takenValidSamples; ///< Number of samples with a valid reading/state
156 int state; ///< Sensor state
157 double minValue; ///< Minimum sensor reading
158 double avgValue; ///< Average sensor reading
159 double maxValue; ///< Maximum sensor reading
160 };
161
162 /**
163 * Retrieve log records for a given sensor.
164 *
165 * @param recs Result: Sensor log records
166 * @param sensor Sensor reference
167 * @param recid First record id
168 * @param count Number of records
169 *
170 * @return 0 if OK
171 * @return 1 if any record id is invalid
172 */
173 int getSensorRecords(out vector<Record> recs, in sensors.Sensor sensor,
174 in int recid, in int count);
175
176 /**
177 * Retrieve log records for an peripheral device slot.
178 *
179 * @param recs Result: Sensor log records
180 * @param slot Peripheral device slot reference
181 * @param recid First record id
182 * @param count Number of records
183 *
184 * @return 0 if OK
185 * @return 1 if any record id is invalid
186 */
187 int getPeripheralDeviceRecords(out vector<Record> recs,
188 in peripheral.DeviceSlot slot,
189 in int recid, in int count);
190
191 /** Sensor log record with timestamp */
192 structure TimedRecord {
193 time timestamp; ///< UNIX timestamp (UTC)
194 Record record; ///< Log record
195 };
196
197 /**
198 * Retrieve log records with timestamps for a given sensor.
199 *
200 * @param recs Result: Sensor log records
201 * @param sensor Sensor reference
202 * @param recid First record id
203 * @param count Number of records
204 *
205 * @return 0 if OK
206 * @return 1 if any record id is invalid
207 */
208 int getSensorTimedRecords(out vector<TimedRecord> recs, in sensors.Sensor sensor,
209 in int recid, in int count);
210
211 /**
212 * Retrieve log records with timestamps for an peripheral device slot.
213 *
214 * @param recs Result: Sensor log records
215 * @param slot Peripheral device slot reference
216 * @param recid First record id
217 * @param count Number of records
218 *
219 * @return 0 if OK
220 * @return 1 if any record id is invalid
221 */
222 int getPeripheralDeviceTimedRecords(out vector<TimedRecord> recs,
223 in peripheral.DeviceSlot slot,
224 in int recid, in int count);
225
226 /**
227 * Retrieve the set of logged sensors.
228 *
229 * @return Set of logged sensors
230 */
232
233 /**
234 * Change the set of logged sensors.
235 *
236 * @param sensors New set of sensors
237 *
238 * @return 0 if OK
239 * @return 1 if any sensor in the list is unknown
240 */
242
243 /**
244 * Enable logging for one or more sensors or peripheral device slots.
245 *
246 * Sensors in the list that are already logged are ignored. Logged
247 * sensors not in the list remain enabled.
248 *
249 * @param sensors Sensors and slots to be logged
250 *
251 * @return 0 if OK
252 * @return 1 if any sensor in the list is unknown
253 */
255
256 /**
257 * Disable logging for one or more sensors or peripheral device slots.
258 *
259 * Sensors in the list that are not logged are ignored. Logged sensors
260 * not in the list remain enabled.
261 *
262 * @param sensors Sensors and slots to be disabled
263 *
264 * @return 0 if OK
265 * @return 1 if any sensor in the list is unknown
266 */
268
269 /**
270 * Check if logging is enabled for a given sensor.
271 *
272 * @param sensor Sensor to be checked
273 *
274 * @return \c true if sensor is logged, \c false otherwise
275 */
276 boolean isSensorEnabled(in sensors.Sensor sensor);
277
278 /**
279 * Check if logging is enabled for a given peripheral device slot.
280 *
281 * @param sensor Peripheral device slot to be checked
282 *
283 * @return \c true if slot is logged, \c false otherwise
284 */
286
287 /**
288 * Enable logging for all PDU sensors.
289 */
291
292 /**
293 * Disable logging for all PDU sensors.
294 */
296
297 /**
298 * Get the time of the last sensor set modification.
299 *
300 * This can be used by clients which keep a cached copy of the sensor
301 * set to determine whether that copy is still up-to-date.
302 *
303 * @return Sensor set time stamp (UNIX timestamp, UTC)
304 */
306
307 /** One full log row */
308 structure LogRow {
309 /** Time of last sensor set modification (UNIX timestamp, UTC) */
311 /** Log row time stamp (UNIX timestamp, UTC) */
313 /** Sensor records; same order as in SensorSet::sensors */
314 vector<Record> sensorRecords;
315 /** Peripheral device records; same order as in SensorSet::slots */
317 };
318
319 /**
320 * Get one full log row.
321 *
322 * @param row Result: Log row
323 * @param recid Record id
324 *
325 * @return 0 if OK
326 * @return 1 if the record id is invalid
327 */
328 int getLogRow(out LogRow row, in int recid);
329
330 };
331
332}
Peripheral Device Slot.
Sensor logger interface.
int getTimeStamps(out vector< time > timestamps, in int recid, in int count)
Retrieve a set of log record timestamps.
int getLogRow(out LogRow row, in int recid)
Get one full log row.
boolean isSensorEnabled(in sensors::Sensor sensor)
Check if logging is enabled for a given sensor.
time getSensorSetTimestamp()
Get the time of the last sensor set modification.
int getPeripheralDeviceRecords(out vector< Record > recs, in peripheral::DeviceSlot slot, in int recid, in int count)
Retrieve log records for an peripheral device slot.
void disableAllSensors()
Disable logging for all PDU sensors.
int enableSensors(in SensorSet sensors)
Enable logging for one or more sensors or peripheral device slots.
int getPeripheralDeviceTimedRecords(out vector< TimedRecord > recs, in peripheral::DeviceSlot slot, in int recid, in int count)
Retrieve log records with timestamps for an peripheral device slot.
void enableAllSensors()
Enable logging for all PDU sensors.
int setSettings(in Settings settings)
Change the sensor logger settings.
Settings getSettings()
Retrieve the sensor logger settings.
int setLoggedSensors(in SensorSet sensors)
Change the set of logged sensors.
int disableSensors(in SensorSet sensors)
Disable logging for one or more sensors or peripheral device slots.
int getSensorRecords(out vector< Record > recs, in sensors::Sensor sensor, in int recid, in int count)
Retrieve log records for a given sensor.
boolean isSlotEnabled(in peripheral::DeviceSlot slot)
Check if logging is enabled for a given peripheral device slot.
int getSensorTimedRecords(out vector< TimedRecord > recs, in sensors::Sensor sensor, in int recid, in int count)
Retrieve log records with timestamps for a given sensor.
Info getInfo()
Retrieve the sensor logger info.
SensorSet getLoggedSensors()
Retrieve the set of logged sensors.
Sensor interface
Definition: Sensor.idl:15
Basic IDL definitions.
Definition: Event.idl:10
Peripheral Devices.
Sensors Model.
Common base for all events.
Definition: Event.idl:13
Event: Sensor logger info has changed.
Info oldInfo
Info before change.
Info newInfo
Info after change.
Sensor logger info.
int samplePeriod
Sample interval in milliseconds.
int newestRecId
ID of newest record in buffer (0 if empty)
int oldestRecId
ID of oldest record in buffer (0 if empty)
int maxTotalRecords
Maximum supported number of log records (number of logged sensors multiplied by log capacity)
int effectiveCapacity
Effective log capacity; may be lower than the setting to meet the maxTotalRecords limit.
One full log row.
time timestamp
Log row time stamp (UNIX timestamp, UTC)
vector< Record > peripheralDeviceRecords
Peripheral device records; same order as in SensorSet::slots.
time sensorSetTimestamp
Time of last sensor set modification (UNIX timestamp, UTC)
vector< Record > sensorRecords
Sensor records; same order as in SensorSet::sensors.
Event: Set of logged sensors has been changed.
SensorSet oldSensors
Sensor set before change.
SensorSet newSensors
Sensor set after change.
Sensor log record.
boolean available
Sensor was available for at least one sample.
double minValue
Minimum sensor reading.
double maxValue
Maximum sensor reading.
int state
Sensor state.
double avgValue
Average sensor reading.
int takenValidSamples
Number of samples with a valid reading/state.
Set of logged sensors.
vector< peripheral::DeviceSlot > slots
List of peripheral device slots.
vector< sensors::Sensor > sensors
List of numeric or state sensors.
Event: Sensor logger settings have been changed.
Settings newSettings
Settings after change.
Settings oldSettings
Settings before change.
Sensor logger settings.
int logCapacity
Maximum number of log records in buffer.
boolean backupEnabled
true if backup to external storage is enabled
int samplesPerRecord
Number of samples per log record.
boolean isEnabled
true if sensor logging is enabled
Sensor log record with timestamp.
time timestamp
UNIX timestamp (UTC)