sensor: to enable testing receive hwmonio interface pointer

The sensor objects all share a reference to the mainloop's ioAccess
object.  To enable testing, the sensor object needs to expect the base
pointer to this object.

Change-Id: I1d7f2841528776c8d4f1166e20874ddeb4b8554a
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/sensor.cpp b/sensor.cpp
index 5c97e0c..2a2148c 100644
--- a/sensor.cpp
+++ b/sensor.cpp
@@ -36,7 +36,8 @@
 
 // todo: this can be simplified once we move to the double interface
 Sensor::Sensor(const SensorSet::key_type& sensor,
-               const hwmonio::HwmonIO& ioAccess, const std::string& devPath) :
+               const hwmonio::HwmonIOInterface* ioAccess,
+               const std::string& devPath) :
     sensor(sensor),
     ioAccess(ioAccess), devPath(devPath)
 {
@@ -148,9 +149,9 @@
 
         // Retry for up to a second if device is busy
         // or has a transient error.
-        val = ioAccess.read(sensor.first, sensor.second, hwmon::entry::cinput,
-                            std::get<size_t>(retryIO),
-                            std::get<std::chrono::milliseconds>(retryIO));
+        val = ioAccess->read(sensor.first, sensor.second, hwmon::entry::cinput,
+                             std::get<size_t>(retryIO),
+                             std::get<std::chrono::milliseconds>(retryIO));
 
         lockGpio();
         val = adjustValue(val);
@@ -199,14 +200,14 @@
     std::string entry = hwmon::entry::fault;
 
     auto sysfsFullPath =
-        sysfs::make_sysfs_path(ioAccess.path(), faultName, faultID, entry);
+        sysfs::make_sysfs_path(ioAccess->path(), faultName, faultID, entry);
     if (fs::exists(sysfsFullPath))
     {
         bool functional = true;
         try
         {
-            uint32_t fault = ioAccess.read(faultName, faultID, entry,
-                                           hwmonio::retries, hwmonio::delay);
+            uint32_t fault = ioAccess->read(faultName, faultID, entry,
+                                            hwmonio::retries, hwmonio::delay);
             if (fault != 0)
             {
                 functional = false;