X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=server%2Fsensor.h;h=a2590365ecf3f484bdef615c9e4ca505ed4a9a40;hb=519940987ceb9e379c91645daba84dc87680ffb8;hp=da23044cf0809608fc5a28e09eba0e60bd3f578f;hpb=ab0ae45f79caaae86b36f8230f9399138c9e73bc;p=matches%2FMCTX3420.git diff --git a/server/sensor.h b/server/sensor.h index da23044..a259036 100644 --- a/server/sensor.h +++ b/server/sensor.h @@ -5,15 +5,13 @@ */ - #ifndef _SENSOR_H #define _SENSOR_H -#include "common.h" - /** Number of data points to keep in sensor buffers **/ #define SENSOR_DATABUFSIZ 10 +#define SENSOR_QUERYBUFSIZ 10 /** Number of sensors **/ #define NUMSENSORS 1 @@ -22,7 +20,7 @@ typedef struct { /** Time at which data was taken **/ - float time; + struct timeval time_stamp; //TODO: Consider; use float instead? /** Value of data **/ float value; } DataPoint; @@ -31,7 +29,7 @@ typedef struct typedef struct { /** ID number of the sensor **/ - enum {SENSOR_TEST0=0, SENSOR_TEST1=1, SENSOR_NONE} id; + enum {SENSOR_TEST0=0, SENSOR_TEST1=1} id; /** Buffer to store data from the sensor **/ DataPoint buffer[SENSOR_DATABUFSIZ]; /** Index of last point written in the data buffer **/ @@ -48,14 +46,16 @@ typedef struct } Sensor; -/** Array of Sensors **/ -extern Sensor g_sensors[]; -extern void Sensor_Init(Sensor * s, int id); // Initialise sensor + +extern void Sensor_Spawn(); // Initialise sensor +extern void Sensor_Join(); //Join sensor threads extern void * Sensor_Main(void * args); // main loop for sensor thread; pass a Sensor* cast to void* extern int Sensor_Query(Sensor * s, DataPoint * buffer, int bufsiz); // fill buffer with sensor data +extern void Sensor_Handler(FCGIContext *context, char * params); + #endif //_SENSOR_H