dbus: transition to interface for testing
To make testing easier, the dbus objects now receive a
helper interface to use instead of calling into a helper module.
Tested: Ran on quanta-q71l board and it behaved as expected.
Change-Id: I2521d9c75aec76e92d2e26dc044d01011e44d552
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/dbus/dbusactiveread.hpp b/dbus/dbusactiveread.hpp
index a9146b9..85380fb 100644
--- a/dbus/dbusactiveread.hpp
+++ b/dbus/dbusactiveread.hpp
@@ -1,13 +1,12 @@
#pragma once
#include <memory>
+#include <sdbusplus/bus.hpp>
#include <string>
-#include <sdbusplus/bus.hpp>
-
+#include "dbus/util.hpp"
#include "interfaces.hpp"
-
/*
* This ReadInterface will actively reach out over dbus upon calling read to
* get the value from whomever owns the associated dbus path.
@@ -17,11 +16,13 @@
public:
DbusActiveRead(sdbusplus::bus::bus& bus,
const std::string& path,
- const std::string& service)
+ const std::string& service,
+ DbusHelperInterface *helper)
: ReadInterface(),
_bus(bus),
_path(path),
- _service(service)
+ _service(service),
+ _helper(helper)
{ }
ReadReturn read(void) override;
@@ -30,4 +31,5 @@
sdbusplus::bus::bus& _bus;
const std::string _path;
const std::string _service; // the sensor service.
+ DbusHelperInterface *_helper;
};