1 #pragma once
2 
3 #include <chrono>
4 
5 
6 struct ReadReturn {
7     double value;
8     std::chrono::high_resolution_clock::time_point updated;
9 };
10 
11 
12 /*
13  * A ReadInterface is a plug-in for the PluggableSensor and anyone implementing
14  * this basically is providing a way to read a sensor.
15  */
16 class ReadInterface
17 {
18     public:
19         ReadInterface() { }
20 
21         virtual ~ReadInterface() { }
22 
23         virtual ReadReturn read(void) = 0;
24 };
25 
26 /*
27  * A WriteInterface is a plug-in for the PluggableSensor and anyone implementing
28  * this basically is providing a way to write a sensor.
29  */
30 class WriteInterface
31 {
32     public:
33         WriteInterface(int64_t min, int64_t max)
34             : _min(min),
35               _max(max)
36         { }
37 
38         virtual ~WriteInterface() { }
39 
40         virtual void write(double value) = 0;
41 
42         /*
43          * All WriteInterfaces have min/max available in case they want to error
44          * check.
45          */
46         int64_t getMin(void)
47         {
48             return _min;
49         }
50         int64_t getMax(void)
51         {
52             return _max;
53         }
54     private:
55         int64_t _min;
56         int64_t _max;
57 };
58