Use time mode owner enums in dbus interface
Dbus interface defines time mode owners in xyz::openbmc_project::Time.
Use the enums from the interface instead of repo defined enums and use
the generated code to do convertions between strings and enums.
Update unit tests accordingly.
Change-Id: Ic304aa3b4137375d208bb1702e0f64df512fc5a0
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/utils.hpp b/utils.hpp
index 87bc2bf..5d72155 100644
--- a/utils.hpp
+++ b/utils.hpp
@@ -108,7 +108,9 @@
/** @brief Convert a string to enum Mode
*
* Convert the time mode string to enum.
- * Valid strings are "NTP", "MANUAL"
+ * Valid strings are
+ * "xyz.openbmc_project.Time.Synchronization.Method.NTP"
+ * "xyz.openbmc_project.Time.Synchronization.Method.Manual"
* If it's not a valid time mode string, it means something
* goes wrong so raise exception.
*
@@ -121,7 +123,11 @@
/** @brief Convert a string to enum Owner
*
* Convert the time owner string to enum.
- * Valid strings are "BMC", "HOST", "SPLIT", "BOTH"
+ * Valid strings are
+ * "xyz.openbmc_project.Time.Owner.Owners.BMC"
+ * "xyz.openbmc_project.Time.Owner.Owners.Host"
+ * "xyz.openbmc_project.Time.Owner.Owners.Both"
+ * "xyz.openbmc_project.Time.Owner.Owners.Split"
* If it's not a valid time owner string, it means something
* goes wrong so raise exception.
*
@@ -137,7 +143,7 @@
*
* @return The string of the mode
*/
-const char* modeToStr(Mode mode);
+std::string modeToStr(Mode mode);
/** @brief Convert a owner enum to owner string
*
@@ -145,7 +151,7 @@
*
* @return The string of the owner
*/
-const char* ownerToStr(Owner owner);
+std::string ownerToStr(Owner owner);
} // namespace utils
} // namespace time