Legrand / Raritan / Server Technology Xerus™ PDU JSON-RPC API
NumericSensor.idl
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*
3  * Copyright 2009 Raritan Inc. All rights reserved.
4  */
5 
6 #ifndef __SENSORMODEL_NUMERICSENSOR_IDL__
7 #define __SENSORMODEL_NUMERICSENSOR_IDL__
8 
9 #include <Event.idl>
10 #include <Sensor.idl>
11 #include <UserEvent.idl>
12 
13 /** Sensors Model */
14 module sensors {
15 
16  /** A sensor with numeric readings */
17  interface NumericSensor extends Sensor {
18 
19  constant int THRESHOLD_OUT_OF_RANGE = 1; ///< The threshold exceedes the sensor range
20  constant int THRESHOLD_INVALID = 2; ///< The threshold constraints are not met
21  constant int THRESHOLD_NOT_SUPPORTED = 3; ///< The sensor does not support setting this threshold
22 
23  /** Range of possible sensor readings */
24  structure Range {
25  double lower; ///< Minimum reading
26  double upper; ///< Maximum reading
27  };
28 
29  /**
30  * Threshold capabilities
31  */
33  boolean hasUpperCritical; ///< Sensor has upper critical threshold
34  boolean hasUpperWarning; ///< Sensor has upper warning threshold
35  boolean hasLowerWarning; ///< Sensor has lower warning threshold
36  boolean hasLowerCritical; ///< Sensor has lower critical threshold
37  };
38 
39  /** Numeric sensor metadata */
40  structure MetaData {
41  /**
42  * Sensor type, reading type and unit
43  */
45 
46  /**
47  * Number of significant decimal digits.
48  *
49  * Indicates how many digits should be displayed
50  * to the right of the decimal point. I.e. double
51  * values must be rounded with this precision.
52  */
53  int decdigits;
54 
55  /**
56  * Sensor accuracy in percent.
57  *
58  * How close in percent measurement is to actual value.
59  * This value has an implicit precision of 2, i.e. the double
60  * value must be rounded for 2 decimal digits before use.
61  * For example a reading of 10.0 and an accuracy of 0.2
62  * means the actual reading value is 10.0 +/- 0.2%.
63  *
64  * A value of 0 means unused.
65  */
66  float accuracy;
67 
68  /**
69  * Sensor resolution.
70  *
71  * Minimum difference between any two measured values.
72  * Must be rounded with decimal digits.
73  */
74  float resolution;
75 
76  /**
77  * Sensor tolerance.
78  *
79  * Tolerance is given in +/- counts of the reading value.
80  * It indicates a constant magnitude possible error in the
81  * quantization of an analog input to the sensor.
82  * Rounded with decimal digits + 1.
83  *
84  * A value of 0 means unused.
85  */
86  float tolerance;
87 
88  /**
89  * Sensor noise threshold.
90  *
91  * Threshold under which sensor measurements will be ignored.
92  * Sensor measurements below that value will be reported at
93  * the lower bound of the sensor range.
94  */
96 
97  /**
98  * Range of possible sensor readings.
99  *
100  * Range values are rounded with with decimal digits.
101  */
103 
104  /**
105  * Threshold capabilities
106  */
108  };
109 
110  /** Numeric sensor thresholds */
111  structure Thresholds {
112  boolean upperCriticalActive; ///< \c true if the upper critical threshold is enabled
113  double upperCritical; ///< Upper critical threshold
114  boolean upperWarningActive; ///< \c true if the upper warning threshold is enabled
115  double upperWarning; ///< Upper warning threshold
116  boolean lowerWarningActive; ///< \c true if the lower warning threshold is enabled
117  double lowerWarning; ///< Lower warning threshold
118  boolean lowerCriticalActive; ///< \c true if the lower critical threshold is enabled
119  double lowerCritical; ///< Lower critical threshold
120  int assertionTimeout; ///< Assertion timeout in samples
121  float deassertionHysteresis; ///< Deassertion hysteresis
122  };
123 
124  /** Numeric sensor reading */
125  structure Reading {
126  /** Numeric sensor status
127  *
128  * The status is determined on the basis of rounded values. The
129  * rounding is done according to MetaData::decdigits. This ensures
130  * that status and value will match when displayed simultaneously,
131  * if the value is also displayed rounded.
132  */
133  structure Status {
134  boolean aboveUpperCritical; ///< Reading is above upper critical threshold
135  boolean aboveUpperWarning; ///< Reading is above upper warning threshold
136  boolean belowLowerWarning; ///< Reading is below lower warning threshold
137  boolean belowLowerCritical; ///< Reading is below lower critical threshold
138  };
139  time timestamp; ///< UNIX timestamp (UTC) of last sample
140  boolean available; ///< \c true if the sensor is available
141  Status status; ///< Numeric sensor status
142  boolean valid; ///< \c true if the sensor reading is valid
143  double value; ///< Numeric sensor reading, not rounded
144  };
145 
146  /** Numeric sensor minimum / maximum values */
147  structure MinMax {
148  double minReading; ///< the minimum value since observedSince, not rounded
149  time minReadingTimestamp; ///< UNIX timestamp (UTC) when the minimum value has occurred
150  double maxReading; ///< the maximum value since observedSince, not rounded
151  time maxReadingTimestamp; ///< UNIX timestamp (UTC) when the maximum value has occurred
152  boolean valid; ///< \c true if min and max are valid
153  time observedSince; ///< UNIX timestamp (UTC) of last reset of min / max
154  };
155 
156  /** Event: Numeric sensor reading has changed
157  *
158  * The event is sent when the Reading::value has changed enough to affect
159  * a digit to be displayed according to MetaData::decdigits, or if one of
160  * Reading::available, Reading::status or Reading::valid has changed.
161  */
162  valueobject ReadingChangedEvent extends idl.Event {
163  Reading newReading; ///< New numeric sensor reading
164  };
165 
166  /** Event: Sensor state has changed */
167  valueobject StateChangedEvent extends idl.Event {
168  Reading oldReading; ///< Reading before state change
169  Reading newReading; ///< Reading after state change
170  };
171 
172  /** Event: Sensor metadata has changed */
173  valueobject MetaDataChangedEvent extends idl.Event {
174  MetaData oldMetaData; ///< Metadata before change
175  MetaData newMetaData; ///< Metadata after change
176  };
177 
178  /** Event: Sensor default thresholds have changed */
179  valueobject DefaultThresholdsChangedEvent extends event.UserEvent {
180  Thresholds oldDefaultThresholds; ///< Default thresholds set before change
181  Thresholds newDefaultThresholds; ///< Default thresholds set after change
182  };
183 
184  /** Event: Sensor thresholds have changed */
185  valueobject ThresholdsChangedEvent extends event.UserEvent {
186  Thresholds oldThresholds; ///< Threshold set before change
187  Thresholds newThresholds; ///< Threshold set after change
188  };
189 
190  /** Event: Sensor min or max value has changed
191  *
192  * The event is sent when MinMax::minReading or MinMax::maxReading have
193  * changed enough to affect a digit to be displayed according to MetaData::decdigits,
194  * or if MinMax::valid has changed.
195  */
196  valueobject MinMaxChangedEvent extends idl.Event {
197  MinMax newMinMax; ///< Minimum / maximum of sensor value
198  };
199 
200  /** Event: Min / Max value has been reset */
201  valueobject MinMaxResetEvent extends event.UserEvent {
202  MinMax oldMinMax; ///< Min / max before reset
203  MinMax newMinMax; ///< Min / max after reset, incl. new observedSince timestamp
204  };
205 
206  /**
207  * Retrieve the sensor metadata.
208  *
209  * @return Sensor metadata
210  */
212 
213  /**
214  * Retrieve the sensor default thresholds.
215  *
216  * @return Set of default thresholds
217  */
219 
220  /**
221  * Retrieve the thresholds.
222  *
223  * Note: In case of peripheral devices these thresholds may be overridden
224  * by the device slot configuration.
225  *
226  * @return Set of configured thresholds
227  */
229 
230  /**
231  * Change the thresholds.
232  *
233  * Note: In case of peripheral devices these thresholds may be overridden
234  * by the device slot configuration.
235  *
236  * @param thresh New set of thresholds
237  *
238  * @return 0 if OK
239  * @return THRESHOLD_OUT_OF_RANGE if any threshold is out of range
240  * @return THRESHOLD_INVALID if thresholds don't meet the requirements
241  * @return THRESHOLD_NOT_SUPPORTED if threshold is not supported
242  */
243  int setThresholds(in Thresholds thresh);
244 
245  /**
246  * Get the sensor reading.
247  *
248  * @return Sensor reading, not rounded
249  */
251 
252  /**
253  * Get the min / max of sensor value.
254  *
255  * @return Sensor min / max values
256  */
258 
259  /**
260  * Reset min / max of sensor value.
261  *
262  */
263  void resetMinMax();
264 
265  };
266 
267 }
268 
269 #endif
A sensor with numeric readings.
Definition: NumericSensor.idl:17
void resetMinMax()
Reset min / max of sensor value.
Reading getReading()
Get the sensor reading.
Thresholds getThresholds()
Retrieve the thresholds.
Thresholds getDefaultThresholds()
Retrieve the sensor default thresholds.
MinMax getMinMax()
Get the min / max of sensor value.
MetaData getMetaData()
Retrieve the sensor metadata.
int setThresholds(in Thresholds thresh)
Change the thresholds.
Sensor interface
Definition: Sensor.idl:15
Basic IDL definitions.
Definition: Event.idl:10
Sensors Model.
Definition: AccumulatingNumericSensor.idl:13
Common base for all events.
Definition: Event.idl:13
Event: Sensor default thresholds have changed.
Definition: NumericSensor.idl:179
Thresholds oldDefaultThresholds
Default thresholds set before change.
Definition: NumericSensor.idl:180
Thresholds newDefaultThresholds
Default thresholds set after change.
Definition: NumericSensor.idl:181
Event: Sensor metadata has changed.
Definition: NumericSensor.idl:173
MetaData oldMetaData
Metadata before change.
Definition: NumericSensor.idl:174
MetaData newMetaData
Metadata after change.
Definition: NumericSensor.idl:175
Numeric sensor metadata.
Definition: NumericSensor.idl:40
Sensor::TypeSpec type
Sensor type, reading type and unit.
Definition: NumericSensor.idl:44
float resolution
Sensor resolution.
Definition: NumericSensor.idl:74
float noiseThreshold
Sensor noise threshold.
Definition: NumericSensor.idl:95
float tolerance
Sensor tolerance.
Definition: NumericSensor.idl:86
float accuracy
Sensor accuracy in percent.
Definition: NumericSensor.idl:66
Range range
Range of possible sensor readings.
Definition: NumericSensor.idl:102
int decdigits
Number of significant decimal digits.
Definition: NumericSensor.idl:53
ThresholdCapabilities thresholdCaps
Threshold capabilities.
Definition: NumericSensor.idl:107
Event: Sensor min or max value has changed.
Definition: NumericSensor.idl:196
MinMax newMinMax
Minimum / maximum of sensor value.
Definition: NumericSensor.idl:197
Event: Min / Max value has been reset.
Definition: NumericSensor.idl:201
MinMax oldMinMax
Min / max before reset.
Definition: NumericSensor.idl:202
MinMax newMinMax
Min / max after reset, incl. new observedSince timestamp.
Definition: NumericSensor.idl:203
Numeric sensor minimum / maximum values.
Definition: NumericSensor.idl:147
time maxReadingTimestamp
UNIX timestamp (UTC) when the maximum value has occurred.
Definition: NumericSensor.idl:151
double minReading
the minimum value since observedSince, not rounded
Definition: NumericSensor.idl:148
boolean valid
true if min and max are valid
Definition: NumericSensor.idl:152
time minReadingTimestamp
UNIX timestamp (UTC) when the minimum value has occurred.
Definition: NumericSensor.idl:149
time observedSince
UNIX timestamp (UTC) of last reset of min / max.
Definition: NumericSensor.idl:153
double maxReading
the maximum value since observedSince, not rounded
Definition: NumericSensor.idl:150
Range of possible sensor readings.
Definition: NumericSensor.idl:24
double upper
Maximum reading.
Definition: NumericSensor.idl:26
double lower
Minimum reading.
Definition: NumericSensor.idl:25
Event: Numeric sensor reading has changed.
Definition: NumericSensor.idl:162
Reading newReading
New numeric sensor reading.
Definition: NumericSensor.idl:163
Numeric sensor status.
Definition: NumericSensor.idl:133
boolean aboveUpperCritical
Reading is above upper critical threshold.
Definition: NumericSensor.idl:134
boolean belowLowerWarning
Reading is below lower warning threshold.
Definition: NumericSensor.idl:136
boolean belowLowerCritical
Reading is below lower critical threshold.
Definition: NumericSensor.idl:137
boolean aboveUpperWarning
Reading is above upper warning threshold.
Definition: NumericSensor.idl:135
Numeric sensor reading.
Definition: NumericSensor.idl:125
Status status
Numeric sensor status.
Definition: NumericSensor.idl:141
boolean available
true if the sensor is available
Definition: NumericSensor.idl:140
double value
Numeric sensor reading, not rounded.
Definition: NumericSensor.idl:143
boolean valid
true if the sensor reading is valid
Definition: NumericSensor.idl:142
time timestamp
UNIX timestamp (UTC) of last sample.
Definition: NumericSensor.idl:139
Event: Sensor state has changed.
Definition: NumericSensor.idl:167
Reading oldReading
Reading before state change.
Definition: NumericSensor.idl:168
Reading newReading
Reading after state change.
Definition: NumericSensor.idl:169
Threshold capabilities.
Definition: NumericSensor.idl:32
boolean hasUpperCritical
Sensor has upper critical threshold.
Definition: NumericSensor.idl:33
boolean hasLowerWarning
Sensor has lower warning threshold.
Definition: NumericSensor.idl:35
boolean hasUpperWarning
Sensor has upper warning threshold.
Definition: NumericSensor.idl:34
boolean hasLowerCritical
Sensor has lower critical threshold.
Definition: NumericSensor.idl:36
Event: Sensor thresholds have changed.
Definition: NumericSensor.idl:185
Thresholds newThresholds
Threshold set after change.
Definition: NumericSensor.idl:187
Thresholds oldThresholds
Threshold set before change.
Definition: NumericSensor.idl:186
Numeric sensor thresholds.
Definition: NumericSensor.idl:111
boolean upperWarningActive
true if the upper warning threshold is enabled
Definition: NumericSensor.idl:114
double upperWarning
Upper warning threshold.
Definition: NumericSensor.idl:115
int assertionTimeout
Assertion timeout in samples.
Definition: NumericSensor.idl:120
boolean lowerWarningActive
true if the lower warning threshold is enabled
Definition: NumericSensor.idl:116
double upperCritical
Upper critical threshold.
Definition: NumericSensor.idl:113
boolean lowerCriticalActive
true if the lower critical threshold is enabled
Definition: NumericSensor.idl:118
double lowerWarning
Lower warning threshold.
Definition: NumericSensor.idl:117
float deassertionHysteresis
Deassertion hysteresis.
Definition: NumericSensor.idl:121
double lowerCritical
Lower critical threshold.
Definition: NumericSensor.idl:119
boolean upperCriticalActive
true if the upper critical threshold is enabled
Definition: NumericSensor.idl:112
Complete sensor type specification.
Definition: Sensor.idl:169