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