sensor:monitor: Use a single PowerState object

Now that both monitor classes need to know about power state, change
them to keep a shared_ptr to a PowerState object and then pass the
object into their constructors.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Ia83217e8af51204bbb3fc6e8e3f2eac5912b5913
diff --git a/sensor-monitor/main.cpp b/sensor-monitor/main.cpp
index 9b901f5..8f1cc56 100644
--- a/sensor-monitor/main.cpp
+++ b/sensor-monitor/main.cpp
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#include "power_state.hpp"
 #include "shutdown_alarm_monitor.hpp"
 #include "threshold_alarm_logger.hpp"
 
@@ -27,9 +28,12 @@
     auto bus = sdbusplus::bus::new_default();
     bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
 
-    ShutdownAlarmMonitor shutdownMonitor{bus, event};
+    std::shared_ptr<phosphor::fan::PowerState> powerState =
+        std::make_shared<phosphor::fan::PGoodState>();
 
-    ThresholdAlarmLogger logger{bus, event};
+    ShutdownAlarmMonitor shutdownMonitor{bus, event, powerState};
+
+    ThresholdAlarmLogger logger{bus, event, powerState};
 
     return event.loop();
 }