3 * @brief Declarations for sensor thread related stuff
9 /** Number of data points to keep in sensor buffers **/
10 #define SENSOR_DATABUFSIZ 10
11 /** Size of the query buffer. @see Sensor_Handler **/
12 #define SENSOR_QUERYBUFSIZ 10
14 /** Number of sensors **/
17 /** Safety Values for sensors **/
18 #define ANALOG_FAIL0_WARN 4
19 #define ANALOG_FAIL0_SAFETY 5
20 #define ANALOG_FAIL0_MIN_WARN -4
21 #define ANALOG_FAIL0_MIN_SAFETY -5
23 typedef enum SensorId {
35 CSV, // Comma seperated vector
36 TSV // Tab seperated vector
39 /** Human readable names for the sensors **/
40 extern const char * g_sensor_names[NUMSENSORS];
42 /** Structure to represent data recorded by a sensor at an instant in time **/
45 /** Time at which data was taken **/
51 /** Structure to represent a sensor **/
54 /** ID number of the sensor **/
56 /** Buffer to store data from the sensor **/
57 DataPoint buffer[SENSOR_DATABUFSIZ];
58 /** Index of last point written in the data buffer **/
60 /** Number of points read **/
62 /** Number of points written to file **/
64 /** Binary file to write data into when buffer is full **/
66 /** Thread running the sensor **/
68 /** Mutex to protect access to stuff **/
69 pthread_mutex_t mutex;
77 extern void Sensor_Spawn(); // Initialise sensor
78 extern void Sensor_Join(); //Join sensor threads
79 extern void * Sensor_Main(void * args); // main loop for sensor thread; pass a Sensor* cast to void*
81 extern int Sensor_Query(Sensor * s, DataPoint * buffer, int bufsiz); // fill buffer with sensor data
83 extern void Sensor_Handler(FCGIContext *context, char * params);