1863b9246SPatrick Venture #pragma once 2863b9246SPatrick Venture 3863b9246SPatrick Venture #include "interfaces.hpp" 4863b9246SPatrick Venture #include "sensor.hpp" 5863b9246SPatrick Venture 6a83a3eccSPatrick Venture #include <memory> 7da4a5dd1SPatrick Venture #include <string> 8863b9246SPatrick Venture 9a076487aSPatrick Venture namespace pid_control 10a076487aSPatrick Venture { 11a076487aSPatrick Venture 12863b9246SPatrick Venture /* 13863b9246SPatrick Venture * A Sensor that can use any reader or writer you provide. 14863b9246SPatrick Venture */ 15863b9246SPatrick Venture class PluggableSensor : public Sensor 16863b9246SPatrick Venture { 17863b9246SPatrick Venture public: PluggableSensor(const std::string & name,int64_t timeout,std::unique_ptr<ReadInterface> reader,std::unique_ptr<WriteInterface> writer)18da4a5dd1SPatrick Venture PluggableSensor(const std::string& name, int64_t timeout, 19863b9246SPatrick Venture std::unique_ptr<ReadInterface> reader, 20da4a5dd1SPatrick Venture std::unique_ptr<WriteInterface> writer) : 21*bd63bcacSPatrick Williams Sensor(name, timeout), _reader(std::move(reader)), 22*bd63bcacSPatrick Williams _writer(std::move(writer)) 23a83a3eccSPatrick Venture {} 24863b9246SPatrick Venture 25863b9246SPatrick Venture ReadReturn read(void) override; 26863b9246SPatrick Venture void write(double value) override; 272400ce43SJosh Lehan void write(double value, bool force, int64_t* written) override; 2836b7d8ebSJames Feist bool getFailed(void) override; 29863b9246SPatrick Venture 30863b9246SPatrick Venture private: 31863b9246SPatrick Venture std::unique_ptr<ReadInterface> _reader; 32863b9246SPatrick Venture std::unique_ptr<WriteInterface> _writer; 33863b9246SPatrick Venture }; 34a076487aSPatrick Venture 35a076487aSPatrick Venture } // namespace pid_control 36