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_speed.hpp b/fan_speed.hpp
index fb97303..9b4ad63 100644
--- a/fan_speed.hpp
+++ b/fan_speed.hpp
@@ -1,5 +1,7 @@
 #pragma once
 
+#include <memory>
+
 #include "hwmonio.hpp"
 #include "interface.hpp"
 #include "sysfs.hpp"
@@ -20,8 +22,7 @@
         /**
          * @brief Constructs FanSpeed Object
          *
-         * @param[in] instancePath - The hwmon instance path
-         *     (ex. /sys/class/hwmon/hwmon1)
+         * @param[in] io -  HwmonIO(instance path) (ex /sys/class/hwmon/hwmon1)
          * @param[in] devPath - The /sys/devices sysfs path
          * @param[in] id - The hwmon id
          * @param[in] bus - Dbus bus object
@@ -29,7 +30,7 @@
          * @param[in] defer - Dbus object registration defer
          * @param[in] target - initial target speed value
          */
-        FanSpeed(const std::string& instancePath,
+        FanSpeed(std::unique_ptr<hwmonio::HwmonIOInterface> io,
                  const std::string& devPath,
                  const std::string& id,
                  sdbusplus::bus::bus& bus,
@@ -37,7 +38,7 @@
                  bool defer,
                  uint64_t target) : FanSpeedObject(bus, objPath, defer),
                     id(id),
-                    ioAccess(instancePath),
+                    ioAccess(std::move(io)),
                     devPath(devPath)
         {
             FanSpeedObject::target(target);
@@ -62,7 +63,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;