Deepak Kodihalli | a646edd | 2017-07-25 07:28:45 -0500 | [diff] [blame^] | 1 | #pragma once |
| 2 | |
| 3 | #include <string> |
| 4 | #include <sdbusplus/bus.hpp> |
| 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 autoRebootIntf = |
| 15 | "xyz.openbmc_project.Control.Boot.RebootPolicy"; |
| 16 | constexpr auto powerRestoreIntf = |
| 17 | "xyz.openbmc_project.Control.Power.RestorePolicy"; |
| 18 | |
| 19 | /** @class Objects |
| 20 | * @brief Fetch paths of settings d-bus objects of interest, upon construction |
| 21 | */ |
| 22 | struct Objects |
| 23 | { |
| 24 | public: |
| 25 | /** @brief Constructor - fetch settings objects |
| 26 | * |
| 27 | * @param[in] bus - The Dbus bus object |
| 28 | */ |
| 29 | Objects(sdbusplus::bus::bus& bus); |
| 30 | Objects(const Objects&) = delete; |
| 31 | Objects& operator=(const Objects&) = delete; |
| 32 | Objects(Objects&&) = delete; |
| 33 | Objects& operator=(Objects&&) = delete; |
| 34 | ~Objects() = default; |
| 35 | |
| 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 Dbus object |
| 41 | * @param[in] interface - The Dbus interface |
| 42 | * |
| 43 | * @return std::string - the dbus service name |
| 44 | */ |
| 45 | Service service(const Path& path, const Interface& interface) const; |
| 46 | |
| 47 | /** @brief host auto_reboot settings object */ |
| 48 | Path autoReboot; |
| 49 | |
| 50 | /** @brief host power_restore_policy settings object */ |
| 51 | Path powerRestorePolicy; |
| 52 | |
| 53 | /** @brief The Dbus bus object */ |
| 54 | sdbusplus::bus::bus& bus; |
| 55 | }; |
| 56 | |
| 57 | } // namespace settings |