Make it actually compile...
[matches/MCTX3420.git] / server / sensor.h
1 /**
2  * @file sensor.h
3  * @brief Declarations for sensor thread related stuff
4  */
5
6 #ifndef _SENSOR_H
7 #define _SENSOR_H
8
9 #include "data.h"
10
11
12
13 /** Number of sensors **/
14 #define NUMSENSORS 10
15
16 /** Sensor ids - there should be correspondence with the names in g_sensor_names **/
17 typedef enum SensorId 
18 {
19         STRAIN0,
20         STRAIN1,
21         STRAIN2,
22         STRAIN3,
23         PRESSURE0,
24         PRESSURE1,
25         PRESSURE_FEEDBACK,
26         MICROPHONE,
27         ENCLOSURE,
28         DILATOMETER
29 } SensorId;
30
31
32
33 /** Human readable names for the sensors **/
34 extern const char * g_sensor_names[NUMSENSORS];
35
36 /** Structure to represent a sensor **/
37 typedef struct
38 {
39         /** ID number of the sensor **/
40         SensorId id;
41         /** DataFile to store sensor values in **/
42         DataFile data_file;
43         /** Indicates whether the Sensor is active or not **/
44         bool activated;
45         /** Thread the Sensor is running in **/
46         pthread_t thread;
47         /** Most recently recorded data **/
48         DataPoint newest_data;
49         
50         
51 } Sensor;
52
53 // Structure to define the warning and error thresholds of the sensors
54 typedef struct
55 {
56         double max_error;
57         double min_error;
58         double max_warn;
59         double min_warn;
60 } SensorThreshold;
61
62 extern void Sensor_Init(); // One off initialisation of *all* sensors
63
64 extern void Sensor_SetModeAll(ControlModes mode, void * arg);
65 extern void Sensor_SetMode(Sensor * s, ControlModes mode, void * arg);
66
67 extern void * Sensor_Loop(void * args); // Main loop for a thread that handles a Sensor
68 extern bool Sensor_Read(Sensor * s, DataPoint * d); // Read a single DataPoint, indicating if it has changed since the last one
69 extern void Sensor_CheckData(SensorId id, double value); // Check a DataPoint
70 extern Sensor * Sensor_Identify(const char * str); // Identify a Sensor from a string Id
71
72 extern void Sensor_Handler(FCGIContext *context, char * params); // Handle a FCGI request for Sensor data
73
74 #endif //_SENSOR_H
75
76

UCC git Repository :: git.ucc.asn.au