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 | |
| 16 | using BlockIface = sdbusplus::server::object::object< |
Andrew Geissler | 0add0b7 | 2020-04-09 10:50:51 -0500 | [diff] [blame] | 17 | sdbusplus::xyz::openbmc_project::Logging::server::ErrorBlocksTransition, |
| 18 | sdbusplus::xyz::openbmc_project::Association::server::Definitions>; |
| 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 | */ |
| 43 | Block(sdbusplus::bus::bus& 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 | { |
| 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 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 |