blob: 12209c0b313f75d45652ff7789d1f091af0263cd [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";
Lei YUdebe1d82017-10-13 13:21:37 +080015constexpr auto hostStateIntf = "xyz.openbmc_project.State.Host";
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -050016
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
Gunnar Millsab4cc6a2018-09-14 14:42:39 -050049 /** @brief host state object */
50 Path hostState;
Brad Bishop4e845392018-12-18 18:13:12 -050051
52 private:
53 sdbusplus::bus::bus& bus;
Deepak Kodihalli20ed79e2017-07-25 05:48:58 -050054};
55
56} // namespace settings