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_TEST0_SAFETY 1000
19 #define ANALOG_TEST1_SAFETY 1000
20 #define DIGITAL_TEST0_SAFETY 1
21 #define DIGITAL_TEST1_SAFETY 1
24 typedef enum SensorId {
34 CSV, // Comma seperated vector
35 TSV // Tab seperated vector
38 /** Human readable names for the sensors **/
39 extern const char * g_sensor_names[NUMSENSORS];
41 /** Structure to represent data recorded by a sensor at an instant in time **/
44 /** Time at which data was taken **/
50 /** Structure to represent a sensor **/
53 /** ID number of the sensor **/
55 /** Buffer to store data from the sensor **/
56 DataPoint buffer[SENSOR_DATABUFSIZ];
57 /** Index of last point written in the data buffer **/
59 /** Number of points read **/
61 /** Number of points written to file **/
63 /** Binary file to write data into when buffer is full **/
65 /** Thread running the sensor **/
67 /** Mutex to protect access to stuff **/
68 pthread_mutex_t mutex;
76 extern void Sensor_Spawn(); // Initialise sensor
77 extern void Sensor_Join(); //Join sensor threads
78 extern void * Sensor_Main(void * args); // main loop for sensor thread; pass a Sensor* cast to void*
80 extern int Sensor_Query(Sensor * s, DataPoint * buffer, int bufsiz); // fill buffer with sensor data
82 extern void Sensor_Handler(FCGIContext *context, char * params);