Add power_state implementation

Added power_state implementation for multi host platform
specific shutdown interfaces like hard shutdown or soft
shutdown interfaces.

Getting the current host state of all the hosts and set
power_state values based on the hosts current host state.

TESTED : Verified the Shutdown alarms trigged and platform
specific actions done in Facebook YosemiteV2 platform.

Signed-off-by: Kumar Thangavel <thangavel.k@hcl.com>
Change-Id: I5e38bb9f28b7840c9de10082905b31deb8ffc4ff
diff --git a/sensor-monitor/Makefile.am b/sensor-monitor/Makefile.am
index 313c59f..16333ab 100644
--- a/sensor-monitor/Makefile.am
+++ b/sensor-monitor/Makefile.am
@@ -26,3 +26,8 @@
 	$(PHOSPHOR_LOGGING_CFLAGS) \
 	${PHOSPHOR_DBUS_INTERFACES_CFLAGS} \
 	-flto
+
+if HOST_STATE_ENABLED
+ENABLE_HOST_STATE = 1
+sensor_monitor_CXXFLAGS+=-DENABLE_HOST_STATE
+endif
diff --git a/sensor-monitor/main.cpp b/sensor-monitor/main.cpp
index 8f1cc56..fc9967f 100644
--- a/sensor-monitor/main.cpp
+++ b/sensor-monitor/main.cpp
@@ -28,8 +28,13 @@
     auto bus = sdbusplus::bus::new_default();
     bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
 
+#ifdef ENABLE_HOST_STATE
+    std::shared_ptr<phosphor::fan::PowerState> powerState =
+        std::make_shared<phosphor::fan::HostPowerState>();
+#else
     std::shared_ptr<phosphor::fan::PowerState> powerState =
         std::make_shared<phosphor::fan::PGoodState>();
+#endif
 
     ShutdownAlarmMonitor shutdownMonitor{bus, event, powerState};