blob: dcdfe8adbab4f185bb15cb0cd8aafe38f0b64946 [file] [log] [blame]
Deepak Kodihallia646edd2017-07-25 07:28:45 -05001#pragma once
2
Deepak Kodihallia646edd2017-07-25 07:28:45 -05003#include <sdbusplus/bus.hpp>
4
Andrew Geisslere426b582020-05-28 12:40:55 -05005#include <string>
6
Deepak Kodihallia646edd2017-07-25 07:28:45 -05007namespace settings
8{
9
10using Path = std::string;
11using Service = std::string;
12using Interface = std::string;
13
14constexpr auto root = "/";
Andrew Geissler58a18012018-01-19 19:36:05 -080015constexpr auto autoRebootIntf = "xyz.openbmc_project.Control.Boot.RebootPolicy";
Deepak Kodihallia646edd2017-07-25 07:28:45 -050016constexpr 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 */
22struct Objects
23{
Andrew Geissler58a18012018-01-19 19:36:05 -080024 public:
25 /** @brief Constructor - fetch settings objects
26 *
27 * @param[in] bus - The Dbus bus object
28 */
Andrew Geissler514474d2019-09-12 14:15:07 -050029 explicit Objects(sdbusplus::bus::bus& bus);
Andrew Geissler58a18012018-01-19 19:36:05 -080030 Objects(const Objects&) = delete;
31 Objects& operator=(const Objects&) = delete;
32 Objects(Objects&&) = delete;
33 Objects& operator=(Objects&&) = delete;
34 ~Objects() = default;
Deepak Kodihallia646edd2017-07-25 07:28:45 -050035
Andrew Geissler58a18012018-01-19 19:36:05 -080036 /** @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 Kodihallia646edd2017-07-25 07:28:45 -050046
Andrew Geisslere87db702020-10-22 19:33:26 -050047 /** @brief host auto_reboot user settings object */
Andrew Geissler58a18012018-01-19 19:36:05 -080048 Path autoReboot;
Deepak Kodihallia646edd2017-07-25 07:28:45 -050049
Andrew Geisslere87db702020-10-22 19:33:26 -050050 /** @brief host auto_reboot one-time settings object */
51 Path autoRebootOneTime;
52
Andrew Geissler58a18012018-01-19 19:36:05 -080053 /** @brief host power_restore_policy settings object */
54 Path powerRestorePolicy;
Deepak Kodihallia646edd2017-07-25 07:28:45 -050055
Andrew Geissler35ca2e32021-02-09 13:54:26 -060056 /** @brief host power_restore_policy one-time settings object */
57 Path powerRestorePolicyOneTime;
58
Andrew Geissler58a18012018-01-19 19:36:05 -080059 /** @brief The Dbus bus object */
60 sdbusplus::bus::bus& bus;
Deepak Kodihallia646edd2017-07-25 07:28:45 -050061};
62
63} // namespace settings