Legrand / Raritan / Server Technology Xerus™ PDU JSON-RPC API
AlertedSensorManager.idl
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*
3  * Copyright 2018 Raritan Inc. All rights reserved.
4  */
5 
6 #ifndef __ALERTED_SENSOR_MANAGER_IDL__
7 #define __ALERTED_SENSOR_MANAGER_IDL__
8 
9 #include <Sensor.idl>
10 
11 /** Sensors model */
12 module sensors {
13 
14  /** A global instance keeping track of sensors in alerted state */
16 
17  /** Sensor alert state */
18  enumeration AlertState {
19  UNAVAILABLE, ///< Sensor is unavailable
20  NORMAL, ///< Sensor is not alerted
21  CRITICAL, ///< Sensor is in critical state
22  WARNED ///< Sensor is in warned state
23  };
24 
25  /** Statistics about monitored sensors */
26  structure SensorCounts {
27  int total; ///< Total number of monitored sensors
28  int unavailable; ///< Number of unavailable sensors
29  int critical; ///< Number of critical sensors
30  int warned; ///< Number of warned sensors
31  };
32 
33  /**
34  * Data about a monitored sensor.
35  *
36  * All entries include a reference to the sensor's parent object (e.g.
37  * an inlet or a peripheral device slot), allowing a client to identify
38  * an unknown alerted sensor with just a few RPC calls.
39  */
40  structure SensorData {
41  Sensor sensor; ///< Reference to the sensor object
42  Object parent; ///< Reference to the sensor's parent object
43  AlertState alertState; ///< Current alert state of the sensor
44  };
45 
46  /**
47  * Event: A change in the list of monitored sensors occurred.
48  *
49  * This event is fired when sensors are added to or removed from the
50  * list of monitored sensors. It is not fired when a monitored sensor's
51  * alert state changes.
52  */
53  valueobject MonitoredSensorsChangedEvent extends idl.Event {
54  SensorCounts counts; ///< Sensor statistics after the change
55  };
56 
57  /**
58  * Event: One or more sensors' alert states have changed.
59  *
60  * This event is fired whenever the result of getAlertedSensors()
61  * changes, i.e. in the following cases:
62  * - An existing sensor's alert state changes
63  * - A newly added sensor is alerted
64  * - A sensor that was alerted is removed
65  */
66  valueobject AlertedSensorsChangedEvent extends idl.Event {
67  SensorCounts counts; ///< Sensor statistics after the change
68  vector<SensorData> changedSensors; ///< Changed or added sensors
69  vector<Sensor> removedSensors; ///< Removed sensors
70  };
71 
72  /**
73  * Retrieve the current sensor counts.
74  *
75  * @return Current sensor counts
76  */
78 
79  /**
80  * Retrieve a list of all monitored sensors.
81  *
82  * @return List of monitored sensors including alert state
83  */
84  vector<SensorData> getAllSensors();
85 
86  /**
87  * Retrieve a list of currently alerted sensors.
88  *
89  * @return List of alerted sensors
90  */
91  vector<SensorData> getAlertedSensors();
92 
93  };
94 
95 }
96 
97 #endif
A global instance keeping track of sensors in alerted state.
Definition: AlertedSensorManager.idl:15
SensorCounts getSensorCounts()
Retrieve the current sensor counts.
vector< SensorData > getAllSensors()
Retrieve a list of all monitored sensors.
vector< SensorData > getAlertedSensors()
Retrieve a list of currently alerted sensors.
AlertState
Sensor alert state.
Definition: AlertedSensorManager.idl:18
@ NORMAL
Sensor is not alerted.
Definition: AlertedSensorManager.idl:20
@ CRITICAL
Sensor is in critical state.
Definition: AlertedSensorManager.idl:21
@ UNAVAILABLE
Sensor is unavailable.
Definition: AlertedSensorManager.idl:19
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: One or more sensors' alert states have changed.
Definition: AlertedSensorManager.idl:66
SensorCounts counts
Sensor statistics after the change.
Definition: AlertedSensorManager.idl:67
vector< Sensor > removedSensors
Removed sensors.
Definition: AlertedSensorManager.idl:69
vector< SensorData > changedSensors
Changed or added sensors.
Definition: AlertedSensorManager.idl:68
Event: A change in the list of monitored sensors occurred.
Definition: AlertedSensorManager.idl:53
SensorCounts counts
Sensor statistics after the change.
Definition: AlertedSensorManager.idl:54
Statistics about monitored sensors.
Definition: AlertedSensorManager.idl:26
int critical
Number of critical sensors.
Definition: AlertedSensorManager.idl:29
int unavailable
Number of unavailable sensors.
Definition: AlertedSensorManager.idl:28
int total
Total number of monitored sensors.
Definition: AlertedSensorManager.idl:27
int warned
Number of warned sensors.
Definition: AlertedSensorManager.idl:30
Data about a monitored sensor.
Definition: AlertedSensorManager.idl:40
AlertState alertState
Current alert state of the sensor.
Definition: AlertedSensorManager.idl:43
Object parent
Reference to the sensor's parent object.
Definition: AlertedSensorManager.idl:42
Sensor sensor
Reference to the sensor object.
Definition: AlertedSensorManager.idl:41