blob: 823dbd194b5d12d8d74e1b92ae15290e9fc8cae0 [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<
Willy Tu6ddbf692023-09-05 10:54:16 -070017 sdbusplus::server::xyz::openbmc_project::logging::ErrorBlocksTransition,
18 sdbusplus::server::xyz::openbmc_project::association::Definitions>;
Andrew Geissler0add0b72020-04-09 10:50:51 -050019
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 {
Patrick Williams075c7922024-08-16 15:19:49 -040046 std::string entryPath{
47 std::string(OBJ_ENTRY) + '/' + std::to_string(entryId)};
48 AssociationList assoc{
49 std::make_tuple(std::string{"blocking_error"},
50 std::string{"blocking_obj"}, entryPath)};
Andrew Geissler0add0b72020-04-09 10:50:51 -050051 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