button-handler: Add reset button actions
Creates a signal handler for the 'Released' signal.
This will reboot the host if it is powered on. If the
system is off, it won't do anything.
As with the other buttons, it only installs the watch if
the button object exists.
Tested: Used the 'simPress' method on the reset object
to trigger the signal.
Change-Id: I4102cd8c260d07afb018b2c186e78a768e642a18
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/inc/button_handler.hpp b/inc/button_handler.hpp
index 790bbe9..0964aad 100644
--- a/inc/button_handler.hpp
+++ b/inc/button_handler.hpp
@@ -58,6 +58,15 @@
void longPowerPressed(sdbusplus::message::message& msg);
/**
+ * @brief The handler for a reset button press
+ *
+ * Reboots the host if it is powered on.
+ *
+ * @param[in] msg - sdbusplus message from signal
+ */
+ void resetPressed(sdbusplus::message::message& msg);
+
+ /**
* @brief Checks if system is powered on
*
* @return true if powered on, false else
@@ -90,6 +99,11 @@
* @brief Matches on the power button long press released signal
*/
std::unique_ptr<sdbusplus::bus::match_t> powerButtonLongPressReleased;
+
+ /**
+ * @brief Matches on the reset button released signal
+ */
+ std::unique_ptr<sdbusplus::bus::match_t> resetButtonReleased;
};
} // namespace button