1 #pragma once 2 3 #include "config.h" 4 5 #include "xyz/openbmc_project/Logging/ErrorBlocksTransition/server.hpp" 6 7 #include <sdbusplus/bus.hpp> 8 #include <sdbusplus/server/object.hpp> 9 #include <xyz/openbmc_project/Association/Definitions/server.hpp> 10 11 namespace phosphor 12 { 13 namespace logging 14 { 15 16 using BlockIface = sdbusplus::server::object::object< 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>>; 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) : 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 }; 53 54 uint32_t entryId; 55 56 private: 57 }; 58 59 } // namespace logging 60 } // namespace phosphor 61