blob: b547339a216ecd5556a400381d53e835f6d17eda [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>
Gunnar Millsab4cc6a2018-09-14 14:42:39 -05004#include <string>
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -05005
6namespace settings
7{
8
9using Path = std::string;
10using Service = std::string;
11using Interface = std::string;
12
13constexpr auto root = "/";
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -050014constexpr auto timeSyncIntf = "xyz.openbmc_project.Time.Synchronization";
15
16/** @class Objects
17 * @brief Fetch paths of settings D-bus objects of interest upon construction
18 */
19struct Objects
20{
Gunnar Millsab4cc6a2018-09-14 14:42:39 -050021 public:
22 /** @brief Constructor - fetch settings objects
23 *
24 * @param[in] bus - The D-bus bus object
25 */
Brad Bishop4e845392018-12-18 18:13:12 -050026 Objects() = delete;
27 explicit Objects(sdbusplus::bus::bus&);
28 Objects(const Objects&) = delete;
29 Objects& operator=(const Objects&) = delete;
Gunnar Millsab4cc6a2018-09-14 14:42:39 -050030 Objects(Objects&&) = default;
31 Objects& operator=(Objects&&) = default;
32 ~Objects() = default;
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -050033
Gunnar Millsab4cc6a2018-09-14 14:42:39 -050034 /** @brief Fetch D-bus service, given a path and an interface. The
35 * service can't be cached because mapper returns unique
36 * service names.
37 *
38 * @param[in] path - The D-bus object
39 * @param[in] interface - The D-bus interface
40 *
41 * @return std::string - the D-bus service
42 */
43 Service service(const Path& path, const Interface& interface) const;
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -050044
Gunnar Millsab4cc6a2018-09-14 14:42:39 -050045 /** @brief time sync method settings object */
46 Path timeSyncMethod;
Lei YUdebe1d82017-10-13 13:21:37 +080047
Brad Bishop4e845392018-12-18 18:13:12 -050048 private:
49 sdbusplus::bus::bus& bus;
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -050050};
51
52} // namespace settings