Raritan PX2/PX3 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_4_0_3 extends Sensor_4_0_3 {
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 */
32 structure ThresholdCapabilities {
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 */
44 Sensor_4_0_3.TypeSpec type;
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 */
95 float noiseThreshold;
96
97 /**
98 * Range of possible sensor readings.
99 *
100 * Range values are rounded with with decimal digits.
101 */
102 Range range;
103
104 /**
105 * Threshold capabilities
106 */
107 ThresholdCapabilities thresholdCaps;
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 structure Status {
128 boolean aboveUpperCritical; ///< Reading is above upper critical threshold
129 boolean aboveUpperWarning; ///< Reading is above upper warning threshold
130 boolean belowLowerWarning; ///< Reading is below lower warning threshold
131 boolean belowLowerCritical; ///< Reading is below lower critical threshold
132 };
133 time timestamp; ///< Timestamp of last sample
134 boolean available; ///< \c true if the sensor is available
135 Status status; ///< Numeric sensor status
136 boolean valid; ///< \c true if the sensor reading is valid
137 double value; ///< Numeric sensor reading
138 };
139
140 /** Event: Numeric sensor reading has changed */
141 valueobject ReadingChangedEvent extends idl.Event {
142 Reading newReading; ///< New numeric sensor reading
143 };
144
145 /** Event: Sensor state has changed */
146 valueobject StateChangedEvent extends idl.Event {
147 Reading oldReading; ///< Reading before state change
148 Reading newReading; ///< Reading after state change
149 };
150
151 /** Event: Sensor metadata has changed */
152 valueobject MetaDataChangedEvent extends idl.Event {
153 MetaData oldMetaData; ///< Metadata before change
154 MetaData newMetaData; ///< Metadata after change
155 };
156
157 /** Event: Sensor thresholds have changed */
158 valueobject ThresholdsChangedEvent extends event.UserEvent {
159 Thresholds oldThresholds; ///< Threshold set before change
160 Thresholds newThresholds; ///< Threshold set after change
161 };
162
163 /**
164 * Retrieve the sensor metadata.
165 *
166 * @return Sensor metadata
167 */
168 MetaData getMetaData();
169
170 /**
171 * Retrieve the sensor default thresholds.
172 *
173 * @return Set of default thresholds
174 */
175 Thresholds getDefaultThresholds();
176
177 /**
178 * Retrieve the active thresholds.
179 *
180 * @return Set of active thresholds
181 */
182 Thresholds getThresholds();
183
184 /**
185 * Change the active thresholds.
186 *
187 * @param thresh New set of thresholds
188 *
189 * @return 0 if OK
190 * @return THRESHOLD_OUT_OF_RANGE if any threshold is out of range
191 * @return THRESHOLD_INVALID if thresholds don't meet the requirements
192 * @return THRESHOLD_NOT_SUPPORTED if threshold is not supported
193 */
194 int setThresholds(in Thresholds thresh);
195
196 /**
197 * Get the sensor reading.
198 *
199 * @return Sensor reading
200 */
201 Reading getReading();
202
203 };
204
205 }
206
207 #endif
sensors::NumericSensor_4_0_3::Thresholds::upperWarning
double upperWarning
Upper warning threshold.
Definition: NumericSensor.idl:115
sensors::NumericSensor_4_0_3::Reading::Status
Numeric sensor status.
Definition: NumericSensor.idl:127
sensors::NumericSensor_4_0_3::Range
Range of possible sensor readings.
Definition: NumericSensor.idl:24
sensors::NumericSensor_4_0_3::Thresholds::upperCritical
double upperCritical
Upper critical threshold.
Definition: NumericSensor.idl:113
sensors::NumericSensor_4_0_3::MetaData::tolerance
float tolerance
Sensor tolerance.
Definition: NumericSensor.idl:86
sensors::NumericSensor_4_0_3::ThresholdCapabilities::hasLowerWarning
boolean hasLowerWarning
Sensor has lower warning threshold.
Definition: NumericSensor.idl:35
sensors::NumericSensor_4_0_3::ThresholdCapabilities::hasUpperCritical
boolean hasUpperCritical
Sensor has upper critical threshold.
Definition: NumericSensor.idl:33
sensors::NumericSensor_4_0_3::Thresholds::lowerCriticalActive
boolean lowerCriticalActive
true if the lower critical threshold is enabled
Definition: NumericSensor.idl:118
sensors::NumericSensor_4_0_3::Thresholds::deassertionHysteresis
float deassertionHysteresis
Deassertion hysteresis.
Definition: NumericSensor.idl:121
sensors::NumericSensor_4_0_3::Range::upper
double upper
Maximum reading.
Definition: NumericSensor.idl:26
sensors::NumericSensor_4_0_3::MetaData::noiseThreshold
float noiseThreshold
Sensor noise threshold.
Definition: NumericSensor.idl:95
sensors::NumericSensor_4_0_3::Reading::Status::aboveUpperCritical
boolean aboveUpperCritical
Reading is above upper critical threshold.
Definition: NumericSensor.idl:128
sensors::NumericSensor_4_0_3::Thresholds::lowerCritical
double lowerCritical
Lower critical threshold.
Definition: NumericSensor.idl:119
sensors::NumericSensor_4_0_3::newThresholds
Thresholds newThresholds
Threshold set after change.
Definition: NumericSensor.idl:160
sensors::NumericSensor_4_0_3::MetaData::thresholdCaps
ThresholdCapabilities thresholdCaps
Threshold capabilities.
Definition: NumericSensor.idl:107
sensors::NumericSensor_4_0_3::Reading::valid
boolean valid
true if the sensor reading is valid
Definition: NumericSensor.idl:136
sensors::NumericSensor_4_0_3::Thresholds::upperCriticalActive
boolean upperCriticalActive
true if the upper critical threshold is enabled
Definition: NumericSensor.idl:112
sensors::NumericSensor_4_0_3::Range::lower
double lower
Minimum reading.
Definition: NumericSensor.idl:25
sensors::NumericSensor_4_0_3::Thresholds::lowerWarning
double lowerWarning
Lower warning threshold.
Definition: NumericSensor.idl:117
sensors::NumericSensor_4_0_3::Reading::timestamp
time timestamp
Timestamp of last sample.
Definition: NumericSensor.idl:133
idl
Basic IDL definitions.
Definition: Event.idl:10
sensors::NumericSensor_4_0_3::MetaData::resolution
float resolution
Sensor resolution.
Definition: NumericSensor.idl:74
sensors::NumericSensor_4_0_3::MetaData::decdigits
int decdigits
Number of significant decimal digits.
Definition: NumericSensor.idl:53
sensors::NumericSensor_4_0_3::Reading::value
double value
Numeric sensor reading.
Definition: NumericSensor.idl:137
sensors::NumericSensor_4_0_3::Reading::Status::belowLowerWarning
boolean belowLowerWarning
Reading is below lower warning threshold.
Definition: NumericSensor.idl:130
sensors::NumericSensor_4_0_3::Reading::available
boolean available
true if the sensor is available
Definition: NumericSensor.idl:134
sensors::NumericSensor_4_0_3::MetaData::accuracy
float accuracy
Sensor accuracy in percent.
Definition: NumericSensor.idl:66
sensors::NumericSensor_4_0_3::Thresholds
Numeric sensor thresholds.
Definition: NumericSensor.idl:111
sensors::Sensor_4_0_3
Sensor interface
Definition: Sensor.idl:15
sensors::NumericSensor_4_0_3::Reading
Numeric sensor reading.
Definition: NumericSensor.idl:125
sensors::NumericSensor_4_0_3::newMetaData
MetaData newMetaData
Metadata after change.
Definition: NumericSensor.idl:154
sensors::NumericSensor_4_0_3::Reading::Status::belowLowerCritical
boolean belowLowerCritical
Reading is below lower critical threshold.
Definition: NumericSensor.idl:131
sensors::NumericSensor_4_0_3::newReading
Reading newReading
Reading after state change.
Definition: NumericSensor.idl:148
sensors::NumericSensor_4_0_3::MetaData::type
Sensor_4_0_3::TypeSpec type
Sensor type, reading type and unit.
Definition: NumericSensor.idl:44
sensors
Sensors Model.
Definition: AccumulatingNumericSensor.idl:13
sensors::Sensor_4_0_3::TypeSpec
Complete sensor type specification.
Definition: Sensor.idl:160
sensors::NumericSensor_4_0_3::Thresholds::lowerWarningActive
boolean lowerWarningActive
true if the lower warning threshold is enabled
Definition: NumericSensor.idl:116
sensors::NumericSensor_4_0_3::Reading::Status::aboveUpperWarning
boolean aboveUpperWarning
Reading is above upper warning threshold.
Definition: NumericSensor.idl:129
sensors::NumericSensor_4_0_3::Reading::status
Status status
Numeric sensor status.
Definition: NumericSensor.idl:135
sensors::NumericSensor_4_0_3
A sensor with numeric readings.
Definition: NumericSensor.idl:17
sensors::NumericSensor_4_0_3::Thresholds::upperWarningActive
boolean upperWarningActive
true if the upper warning threshold is enabled
Definition: NumericSensor.idl:114
sensors::NumericSensor_4_0_3::ThresholdCapabilities::hasLowerCritical
boolean hasLowerCritical
Sensor has lower critical threshold.
Definition: NumericSensor.idl:36
sensors::NumericSensor_4_0_3::Thresholds::assertionTimeout
int assertionTimeout
Assertion timeout in samples.
Definition: NumericSensor.idl:120
sensors::NumericSensor_4_0_3::ThresholdCapabilities::hasUpperWarning
boolean hasUpperWarning
Sensor has upper warning threshold.
Definition: NumericSensor.idl:34
sensors::NumericSensor_4_0_3::MetaData
Numeric sensor metadata.
Definition: NumericSensor.idl:40
sensors::NumericSensor_4_0_3::MetaData::range
Range range
Range of possible sensor readings.
Definition: NumericSensor.idl:102
sensors::NumericSensor_4_0_3::ThresholdCapabilities
Threshold capabilities.
Definition: NumericSensor.idl:32