Deepak Kodihalli | a646edd | 2017-07-25 07:28:45 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Deepak Kodihalli | a646edd | 2017-07-25 07:28:45 -0500 | [diff] [blame] | 3 | #include <sdbusplus/bus.hpp> |
| 4 | |
Andrew Geissler | e426b58 | 2020-05-28 12:40:55 -0500 | [diff] [blame] | 5 | #include <string> |
| 6 | |
Deepak Kodihalli | a646edd | 2017-07-25 07:28:45 -0500 | [diff] [blame] | 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 = "/"; |
Andrew Geissler | 58a1801 | 2018-01-19 19:36:05 -0800 | [diff] [blame] | 15 | constexpr auto autoRebootIntf = "xyz.openbmc_project.Control.Boot.RebootPolicy"; |
Deepak Kodihalli | a646edd | 2017-07-25 07:28:45 -0500 | [diff] [blame] | 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 | { |
Andrew Geissler | 58a1801 | 2018-01-19 19:36:05 -0800 | [diff] [blame] | 24 | public: |
| 25 | /** @brief Constructor - fetch settings objects |
| 26 | * |
| 27 | * @param[in] bus - The Dbus bus object |
| 28 | */ |
Andrew Geissler | 514474d | 2019-09-12 14:15:07 -0500 | [diff] [blame] | 29 | explicit Objects(sdbusplus::bus::bus& bus); |
Andrew Geissler | 58a1801 | 2018-01-19 19:36:05 -0800 | [diff] [blame] | 30 | Objects(const Objects&) = delete; |
| 31 | Objects& operator=(const Objects&) = delete; |
| 32 | Objects(Objects&&) = delete; |
| 33 | Objects& operator=(Objects&&) = delete; |
| 34 | ~Objects() = default; |
Deepak Kodihalli | a646edd | 2017-07-25 07:28:45 -0500 | [diff] [blame] | 35 | |
Andrew Geissler | 58a1801 | 2018-01-19 19:36:05 -0800 | [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 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; |
Deepak Kodihalli | a646edd | 2017-07-25 07:28:45 -0500 | [diff] [blame] | 46 | |
Andrew Geissler | e87db70 | 2020-10-22 19:33:26 -0500 | [diff] [blame] | 47 | /** @brief host auto_reboot user settings object */ |
Andrew Geissler | 58a1801 | 2018-01-19 19:36:05 -0800 | [diff] [blame] | 48 | Path autoReboot; |
Deepak Kodihalli | a646edd | 2017-07-25 07:28:45 -0500 | [diff] [blame] | 49 | |
Andrew Geissler | e87db70 | 2020-10-22 19:33:26 -0500 | [diff] [blame] | 50 | /** @brief host auto_reboot one-time settings object */ |
| 51 | Path autoRebootOneTime; |
| 52 | |
Andrew Geissler | 58a1801 | 2018-01-19 19:36:05 -0800 | [diff] [blame] | 53 | /** @brief host power_restore_policy settings object */ |
| 54 | Path powerRestorePolicy; |
Deepak Kodihalli | a646edd | 2017-07-25 07:28:45 -0500 | [diff] [blame] | 55 | |
Andrew Geissler | 35ca2e3 | 2021-02-09 13:54:26 -0600 | [diff] [blame^] | 56 | /** @brief host power_restore_policy one-time settings object */ |
| 57 | Path powerRestorePolicyOneTime; |
| 58 | |
Andrew Geissler | 58a1801 | 2018-01-19 19:36:05 -0800 | [diff] [blame] | 59 | /** @brief The Dbus bus object */ |
| 60 | sdbusplus::bus::bus& bus; |
Deepak Kodihalli | a646edd | 2017-07-25 07:28:45 -0500 | [diff] [blame] | 61 | }; |
| 62 | |
| 63 | } // namespace settings |