Add pgood signal handler.
Pgood indicate if host is on, which will be used to handle the time
mode/owner changes.
Change-Id: I7be4f7300aca3d1adc118eb3eb447c1e3734c89f
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/manager.hpp b/manager.hpp
index 65240ac..ef3315f 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -25,6 +25,10 @@
public:
friend class TestManager;
explicit Manager(sdbusplus::bus::bus& bus);
+ Manager(const Manager&) = delete;
+ Manager& operator=(const Manager&) = delete;
+ Manager(Manager&&) = delete;
+ Manager& operator=(Manager&&) = delete;
/** @brief Add a listener that will be called
* when property is changed
@@ -38,15 +42,24 @@
/** @brief The match of settings property change */
sdbusplus::bus::match::match propertyChangeMatch;
+ /** @brief The match of pgood change */
+ sdbusplus::bus::match::match pgoodChangeMatch;
+
/** @brief The container to hold all the listeners */
std::set<PropertyChangeListner*> listeners;
+ /** @brief The value to indicate if host is on */
+ bool hostOn = false;
+
/** @brief The current time mode */
Mode timeMode;
/** @brief The current time owner */
Owner timeOwner;
+ /** @brief Check if host is on and update hostOn variable */
+ void checkHostOn();
+
/** @brief Get setting from settingsd service
*
* @param[in] setting - The string of the setting
@@ -75,6 +88,12 @@
void onPropertyChanged(const std::string& key,
const std::string& value);
+ /** @brief Notified on pgood has changed
+ *
+ * @param[in] pgood - The changed pgood value
+ */
+ void onPgoodChanged(bool pgood);
+
/** @brief The static function called on settings property changed
*
* @param[in] msg - Data associated with subscribed signal
@@ -85,6 +104,16 @@
void* userData,
sd_bus_error* retError);
+ /** @brief Notified on pgood has changed
+ *
+ * @param[in] msg - Data associated with subscribed signal
+ * @param[in] userData - Pointer to this object instance
+ * @param[out] retError - Not used but required with signal API
+ */
+ static int onPgoodChanged(sd_bus_message* msg,
+ void* userData,
+ sd_bus_error* retError);
+
/** @brief Convert a string to enum Mode
*
* Convert the time mode string to enum.