3 * @brief Declarations for sensor thread related stuff
13 * Maximum number of sensors program can be compiled with
14 * (If you get an error "Increase SENSORS_MAX from %d" this is what it refers to)
16 #define SENSORS_MAX 10
17 extern int g_num_sensors; // in sensor.c
20 /** Structure to define the warning and error thresholds of the sensors **/
23 /** Maximum safe value **/
25 /** Minimum safe value **/
27 /** Maximum value before a warning is reported **/
29 /** Minimum value before a warning is reported **/
33 /** Function pointer for sensor reading **/
34 typedef bool (*ReadFn)(int, double * val);
35 /** Function pointer for sensor initialisation **/
36 typedef bool (*InitFn)(const char *, int);
37 /** Function pointer for sensor cleanup **/
38 typedef bool (*CleanFn)(int);
40 /** Structure to represent a sensor **/
43 /** ID number of the sensor **/
45 /** User defined ID number **/
47 /** DataFile to store sensor values in **/
49 /** Indicates whether the Sensor is active or not **/
51 /** Thread the Sensor is running in **/
53 /** Function to read the sensor **/
55 /** Function to initialise the sensor **/
57 /** Function to cleanup the sensor **/
59 /** Human readable name of the sensor **/
61 /** Thresholds on the sensor **/
62 SensorThreshold thresholds;
68 extern void Sensor_Init(); // One off initialisation of *all* sensors
69 extern void Sensor_Cleanup(); // Cleanup all sensors
71 extern void Sensor_SetModeAll(ControlModes mode, void * arg);
72 extern void Sensor_SetMode(Sensor * s, ControlModes mode, void * arg);
74 extern void * Sensor_Loop(void * args); // Main loop for a thread that handles a Sensor
75 extern bool Sensor_Read(Sensor * s, DataPoint * d); // Read a single DataPoint, indicating if it has changed since the last one
76 extern void Sensor_CheckData(Sensor * s, double value); // Check a DataPoint
77 extern Sensor * Sensor_Identify(const char * str); // Identify a Sensor from a string
79 extern void Sensor_Handler(FCGIContext *context, char * params); // Handle a FCGI request for Sensor data
81 extern const char * Sensor_GetName(int id);