move systemd subscribe to util function
This code is replicated in multiple source files in this repo, put it in
the util repo so everyone can call it in one place.
Tested:
- Verified systemd signals seen and system boots
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: I8bf0343c79012cc91dea033038894a011fd37ef5
diff --git a/bmc_state_manager.hpp b/bmc_state_manager.hpp
index 29e318f..a52d184 100644
--- a/bmc_state_manager.hpp
+++ b/bmc_state_manager.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include "utils.hpp"
#include "xyz/openbmc_project/State/BMC/server.hpp"
#include <linux/watchdog.h>
@@ -40,7 +41,7 @@
sdbusRule::interface("org.freedesktop.systemd1.Manager"),
[this](sdbusplus::message_t& m) { bmcStateChange(m); }))
{
- subscribeToSystemdSignals();
+ utils::subscribeToSystemdSignals(bus);
discoverInitialState();
discoverLastRebootCause();
this->emit_object_added();
@@ -75,11 +76,6 @@
**/
void discoverInitialState();
- /**
- * @brief subscribe to the systemd signals
- **/
- void subscribeToSystemdSignals();
-
/** @brief Execute the transition request
*
* @param[in] tranReq - Transition requested