1 #pragma once
2 
3 #include "interfaces.hpp"
4 
5 #include <chrono>
6 #include <string>
7 
8 /**
9  * Abstract base class for all sensors.
10  */
11 class Sensor
12 {
13   public:
14     Sensor(std::string name, int64_t timeout) : _name(name), _timeout(timeout)
15     {
16     }
17 
18     virtual ~Sensor()
19     {
20     }
21 
22     virtual ReadReturn read(void) = 0;
23     virtual void write(double value) = 0;
24 
25     std::string GetName(void) const
26     {
27         return _name;
28     }
29 
30     /* Returns the configurable timeout period
31      * for this sensor in seconds (undecorated).
32      */
33     int64_t GetTimeout(void) const
34     {
35         return _timeout;
36     }
37 
38   private:
39     std::string _name;
40     int64_t _timeout;
41 };
42