edited dilatometer
[matches/MCTX3420.git] / server / sensors / README
1 To add a new type of sensor to the program:
2
3 1. Create a .c and .h file
4 2. In the .h file, define an enum representing the id number of each sensor of that type (you can skip this if you only need a single sensor)
5 3. Implement a function for reading a sensor value; it should be of the form: bool Read(int id, double * value)
6    - id indicates which of the sensors of that type is being read (if you only have a single sensor you can ignore it)
7    - The function stores the result in the double pointed to by value
8    - It returns true on success and false on a (non fatal) error
9 4. Optionally add an initialisation function: bool Init(int id, char * name)
10 5. In ../sensor.c make a call to Sensor_Add in the Sensor_Init function, passing the appropriate arguments.
11    - They are: The name of the sensor (passed to Init, see 4.)
12    - The id number according to the enum (just pass 0 if you don't need more than one sensor)
13    - The Read function
14    - The Init function (or NULL if you don't need one)
15    - Threshold values in the order:
16      max_error, min_error, max_warn, min_warn (as documented in ../sensor.h)
17      - If your sensor doesn't have/need safety thresholds, just pass ridiculous values like 1e50 or 1e-50
18          - Yeah, it's hacky, but it works.
19    - You may need to increase SENSORS_MAX in ../sensor.h if you go insane with sensor adding power
20 6. Add the .o file to Makefile (the OBJ variable)

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