Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 3 | #include <sdbusplus/bus.hpp> |
George Liu | c6d3397 | 2020-06-22 10:35:29 +0800 | [diff] [blame] | 4 | |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame] | 5 | #include <string> |
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 6 | |
| 7 | namespace settings |
| 8 | { |
| 9 | |
| 10 | using Path = std::string; |
| 11 | using Service = std::string; |
| 12 | using Interface = std::string; |
| 13 | |
| 14 | constexpr auto root = "/"; |
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 15 | constexpr 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 | */ |
| 20 | struct Objects |
| 21 | { |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame] | 22 | public: |
| 23 | /** @brief Constructor - fetch settings objects |
| 24 | * |
| 25 | * @param[in] bus - The D-bus bus object |
| 26 | */ |
Brad Bishop | 4e84539 | 2018-12-18 18:13:12 -0500 | [diff] [blame] | 27 | Objects() = delete; |
Patrick Williams | 3867926 | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 28 | explicit Objects(sdbusplus::bus_t&); |
Brad Bishop | 4e84539 | 2018-12-18 18:13:12 -0500 | [diff] [blame] | 29 | Objects(const Objects&) = delete; |
| 30 | Objects& operator=(const Objects&) = delete; |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame] | 31 | Objects(Objects&&) = default; |
| 32 | Objects& operator=(Objects&&) = default; |
| 33 | ~Objects() = default; |
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 34 | |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame] | 35 | /** @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 Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 45 | |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame] | 46 | /** @brief time sync method settings object */ |
| 47 | Path timeSyncMethod; |
Lei YU | debe1d8 | 2017-10-13 13:21:37 +0800 | [diff] [blame] | 48 | |
Brad Bishop | 4e84539 | 2018-12-18 18:13:12 -0500 | [diff] [blame] | 49 | private: |
Patrick Williams | 3867926 | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 50 | sdbusplus::bus_t& bus; |
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | } // namespace settings |