Add Softshutdown and Hardshutdown threshold interface

Added threshold interfaces like Softshutdown and Hardshutdown
interfaces in dbus-sensors. This is similiar to warning and
critical threshold interfaces.

To enable this Softshutdown and Hardshutdown interfaces, need to
set the Severity level in EM config. Severity value as 2 for
Softshutdown and Severity value as 3 for Hardshutdown.

TESTED: Tested on Facebook YosemiteV2 hardware. Verified the
Hardshutdown and Softshutdown interfaces are created
and displaying in dbus objects.

Signed-off-by: Jayashree Dhanapal <jayashree-d@hcl.com>
Change-Id: Ic9a6e719a8343321f894bc031688a17a3ed7fd67
diff --git a/include/Thresholds.hpp b/include/Thresholds.hpp
index 5dcc00d..50075a2 100644
--- a/include/Thresholds.hpp
+++ b/include/Thresholds.hpp
@@ -17,6 +17,8 @@
 {
     WARNING,
     CRITICAL,
+    SOFTSHUTDOWN,
+    HARDSHUTDOWN,
     ERROR
 };
 enum class Direction
diff --git a/include/sensor.hpp b/include/sensor.hpp
index 9d01482..7021430 100644
--- a/include/sensor.hpp
+++ b/include/sensor.hpp
@@ -104,7 +104,7 @@
         const char* dirOrder;
     };
 
-    constexpr static std::array<ThresholdProperty, 4> thresProp = {
+    constexpr static std::array<ThresholdProperty, 8> thresProp = {
         {{thresholds::Level::WARNING, thresholds::Direction::HIGH, 0,
           "WarningHigh", "WarningAlarmHigh", "greater than"},
          {thresholds::Level::WARNING, thresholds::Direction::LOW, 0,
@@ -112,9 +112,17 @@
          {thresholds::Level::CRITICAL, thresholds::Direction::HIGH, 1,
           "CriticalHigh", "CriticalAlarmHigh", "greater than"},
          {thresholds::Level::CRITICAL, thresholds::Direction::LOW, 1,
-          "CriticalLow", "CriticalAlarmLow", "less than"}}};
+          "CriticalLow", "CriticalAlarmLow", "less than"},
+         {thresholds::Level::SOFTSHUTDOWN, thresholds::Direction::HIGH, 2,
+          "SoftShutdownHigh", "SoftShutdownAlarmHigh", "greater than"},
+         {thresholds::Level::SOFTSHUTDOWN, thresholds::Direction::LOW, 2,
+          "SoftShutdownLow", "SoftShutdownAlarmLow", "less than"},
+         {thresholds::Level::HARDSHUTDOWN, thresholds::Direction::HIGH, 3,
+          "HardShutdownHigh", "HardShutdownAlarmHigh", "greater than"},
+         {thresholds::Level::HARDSHUTDOWN, thresholds::Direction::LOW, 3,
+          "HardShutdownLow", "HardShutdownAlarmLow", "less than"}}};
 
-    std::array<std::shared_ptr<sdbusplus::asio::dbus_interface>, 2>
+    std::array<std::shared_ptr<sdbusplus::asio::dbus_interface>, 4>
         thresholdInterfaces;
 
     std::shared_ptr<sdbusplus::asio::dbus_interface>
diff --git a/src/Thresholds.cpp b/src/Thresholds.cpp
index bc6bb84..e186acb 100644
--- a/src/Thresholds.cpp
+++ b/src/Thresholds.cpp
@@ -17,7 +17,6 @@
 #include <vector>
 
 static constexpr bool debug = false;
-static constexpr int thresLevel = 2;
 namespace thresholds
 {
 Level findThresholdLevel(uint8_t sev, const std::string& direct)
@@ -127,8 +126,7 @@
         Level level = findThresholdLevel(severity, directions);
         Direction direction = findThresholdDirection(severity, directions);
 
-        if ((static_cast<int>(level) == thresLevel) ||
-            (static_cast<int>(direction) == thresLevel))
+        if ((level == Level::ERROR) || (direction == Direction::ERROR))
         {
             continue;
         }
@@ -564,6 +562,12 @@
         case Level::CRITICAL:
             level = "Critical";
             break;
+        case Level::SOFTSHUTDOWN:
+            level = "SoftShutDown";
+            break;
+        case Level::HARDSHUTDOWN:
+            level = "HardShutdown";
+            break;
         case Level::ERROR:
             level = "Error";
             break;