Andrew Geissler | 6a0ef6f | 2020-04-06 15:06:31 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Andrew Geissler | 0add0b7 | 2020-04-09 10:50:51 -0500 | [diff] [blame] | 3 | #include "config.h" |
| 4 | |
Andrew Geissler | 6a0ef6f | 2020-04-06 15:06:31 -0500 | [diff] [blame] | 5 | #include "xyz/openbmc_project/Logging/ErrorBlocksTransition/server.hpp" |
| 6 | |
| 7 | #include <sdbusplus/bus.hpp> |
| 8 | #include <sdbusplus/server/object.hpp> |
Andrew Geissler | 0add0b7 | 2020-04-09 10:50:51 -0500 | [diff] [blame] | 9 | #include <xyz/openbmc_project/Association/Definitions/server.hpp> |
Andrew Geissler | 6a0ef6f | 2020-04-06 15:06:31 -0500 | [diff] [blame] | 10 | |
| 11 | namespace phosphor |
| 12 | { |
| 13 | namespace logging |
| 14 | { |
| 15 | |
Patrick Williams | 45e8352 | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 16 | using BlockIface = sdbusplus::server::object_t< |
Willy Tu | 6ddbf69 | 2023-09-05 10:54:16 -0700 | [diff] [blame] | 17 | sdbusplus::server::xyz::openbmc_project::logging::ErrorBlocksTransition, |
| 18 | sdbusplus::server::xyz::openbmc_project::association::Definitions>; |
Andrew Geissler | 0add0b7 | 2020-04-09 10:50:51 -0500 | [diff] [blame] | 19 | |
| 20 | using AssociationList = |
| 21 | std::vector<std::tuple<std::string, std::string, std::string>>; |
Andrew Geissler | 6a0ef6f | 2020-04-06 15:06:31 -0500 | [diff] [blame] | 22 | |
| 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 | */ |
| 28 | class 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 Williams | 45e8352 | 2022-07-22 19:26:52 -0500 | [diff] [blame] | 43 | Block(sdbusplus::bus_t& bus, const std::string& path, uint32_t entryId) : |
Andrew Geissler | 0add0b7 | 2020-04-09 10:50:51 -0500 | [diff] [blame] | 44 | BlockIface(bus, path.c_str()), entryId(entryId) |
| 45 | { |
Patrick Williams | 075c792 | 2024-08-16 15:19:49 -0400 | [diff] [blame] | 46 | 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 Geissler | 0add0b7 | 2020-04-09 10:50:51 -0500 | [diff] [blame] | 51 | associations(std::move(assoc)); |
| 52 | }; |
Andrew Geissler | 6a0ef6f | 2020-04-06 15:06:31 -0500 | [diff] [blame] | 53 | |
| 54 | uint32_t entryId; |
| 55 | |
| 56 | private: |
| 57 | }; |
| 58 | |
| 59 | } // namespace logging |
| 60 | } // namespace phosphor |