Add discovery of initial state
Added the method discoverInitialState that will be
used to determine if the obmc-standby.target is
either active or inactive. This catches the race
condition that could happen if just our app was
restarted and the signal had already been given
and we had missed it.
Change-Id: Iadcdcbd2d1045fa62491e9af6e2402d4b17c4a60
Signed-off-by: Josh D. King <jdking@us.ibm.com>
diff --git a/bmc_state_manager.hpp b/bmc_state_manager.hpp
index bbace38..0e52a25 100644
--- a/bmc_state_manager.hpp
+++ b/bmc_state_manager.hpp
@@ -29,7 +29,7 @@
const char* objPath) :
sdbusplus::server::object::object<
sdbusplus::xyz::openbmc_project::State::server::BMC>(
- bus, objPath),
+ bus, objPath, true),
bus(bus),
stateSignal(
std::make_unique<
@@ -43,6 +43,8 @@
this))
{
subscribeToSystemdSignals();
+ discoverInitialState();
+ this->emit_object_added();
};
/** @brief Set value of BMCTransition **/
@@ -53,6 +55,11 @@
private:
/**
+ * @brief discover the state of the bmc
+ **/
+ void discoverInitialState();
+
+ /**
* @brief subscribe to the systemd signals
**/
void subscribeToSystemdSignals();