hwmonio:: Add Interface base class and tests

Enable injecting hwmonio::HwmonIO mocks for testing.

Tested: Ran on quanta-q71l and saw all sensors exported to dbus as
expected with the expected values.

Change-Id: I35912bf2a733932d9e1e774ff53b0114ae16560b
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/fan_pwm.hpp b/fan_pwm.hpp
index 20baf38..61c0bf6 100644
--- a/fan_pwm.hpp
+++ b/fan_pwm.hpp
@@ -1,5 +1,7 @@
 #pragma once
 
+#include <memory>
+
 #include "hwmonio.hpp"
 #include "interface.hpp"
 #include "sysfs.hpp"
@@ -20,15 +22,14 @@
         /**
          * @brief Constructs FanPwm Object
          *
-         * @param[in] instancePath - The hwmon instance path
-         *     (ex. /sys/class/hwmon/hwmon1)
+         * @param[in] io - HwmonIO
          * @param[in] devPath - The /sys/devices sysfs path
          * @param[in] id - The hwmon id
          * @param[in] bus - Dbus bus object
          * @param[in] objPath - Dbus object path
          * @param[in] defer - Dbus object registration defer
          */
-    FanPwm(const std::string& instancePath,
+    FanPwm(std::unique_ptr<hwmonio::HwmonIOInterface> io,
            const std::string& devPath,
            const std::string& id,
            sdbusplus::bus::bus& bus,
@@ -36,7 +37,7 @@
            bool defer,
            uint64_t target) : FanPwmObject(bus, objPath, defer),
                 id(id),
-                ioAccess(instancePath),
+                ioAccess(std::move(io)),
                 devPath(devPath)
         {
             FanPwmObject::target(target);
@@ -55,7 +56,7 @@
         /** @brief hwmon id */
         std::string id;
         /** @brief Hwmon sysfs access. */
-        hwmonio::HwmonIO ioAccess;
+        std::unique_ptr<hwmonio::HwmonIOInterface> ioAccess;
         /** @brief Physical device path. */
         std::string devPath;
 };