blob: 61eba0398c6cf5f6aaffbf73f067400de2d5d2cf [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;
28 explicit Objects(sdbusplus::bus::bus&);
29 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:
50 sdbusplus::bus::bus& bus;
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -050051};
52
53} // namespace settings