Patrick Venture | 863b924 | 2018-03-08 08:29:23 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Patrick Venture | da4a5dd | 2018-08-31 09:42:48 -0700 | [diff] [blame] | 3 | #include "dbus/util.hpp" |
| 4 | #include "interfaces.hpp" |
| 5 | |
Patrick Venture | 863b924 | 2018-03-08 08:29:23 -0800 | [diff] [blame] | 6 | #include <memory> |
Patrick Venture | 0df7c0f | 2018-06-13 09:02:13 -0700 | [diff] [blame] | 7 | #include <sdbusplus/bus.hpp> |
Patrick Venture | 863b924 | 2018-03-08 08:29:23 -0800 | [diff] [blame] | 8 | #include <string> |
| 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 | */ |
Patrick Venture | da4a5dd | 2018-08-31 09:42:48 -0700 | [diff] [blame] | 14 | class DbusActiveRead : public ReadInterface |
Patrick Venture | 863b924 | 2018-03-08 08:29:23 -0800 | [diff] [blame] | 15 | { |
Patrick Venture | da4a5dd | 2018-08-31 09:42:48 -0700 | [diff] [blame] | 16 | public: |
| 17 | DbusActiveRead(sdbusplus::bus::bus& bus, const std::string& path, |
| 18 | const std::string& service, DbusHelperInterface* helper) : |
| 19 | ReadInterface(), |
| 20 | _bus(bus), _path(path), _service(service), _helper(helper) |
| 21 | { |
| 22 | } |
Patrick Venture | 863b924 | 2018-03-08 08:29:23 -0800 | [diff] [blame] | 23 | |
Patrick Venture | da4a5dd | 2018-08-31 09:42:48 -0700 | [diff] [blame] | 24 | ReadReturn read(void) override; |
Patrick Venture | 863b924 | 2018-03-08 08:29:23 -0800 | [diff] [blame] | 25 | |
Patrick Venture | da4a5dd | 2018-08-31 09:42:48 -0700 | [diff] [blame] | 26 | private: |
| 27 | sdbusplus::bus::bus& _bus; |
| 28 | const std::string _path; |
| 29 | const std::string _service; // the sensor service. |
| 30 | DbusHelperInterface* _helper; |
Patrick Venture | 863b924 | 2018-03-08 08:29:23 -0800 | [diff] [blame] | 31 | }; |