1 #pragma once 2 3 #include "interfaces.hpp" 4 #include "util.hpp" 5 6 #include <sdbusplus/bus.hpp> 7 8 #include <memory> 9 #include <string> 10 11 namespace pid_control 12 { 13 14 /* 15 * This ReadInterface will actively reach out over dbus upon calling read to 16 * get the value from whomever owns the associated dbus path. 17 */ 18 class DbusActiveRead : public ReadInterface 19 { 20 public: 21 DbusActiveRead(sdbusplus::bus::bus& bus, const std::string& path, 22 const std::string& service, DbusHelperInterface* helper) : 23 ReadInterface(), 24 _bus(bus), _path(path), _service(service), _helper(helper) 25 {} 26 27 ReadReturn read(void) override; 28 29 private: 30 sdbusplus::bus::bus& _bus; 31 const std::string _path; 32 const std::string _service; // the sensor service. 33 DbusHelperInterface* _helper; 34 }; 35 36 } // namespace pid_control 37