bmc-state-manager: Add support BMC Reboot Cause feature

Below is patch supporting this change.
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-dbus-interfaces/+/41359

Tested:
busctl get-property xyz.openbmc_project.State.BMC /xyz/openbmc_project/state/bmc0 xyz.openbmc_project.State.BMC LastRebootCause

When unplug/plug in BMC power cable then return as below:
s "xyz.openbmc_project.State.BMC.BMCResetCause.POR"

When executing reboot command then return as below:
s "xyz.openbmc_project.State.BMC.BMCResetCause.Watchdog"

Signed-off-by: Tim Lee <timlee660101@gmail.com>
Change-Id: I4e12f1df96cc1321beee0c4eae648d71e2d4a3b9
diff --git a/bmc_state_manager.hpp b/bmc_state_manager.hpp
index cf53795..4ea9784 100644
--- a/bmc_state_manager.hpp
+++ b/bmc_state_manager.hpp
@@ -2,6 +2,8 @@
 
 #include "xyz/openbmc_project/State/BMC/server.hpp"
 
+#include <linux/watchdog.h>
+
 #include <sdbusplus/bus.hpp>
 
 #include <functional>
@@ -43,6 +45,7 @@
     {
         subscribeToSystemdSignals();
         discoverInitialState();
+        discoverLastRebootCause();
         this->emit_object_added();
     };
 
@@ -62,6 +65,9 @@
      */
     uint64_t lastRebootTime() const override;
 
+    /** @brief Set value of LastRebootCause **/
+    RebootCause lastRebootCause(RebootCause value) override;
+
   private:
     /**
      * @brief discover the state of the bmc
@@ -94,6 +100,11 @@
 
     /** @brief Used to subscribe to dbus system state changes **/
     std::unique_ptr<sdbusplus::bus::match_t> stateSignal;
+
+    /**
+     * @brief discover the last reboot cause of the bmc
+     **/
+    void discoverLastRebootCause();
 };
 
 } // namespace manager