mainloop: Make HwmonIO injectable dependency
HwmonIO was make into a interface object implementation. This patch
transitions mainloop to receive a pointer to this interface to allow for
injection testing.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Iaa470fafccb42c4d7fbabac0dc92f96c8075faf2
diff --git a/mainloop.hpp b/mainloop.hpp
index a50020d..07128b5 100644
--- a/mainloop.hpp
+++ b/mainloop.hpp
@@ -53,7 +53,8 @@
*/
MainLoop(sdbusplus::bus::bus&& bus, const std::string& param,
const std::string& path, const std::string& devPath,
- const char* prefix, const char* root);
+ const char* prefix, const char* root,
+ const hwmonio::HwmonIOInterface* ioIntf);
/** @brief Setup polling timer in a sd event loop and attach to D-Bus
* event loop.
@@ -106,7 +107,7 @@
/** @brief Sleep interval in microseconds. */
uint64_t _interval = default_interval;
/** @brief Hwmon sysfs access. */
- hwmonio::HwmonIO _ioAccess;
+ const hwmonio::HwmonIOInterface* _ioAccess;
/** @brief the Event Loop structure */
sdeventplus::Event _event;
/** @brief Read Timer */