X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=server%2Fsensor.h;h=b2bb63c2fc952d5e387e4e53cdf2b341067e8c97;hb=27ff700c938e48bd88ca63575d65575150d9e842;hp=0285252dd0760167f412e96859e0f1a25781a167;hpb=450583abb79d5fedb0debabed073d9b191dac80c;p=matches%2FMCTX3420.git diff --git a/server/sensor.h b/server/sensor.h index 0285252..b2bb63c 100644 --- a/server/sensor.h +++ b/server/sensor.h @@ -56,9 +56,16 @@ typedef struct /** Human readable name of the sensor **/ const char * name; /** Sampling rate **/ - int sample_us; + struct timespec sample_time; /** Number of averages per sample **/ int averages; + /** Current data **/ + DataPoint current_data; + + /** Summed data **/ + DataPoint averaged_data; + /** Number of points read so far before applying average **/ + int num_read; @@ -73,11 +80,13 @@ extern void Sensor_SetModeAll(ControlModes mode, void * arg); extern void Sensor_SetMode(Sensor * s, ControlModes mode, void * arg); extern void * Sensor_Loop(void * args); // Main loop for a thread that handles a Sensor -extern bool Sensor_Read(Sensor * s, DataPoint * d); // Read a single DataPoint, indicating if it has changed since the last one +//extern bool Sensor_Read(Sensor * s, DataPoint * d); // Read a single DataPoint, indicating if it has changed since the last one extern Sensor * Sensor_Identify(const char * str); // Identify a Sensor from a string extern void Sensor_Handler(FCGIContext *context, char * params); // Handle a FCGI request for Sensor data +extern DataPoint Sensor_LastData(int id); + extern const char * Sensor_GetName(int id);