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 **/
19 /** Structure to represent data recorded by a sensor at an instant in time **/
22 /** Time at which data was taken **/
23 struct timeval time_stamp; //TODO: Consider; use float instead?
28 /** Structure to represent a sensor **/
31 /** ID number of the sensor **/
32 enum {SENSOR_TEST0=0, SENSOR_TEST1=1} id;
33 /** Buffer to store data from the sensor **/
34 DataPoint buffer[SENSOR_DATABUFSIZ];
35 /** Index of last point written in the data buffer **/
37 /** Offset position in binary file for query thread to read from**/
39 /** Binary file to write data into when buffer is full **/
41 /** Thread running the sensor **/
43 /** Mutex to protect access to stuff **/
44 pthread_mutex_t mutex;
51 extern void Sensor_Spawn(); // Initialise sensor
52 extern void Sensor_Join(); //Join sensor threads
53 extern void * Sensor_Main(void * args); // main loop for sensor thread; pass a Sensor* cast to void*
55 extern int Sensor_Query(Sensor * s, DataPoint * buffer, int bufsiz); // fill buffer with sensor data
57 extern void Sensor_Handler(FCGIContext *context, char * params);