1 #pragma once 2 3 #include <sdbusplus/bus.hpp> 4 5 #include <string> 6 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 = "/"; 15 constexpr auto autoRebootIntf = "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 explicit 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 user settings object */ 48 Path autoReboot; 49 50 /** @brief host auto_reboot one-time settings object */ 51 Path autoRebootOneTime; 52 53 /** @brief host power_restore_policy settings object */ 54 Path powerRestorePolicy; 55 56 /** @brief host power_restore_policy one-time settings object */ 57 Path powerRestorePolicyOneTime; 58 59 /** @brief The Dbus bus object */ 60 sdbusplus::bus::bus& bus; 61 }; 62 63 } // namespace settings 64