Refactor Actuators
[matches/MCTX3420.git] / server / actuators / filetest.c
diff --git a/server/actuators/filetest.c b/server/actuators/filetest.c
new file mode 100644 (file)
index 0000000..697753a
--- /dev/null
@@ -0,0 +1,25 @@
+#include "filetest.h"
+
+static FILE * f = NULL;
+bool Filetest_Init(const char * name, int id)
+{
+       f = fopen(name, "w");
+       setbuf(f, NULL); // Unbuffer
+       return (f != NULL);
+}
+
+bool Filetest_Set(int id, double value)
+{
+       Log(LOGDEBUG, "Writing %lf to file", value);
+       return (fprintf(f, "%lf\n", value) > 1);
+}
+
+bool Filetest_Cleanup(int id)
+{
+       return (fclose(f) == 0);
+}
+
+bool Filetest_Sanity(int id, double value)
+{
+       return (abs(value) <= 1e4);
+}

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