Refactor Actuators
[matches/MCTX3420.git] / server / actuators / filetest.c
1 #include "filetest.h"
2
3 static FILE * f = NULL;
4 bool Filetest_Init(const char * name, int id)
5 {
6         f = fopen(name, "w");
7         setbuf(f, NULL); // Unbuffer
8         return (f != NULL);
9 }
10
11 bool Filetest_Set(int id, double value)
12 {
13         Log(LOGDEBUG, "Writing %lf to file", value);
14         return (fprintf(f, "%lf\n", value) > 1);
15 }
16
17 bool Filetest_Cleanup(int id)
18 {
19         return (fclose(f) == 0);
20 }
21
22 bool Filetest_Sanity(int id, double value)
23 {
24         return (abs(value) <= 1e4);
25 }

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