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