Add thermal control interface to zone objects

When in control mode, the thermal control interface and mode property
are added to each zone object. The object path for each zone consists of
the configured object path plus the zone number.
Ex) /xyz/openbmc_project/control/thermal/0

Tested:
    After fan control is started in control mode, dbus interface exists

Change-Id: I88578a7e0eb7c730ffaa4cfc10989e280dc1d46d
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/manager.cpp b/control/manager.cpp
index c99f4a3..360239c 100644
--- a/control/manager.cpp
+++ b/control/manager.cpp
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 #include <algorithm>
+#include <experimental/filesystem>
+#include <sdbusplus/bus.hpp>
 #include <phosphor-logging/log.hpp>
 #include <phosphor-logging/elog.hpp>
 #include <phosphor-logging/elog-errors.hpp>
@@ -32,6 +34,7 @@
 {
 
 using namespace phosphor::logging;
+namespace fs = std::experimental::filesystem;
 
 constexpr auto SYSTEMD_SERVICE   = "org.freedesktop.systemd1";
 constexpr auto SYSTEMD_OBJ_PATH  = "/org/freedesktop/systemd1";
@@ -78,7 +81,8 @@
 Manager::Manager(sdbusplus::bus::bus& bus,
                  const sdeventplus::Event& event,
                  Mode mode) :
-    _bus(bus)
+    _bus(bus),
+    _objMgr(bus, CONTROL_OBJPATH)
 {
     //Create the appropriate Zone objects based on the
     //actual system configuration.
@@ -99,15 +103,24 @@
 
             for (auto& z : zones)
             {
+                fs::path path{CONTROL_OBJPATH};
+                path /= std::to_string(std::get<zoneNumPos>(z));
                 _zones.emplace(std::get<zoneNumPos>(z),
-                               std::make_unique<Zone>(mode, _bus, event, z));
+                               std::make_unique<Zone>(mode,
+                                                      _bus,
+                                                      path.string(),
+                                                      event,
+                                                      z));
             }
 
             break;
         }
     }
 
-    bus.request_name(CONTROL_BUSNAME);
+    if (mode == Mode::control)
+    {
+        bus.request_name(CONTROL_BUSNAME);
+    }
 }