Create a FanSpeedObject interface

Create the FanSpeedObject target interface when the fanx_target sysfs
file exists. The "xyz.openbmc_project.Control.Target" interface is on
the /xyz/openbmc_project/sensors/fan_tac/fan[#] object paths.

Change-Id: Ib4a099cff17cacea501b474969f292516db212b5
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/mainloop.cpp b/mainloop.cpp
index 399b17e..7af3096 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -24,6 +24,7 @@
 #include "mainloop.hpp"
 #include "env.hpp"
 #include "thresholds.hpp"
+#include "targets.hpp"
 
 // Initialization for Warning Objects
 decltype(Thresholds<WarningObject>::setLo) Thresholds<WarningObject>::setLo =
@@ -53,6 +54,12 @@
 decltype(Thresholds<CriticalObject>::alarmHi) Thresholds<CriticalObject>::alarmHi =
     &CriticalObject::criticalAlarmHigh;
 
+// Initialization for Target objects
+decltype(Targets<FanSpeedObject>::setTarget)
+    Targets<FanSpeedObject>::setTarget = &FanSpeedObject::target;
+decltype(Targets<FanSpeedObject>::getTarget)
+    Targets<FanSpeedObject>::getTarget = &FanSpeedObject::target;
+
 
 using namespace std::literals::chrono_literals;
 
@@ -238,6 +245,9 @@
         auto sensorValue = valueInterface->value();
         addThreshold<WarningObject>(i.first, sensorValue, info);
         addThreshold<CriticalObject>(i.first, sensorValue, info);
+        //TODO openbmc/openbmc#1347
+        //     Handle application restarts to set/refresh fan speed values
+        addTarget<FanSpeedObject>(i.first, _hwmonRoot, _instance, info);
 
         // All the interfaces have been created.  Go ahead
         // and emit InterfacesAdded.