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