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 {
31 /** Human readable names for the sensors **/
32 extern const char * g_sensor_names[NUMSENSORS];
34 /** Structure to represent data recorded by a sensor at an instant in time **/
37 /** Time at which data was taken **/
43 /** Structure to represent a sensor **/
46 /** ID number of the sensor **/
48 /** Buffer to store data from the sensor **/
49 DataPoint buffer[SENSOR_DATABUFSIZ];
50 /** Index of last point written in the data buffer **/
52 /** Number of points read **/
54 /** Binary file to write data into when buffer is full **/
56 /** Thread running the sensor **/
58 /** Mutex to protect access to stuff **/
59 pthread_mutex_t mutex;
67 extern void Sensor_Spawn(); // Initialise sensor
68 extern void Sensor_Join(); //Join sensor threads
69 extern void * Sensor_Main(void * args); // main loop for sensor thread; pass a Sensor* cast to void*
71 extern int Sensor_Query(Sensor * s, DataPoint * buffer, int bufsiz); // fill buffer with sensor data
73 extern void Sensor_Handler(FCGIContext *context, char * params);