blob: 5042c9e28a6f20cfa049d827b552fa37aeffdf7b [file] [log] [blame]
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -05001#pragma once
2
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -05003#include <sdbusplus/bus.hpp>
George Liuc6d33972020-06-22 10:35:29 +08004
Gunnar Millsab4cc6a2018-09-14 14:42:39 -05005#include <string>
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -05006
7namespace settings
8{
9
10using Path = std::string;
11using Service = std::string;
12using Interface = std::string;
13
14constexpr auto root = "/";
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -050015constexpr auto timeSyncIntf = "xyz.openbmc_project.Time.Synchronization";
16
17/** @class Objects
18 * @brief Fetch paths of settings D-bus objects of interest upon construction
19 */
20struct Objects
21{
Gunnar Millsab4cc6a2018-09-14 14:42:39 -050022 public:
23 /** @brief Constructor - fetch settings objects
24 *
25 * @param[in] bus - The D-bus bus object
26 */
Brad Bishop4e845392018-12-18 18:13:12 -050027 Objects() = delete;
Patrick Williams38679262022-07-22 19:26:55 -050028 explicit Objects(sdbusplus::bus_t&);
Brad Bishop4e845392018-12-18 18:13:12 -050029 Objects(const Objects&) = delete;
30 Objects& operator=(const Objects&) = delete;
Gunnar Millsab4cc6a2018-09-14 14:42:39 -050031 Objects(Objects&&) = default;
32 Objects& operator=(Objects&&) = default;
33 ~Objects() = default;
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -050034
Gunnar Millsab4cc6a2018-09-14 14:42:39 -050035 /** @brief Fetch D-bus service, given a path and an interface. The
36 * service can't be cached because mapper returns unique
37 * service names.
38 *
39 * @param[in] path - The D-bus object
40 * @param[in] interface - The D-bus interface
41 *
42 * @return std::string - the D-bus service
43 */
44 Service service(const Path& path, const Interface& interface) const;
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -050045
Gunnar Millsab4cc6a2018-09-14 14:42:39 -050046 /** @brief time sync method settings object */
47 Path timeSyncMethod;
Lei YUdebe1d82017-10-13 13:21:37 +080048
Brad Bishop4e845392018-12-18 18:13:12 -050049 private:
Patrick Williams38679262022-07-22 19:26:55 -050050 sdbusplus::bus_t& bus;
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -050051};
52
53} // namespace settings