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 = "/"; |
| 14 | constexpr auto timeOwnerIntf = "xyz.openbmc_project.Time.Owner"; |
| 15 | constexpr auto timeSyncIntf = "xyz.openbmc_project.Time.Synchronization"; |
Lei YU | debe1d8 | 2017-10-13 13:21:37 +0800 | [diff] [blame] | 16 | constexpr auto hostStateIntf = "xyz.openbmc_project.State.Host"; |
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 17 | |
| 18 | /** @class Objects |
| 19 | * @brief Fetch paths of settings D-bus objects of interest upon construction |
| 20 | */ |
| 21 | struct Objects |
| 22 | { |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame] | 23 | public: |
| 24 | /** @brief Constructor - fetch settings objects |
| 25 | * |
| 26 | * @param[in] bus - The D-bus bus object |
| 27 | */ |
Brad Bishop | 4e84539 | 2018-12-18 18:13:12 -0500 | [diff] [blame] | 28 | Objects() = delete; |
| 29 | explicit Objects(sdbusplus::bus::bus&); |
| 30 | Objects(const Objects&) = delete; |
| 31 | Objects& operator=(const Objects&) = delete; |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame] | 32 | Objects(Objects&&) = default; |
| 33 | Objects& operator=(Objects&&) = default; |
| 34 | ~Objects() = default; |
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 35 | |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame] | 36 | /** @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 Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 46 | |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame] | 47 | /** @brief time owner settings object */ |
| 48 | Path timeOwner; |
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 49 | |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame] | 50 | /** @brief time sync method settings object */ |
| 51 | Path timeSyncMethod; |
Lei YU | debe1d8 | 2017-10-13 13:21:37 +0800 | [diff] [blame] | 52 | |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame] | 53 | /** @brief host state object */ |
| 54 | Path hostState; |
Brad Bishop | 4e84539 | 2018-12-18 18:13:12 -0500 | [diff] [blame] | 55 | |
| 56 | private: |
| 57 | sdbusplus::bus::bus& bus; |
Deepak Kodihalli | 20ed79e | 2017-07-25 05:48:58 -0500 | [diff] [blame] | 58 | }; |
| 59 | |
| 60 | } // namespace settings |