blob: 2e2db4423580011f8764306926aec3e25d33af06 [file] [log] [blame]
Andrew Geissler6a0ef6f2020-04-06 15:06:31 -05001#pragma once
2
Andrew Geissler0add0b72020-04-09 10:50:51 -05003#include "config.h"
4
Andrew Geissler6a0ef6f2020-04-06 15:06:31 -05005#include "xyz/openbmc_project/Logging/ErrorBlocksTransition/server.hpp"
6
7#include <sdbusplus/bus.hpp>
8#include <sdbusplus/server/object.hpp>
Andrew Geissler0add0b72020-04-09 10:50:51 -05009#include <xyz/openbmc_project/Association/Definitions/server.hpp>
Andrew Geissler6a0ef6f2020-04-06 15:06:31 -050010
11namespace phosphor
12{
13namespace logging
14{
15
Patrick Williams45e83522022-07-22 19:26:52 -050016using BlockIface = sdbusplus::server::object_t<
Andrew Geissler0add0b72020-04-09 10:50:51 -050017 sdbusplus::xyz::openbmc_project::Logging::server::ErrorBlocksTransition,
18 sdbusplus::xyz::openbmc_project::Association::server::Definitions>;
19
20using AssociationList =
21 std::vector<std::tuple<std::string, std::string, std::string>>;
Andrew Geissler6a0ef6f2020-04-06 15:06:31 -050022
23/** @class Block
24 * @brief OpenBMC logging Block implementation.
25 * @details A concrete implementation for the
26 * xyz.openbmc_project.Logging.ErrorBlocksTransition DBus API
27 */
28class Block : public BlockIface
29{
30 public:
31 Block() = delete;
32 Block(const Block&) = delete;
33 Block& operator=(const Block&) = delete;
34 Block(Block&&) = delete;
35 Block& operator=(Block&&) = delete;
36 virtual ~Block() = default;
37
38 /** @brief Constructor to put object onto bus at a dbus path.
39 * @param[in] bus - Bus to attach to.
40 * @param[in] path - Path to attach at.
41 * @param[in] entryId - Distinct ID of the error.
42 */
Patrick Williams45e83522022-07-22 19:26:52 -050043 Block(sdbusplus::bus_t& bus, const std::string& path, uint32_t entryId) :
Andrew Geissler0add0b72020-04-09 10:50:51 -050044 BlockIface(bus, path.c_str()), entryId(entryId)
45 {
46 std::string entryPath{std::string(OBJ_ENTRY) + '/' +
47 std::to_string(entryId)};
48 AssociationList assoc{std::make_tuple(std::string{"blocking_error"},
49 std::string{"blocking_obj"},
50 entryPath)};
51 associations(std::move(assoc));
52 };
Andrew Geissler6a0ef6f2020-04-06 15:06:31 -050053
54 uint32_t entryId;
55
56 private:
57};
58
59} // namespace logging
60} // namespace phosphor