Switch to using new settings API

Change-Id: I0b0a9a70fcd8f1eb0f366bb2daf3d1fe77f3d648
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/time-config.hpp b/time-config.hpp
index 2d55b4b..257ab30 100644
--- a/time-config.hpp
+++ b/time-config.hpp
@@ -1,5 +1,6 @@
 #include <map>
 #include <systemd/sd-bus.h>
+#include <sdbusplus/bus/match.hpp>
 #include "settings.hpp"
 
 /** @class TimeConfig
@@ -194,6 +195,14 @@
     // Most of this is statically constructed and PGOOD is added later.
     static std::map<std::string, FUNCTOR> iv_TimeParams;
 
+    /** @brief Callback to handle change in a setting
+     *
+     *  @param[in] msg - sdbusplus dbusmessage
+     *
+     *  @return 0 on success, < 0 on failure.
+     */
+    int settingsChanged(sdbusplus::message::message& msg);
+
 private:
     // Bus initialised by manager on a call to process initial settings
     sd_bus *iv_dbus;
@@ -228,6 +237,9 @@
     /** @brief Settings objects of intereset */
     settings::Objects settings;
 
+    /** @brief sbdbusplus match objects */
+    std::vector<sdbusplus::bus::match_t> settingsMatches;
+
     static constexpr auto cv_TimeModeFile = "/var/lib/obmc/saved_timeMode";
     static constexpr auto cv_TimeOwnerFile = "/var/lib/obmc/saved_timeOwner";
     static constexpr auto cv_DhcpNtpFile = "/var/lib/obmc/saved_dhcpNtp";
@@ -273,6 +285,22 @@
      */
     std::string getSystemSettings(const char* key);
 
+    /** @brief Returns the time owner setting
+     *
+     *  @param[in] path - Time owner setting object path
+     *
+     *  @return        - Value as string
+     */
+    std::string getTimeOwnerSetting(const char* path);
+
+    /** @brief Returns the time sync method setting
+     *
+     *  @param[in] path - Time sync method setting object path
+     *
+     *  @return        - Value as string
+     */
+    std::string getTimeSyncMethodSetting(const char* path);
+
     /** @brief Reads the data hosted by /org/openbmc/control/power0
      *
      *  @param[in] key - Name of the property