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