Monitor for power cap changes when occ-control started

The object that is monitoring for power cap changes needs to get created
when occ-control is started so that changes are not missed.
Added validation check to ensure that the value sent to the OCC matches
the user configured value on dbus.

Verified on Raininer

Change-Id: I0d77f4569e5459ff58d6fc72147153133d2104a3
Signed-off-by: Chris Cain <cjcain@us.ibm.com>
diff --git a/occ_manager.cpp b/occ_manager.cpp
index ea02cf3..78ac9f2 100644
--- a/occ_manager.cpp
+++ b/occ_manager.cpp
@@ -170,6 +170,13 @@
 #endif
             ));
 
+    // Create the power cap monitor object
+    if (!pcap)
+    {
+        pcap = std::make_unique<open_power::occ::powercap::PowerCap>(
+            *statusObjects.back());
+    }
+
     if (statusObjects.back()->isMasterOcc())
     {
         log<level::INFO>(
@@ -181,6 +188,8 @@
 #ifdef POWER10
         // Set the master OCC on the PowerMode object
         pmode->setMasterOcc(path);
+        // Update power cap bounds
+        pcap->updatePcapBounds();
 #endif
     }
 
@@ -296,6 +305,9 @@
         statusObjects.emplace_back(
             std::make_unique<Status>(event, path.c_str(), *this));
     }
+    // The first device is master occ
+    pcap = std::make_unique<open_power::occ::powercap::PowerCap>(
+        *statusObjects.front());
 #ifdef POWER10
     pmode = std::make_unique<powermode::PowerMode>(*this, powermode::PMODE_PATH,
                                                    powermode::PIPS_PATH);
@@ -1040,5 +1052,13 @@
     }
 }
 
+void Manager::updatePcapBounds() const
+{
+    if (pcap)
+    {
+        pcap->updatePcapBounds();
+    }
+}
+
 } // namespace occ
 } // namespace open_power