summaryrefslogtreecommitdiffstats
path: root/manager.hpp
diff options
context:
space:
mode:
authorLei YU <mine260309@gmail.com>2017-08-01 17:10:17 +0800
committerLei YU <mine260309@gmail.com>2017-10-16 20:41:01 +0800
commit710d49be2fc33f22e8f4a7ed43774fd9293d083f (patch)
tree7f12eab17509e59546fb5825adb4d36cc6cfd866 /manager.hpp
parentad14354fc17811ae585f13b1d52a275cf3daff35 (diff)
downloadphosphor-time-manager-710d49be2fc33f22e8f4a7ed43774fd9293d083f.tar.gz
phosphor-time-manager-710d49be2fc33f22e8f4a7ed43774fd9293d083f.zip
Use new settings API
The new time manager code was using the old settings daemon. Now it uses the new settings API. Change-Id: Id551d97c28a6cfbb81c87118b26292b1b5574e93 Signed-off-by: Lei YU <mine260309@gmail.com>
Diffstat (limited to 'manager.hpp')
-rw-r--r--manager.hpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/manager.hpp b/manager.hpp
index 9b135d9..dc0885e 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -2,6 +2,7 @@
#include "types.hpp"
#include "property_change_listener.hpp"
+#include "settings.hpp"
#include <sdbusplus/bus.hpp>
#include <sdbusplus/bus/match.hpp>
@@ -30,6 +31,7 @@ class Manager
Manager& operator=(const Manager&) = delete;
Manager(Manager&&) = delete;
Manager& operator=(Manager&&) = delete;
+ ~Manager() = default;
/** @brief Add a listener that will be called
* when property is changed
@@ -41,14 +43,22 @@ class Manager
sdbusplus::bus::bus& bus;
/** @brief The match of settings property change */
+ // TODO: This is to be removed when all properties are handled in
+ // new settings daemon
sdbusplus::bus::match::match propertyChangeMatch;
+ /** @brief The match of settings property change */
+ std::vector<sdbusplus::bus::match::match> settingsMatches;
+
/** @brief The match of pgood change */
sdbusplus::bus::match::match pgoodChangeMatch;
/** @brief The container to hold all the listeners */
std::set<PropertyChangeListner*> listeners;
+ /** @brief Settings objects of intereset */
+ settings::Objects settings;
+
/** @brief The value to indicate if host is on */
bool hostOn = false;
@@ -81,6 +91,18 @@ class Manager
*/
std::string getSettings(const char* setting) const;
+ /** @brief Get setting from settingsd service
+ *
+ * @param[in] path - The dbus object path
+ * @param[in] interface - The dbus interface
+ * @param[in] setting - The string of the setting
+ *
+ * @return The setting value in string
+ */
+ std::string getSetting(const char* path,
+ const char* interface,
+ const char* setting) const;
+
/** @brief Set current time mode from the time mode string
*
* @param[in] mode - The string of time mode
@@ -113,6 +135,14 @@ class Manager
*/
void onTimeOwnerChanged();
+ /** @brief Callback to handle change in a setting
+ *
+ * @param[in] msg - sdbusplus dbusmessage
+ *
+ * @return 0 on success, < 0 on failure.
+ */
+ int onSettingsChanged(sdbusplus::message::message& msg);
+
/** @brief Notified on settings property changed
*
* @param[in] key - The name of property that is changed
@@ -182,10 +212,10 @@ class Manager
sd_bus_error* retError);
/** @brief The string of time mode property */
- static constexpr auto PROPERTY_TIME_MODE = "time_mode";
+ static constexpr auto PROPERTY_TIME_MODE = "TimeSyncMethod";
/** @brief The string of time owner property */
- static constexpr auto PROPERTY_TIME_OWNER = "time_owner";
+ static constexpr auto PROPERTY_TIME_OWNER = "TimeOwner";
/** @brief The string of use dhcp ntp property */
static constexpr auto PROPERTY_DHCP_NTP = "use_dhcp_ntp";
OpenPOWER on IntegriCloud