summaryrefslogtreecommitdiffstats
path: root/settings.hpp
blob: b4893cbe3e15faca653533f78b27f4c30034469f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#pragma once

#include <sdbusplus/bus.hpp>
#include <string>

namespace settings
{

using Path = std::string;
using Service = std::string;
using Interface = std::string;

constexpr auto root = "/";
constexpr auto timeOwnerIntf = "xyz.openbmc_project.Time.Owner";
constexpr auto timeSyncIntf = "xyz.openbmc_project.Time.Synchronization";
constexpr auto hostStateIntf = "xyz.openbmc_project.State.Host";

/** @class Objects
 *  @brief Fetch paths of settings D-bus objects of interest upon construction
 */
struct Objects
{
  public:
    /** @brief Constructor - fetch settings objects
     *
     * @param[in] bus - The D-bus bus object
     */
    Objects() = delete;
    explicit Objects(sdbusplus::bus::bus&);
    Objects(const Objects&) = delete;
    Objects& operator=(const Objects&) = delete;
    Objects(Objects&&) = default;
    Objects& operator=(Objects&&) = default;
    ~Objects() = default;

    /** @brief Fetch D-bus service, given a path and an interface. The
     *         service can't be cached because mapper returns unique
     *         service names.
     *
     * @param[in] path - The D-bus object
     * @param[in] interface - The D-bus interface
     *
     * @return std::string - the D-bus service
     */
    Service service(const Path& path, const Interface& interface) const;

    /** @brief time owner settings object */
    Path timeOwner;

    /** @brief time sync method settings object */
    Path timeSyncMethod;

    /** @brief host state object */
    Path hostState;

  private:
    sdbusplus::bus::bus& bus;
};

} // namespace settings
OpenPOWER on IntegriCloud