3 * @brief Declarations for sensor thread related stuff
14 * Maximum number of sensors program can be compiled with
15 * (If you get an error "Increase SENSORS_MAX from %d" this is what it refers to)
17 #define SENSORS_MAX 10
18 extern int g_num_sensors; // in sensor.c
21 /** Structure to define the warning and error thresholds of the sensors **/
22 //TODO: Replace with a call to an appropriate "Sanity" function? (see the actuator code)
25 /** Maximum safe value **/
27 /** Minimum safe value **/
29 /** Maximum value before a warning is reported **/
31 /** Minimum value before a warning is reported **/
35 /** Structure to represent a sensor **/
38 /** ID number of the sensor **/
40 /** User defined ID number **/
42 /** DataFile to store sensor values in **/
44 /** Indicates whether the Sensor is active or not **/
46 /** Thread the Sensor is running in **/
48 /** Function to read the sensor **/
50 /** Function to initialise the sensor **/
52 /** Function to cleanup the sensor **/
54 /** Function to sanity check the sensor readings **/
56 /** Human readable name of the sensor **/
59 struct timespec sample_time;
60 /** Number of averages per sample **/
63 DataPoint current_data;
66 DataPoint averaged_data;
67 /** Number of points read so far before applying average **/
76 extern void Sensor_Init(); // One off initialisation of *all* sensors
77 extern void Sensor_Cleanup(); // Cleanup all sensors
79 extern void Sensor_SetModeAll(ControlModes mode, void * arg);
80 extern void Sensor_SetMode(Sensor * s, ControlModes mode, void * arg);
82 extern void * Sensor_Loop(void * args); // Main loop for a thread that handles a Sensor
83 extern bool Sensor_Read(Sensor * s, DataPoint * d); // Read a single DataPoint, indicating if it has changed since the last one
84 extern Sensor * Sensor_Identify(const char * str); // Identify a Sensor from a string
86 extern void Sensor_Handler(FCGIContext *context, char * params); // Handle a FCGI request for Sensor data
88 extern DataPoint Sensor_LastData(int id);
90 extern const char * Sensor_GetName(int id);