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>
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 @@
         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 @@
         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 @@
          */
         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 @@
          */
         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 @@
                                   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";