4 * @purpose Declarations for sensor thread related stuff
11 /** Number of data points to keep in sensor buffers **/
12 #define SENSOR_DATABUFSIZ 10
14 #define SENSOR_QUERYBUFSIZ 10
16 /** Number of sensors **/
20 /** Structure to represent data recorded by a sensor at an instant in time **/
23 /** Time at which data was taken **/
29 /** Structure to represent a sensor **/
32 /** ID number of the sensor **/
33 enum {ANALOG_TEST0=2, ANALOG_TEST1=0, DIGITAL_TEST0=1, DIGITAL_TEST1=3} id;
34 /** Buffer to store data from the sensor **/
35 DataPoint buffer[SENSOR_DATABUFSIZ];
36 /** Index of last point written in the data buffer **/
38 /** Number of points read **/
40 /** Binary file to write data into when buffer is full **/
42 /** Thread running the sensor **/
44 /** Mutex to protect access to stuff **/
45 pthread_mutex_t mutex;
53 extern void Sensor_Spawn(); // Initialise sensor
54 extern void Sensor_Join(); //Join sensor threads
55 extern void * Sensor_Main(void * args); // main loop for sensor thread; pass a Sensor* cast to void*
57 extern int Sensor_Query(Sensor * s, DataPoint * buffer, int bufsiz); // fill buffer with sensor data
59 extern void Sensor_Handler(FCGIContext *context, char * params);