Scripts and main daemon
This includes the scripts for the YAML parsing and the
main execution point.
Change-Id: If42154c621353b23370b63d4e58f6c75bca8b356
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/interfaces.hpp b/interfaces.hpp
new file mode 100644
index 0000000..8e7fc0b
--- /dev/null
+++ b/interfaces.hpp
@@ -0,0 +1,57 @@
+#pragma once
+
+#include <chrono>
+
+
+struct ReadReturn {
+ double value;
+ std::chrono::high_resolution_clock::time_point updated;
+};
+
+
+/*
+ * A ReadInterface is a plug-in for the PluggableSensor and anyone implementing
+ * this basically is providing a way to read a sensor.
+ */
+class ReadInterface
+{
+ public:
+ ReadInterface() { }
+
+ virtual ~ReadInterface() { }
+
+ virtual ReadReturn read(void) = 0;
+};
+
+/*
+ * A WriteInterface is a plug-in for the PluggableSensor and anyone implementing
+ * this basically is providing a way to write a sensor.
+ */
+class WriteInterface
+{
+ public:
+ WriteInterface(int64_t min, int64_t max)
+ : _min(min),
+ _max(max)
+ { }
+
+ virtual ~WriteInterface() { }
+
+ virtual void write(double value) = 0;
+
+ /*
+ * All WriteInterfaces have min/max available in case they want to error
+ * check.
+ */
+ int64_t getMin(void)
+ {
+ return _min;
+ }
+ int64_t getMax(void)
+ {
+ return _max;
+ }
+ private:
+ int64_t _min;
+ int64_t _max;
+};