blob: b4893cbe3e15faca653533f78b27f4c30034469f [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 = "/";
14constexpr auto timeOwnerIntf = "xyz.openbmc_project.Time.Owner";
15constexpr auto timeSyncIntf = "xyz.openbmc_project.Time.Synchronization";
Lei YUdebe1d82017-10-13 13:21:37 +080016constexpr auto hostStateIntf = "xyz.openbmc_project.State.Host";
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -050017
18/** @class Objects
19 * @brief Fetch paths of settings D-bus objects of interest upon construction
20 */
21struct Objects
22{
Gunnar Millsab4cc6a2018-09-14 14:42:39 -050023 public:
24 /** @brief Constructor - fetch settings objects
25 *
26 * @param[in] bus - The D-bus bus object
27 */
Brad Bishop4e845392018-12-18 18:13:12 -050028 Objects() = delete;
29 explicit Objects(sdbusplus::bus::bus&);
30 Objects(const Objects&) = delete;
31 Objects& operator=(const Objects&) = delete;
Gunnar Millsab4cc6a2018-09-14 14:42:39 -050032 Objects(Objects&&) = default;
33 Objects& operator=(Objects&&) = default;
34 ~Objects() = default;
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -050035
Gunnar Millsab4cc6a2018-09-14 14:42:39 -050036 /** @brief Fetch D-bus service, given a path and an interface. The
37 * service can't be cached because mapper returns unique
38 * service names.
39 *
40 * @param[in] path - The D-bus object
41 * @param[in] interface - The D-bus interface
42 *
43 * @return std::string - the D-bus service
44 */
45 Service service(const Path& path, const Interface& interface) const;
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -050046
Gunnar Millsab4cc6a2018-09-14 14:42:39 -050047 /** @brief time owner settings object */
48 Path timeOwner;
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -050049
Gunnar Millsab4cc6a2018-09-14 14:42:39 -050050 /** @brief time sync method settings object */
51 Path timeSyncMethod;
Lei YUdebe1d82017-10-13 13:21:37 +080052
Gunnar Millsab4cc6a2018-09-14 14:42:39 -050053 /** @brief host state object */
54 Path hostState;
Brad Bishop4e845392018-12-18 18:13:12 -050055
56 private:
57 sdbusplus::bus::bus& bus;
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -050058};
59
60} // namespace settings