1 #pragma once
2 
3 #include <memory>
4 #include <string>
5 
6 #include <sdbusplus/bus.hpp>
7 
8 #include "interfaces.hpp"
9 #include "sensor.hpp"
10 
11 
12 /*
13  * A Sensor that can use any reader or writer you provide.
14  */
15 class PluggableSensor : public Sensor
16 {
17     public:
18         PluggableSensor(const std::string& name,
19                         int64_t timeout,
20                         std::unique_ptr<ReadInterface> reader,
21                         std::unique_ptr<WriteInterface> writer)
22             : Sensor(name, timeout),
23               _reader(std::move(reader)),
24               _writer(std::move(writer))
25         { }
26 
27         ReadReturn read(void) override;
28         void write(double value) override;
29 
30     private:
31         std::unique_ptr<ReadInterface> _reader;
32         std::unique_ptr<WriteInterface> _writer;
33 };
34