1 #pragma once 2 3 #include <sdbusplus/bus.hpp> 4 #include <sdbusplus/server/object.hpp> 5 #include "xyz/openbmc_project/Logging/Entry/server.hpp" 6 #include "org/openbmc/Associations/server.hpp" 7 8 namespace phosphor 9 { 10 namespace logging 11 { 12 13 using EntryIfaces = sdbusplus::server::object::object< 14 sdbusplus::xyz::openbmc_project::Logging::server::Entry, 15 sdbusplus::org::openbmc::server::Associations>; 16 17 using AssociationList = 18 std::vector<std::tuple<std::string, std::string, std::string>>; 19 20 /** @class Entry 21 * @brief OpenBMC logging entry implementation. 22 * @details A concrete implementation for the 23 * xyz.openbmc_project.Logging.Entry and 24 * org.openbmc.Associations DBus APIs. 25 */ 26 class Entry : public EntryIfaces 27 { 28 public: 29 Entry() = delete; 30 Entry(const Entry&) = delete; 31 Entry& operator=(const Entry&) = delete; 32 Entry(Entry&&) = delete; 33 Entry& operator=(Entry&&) = delete; 34 virtual ~Entry() = default; 35 36 /** @brief Constructor to put object onto bus at a dbus path. 37 * Defer signal registration (pass true for deferSignal to the 38 * base class) until after the properties are set. 39 * @param[in] bus - Bus to attach to. 40 * @param[in] path - Path to attach at. 41 * @param[in] idErr - The error entry id. 42 * @param[in] timestampErr - The commit timestamp. 43 * @param[in] severityErr - The severity of the error. 44 * @param[in] msgErr - The message of the error. 45 * @param[in] additionalDataErr - The error metadata. 46 */ 47 Entry(sdbusplus::bus::bus& bus, 48 const std::string& path, 49 uint32_t idErr, 50 uint64_t timestampErr, 51 Level severityErr, 52 std::string&& msgErr, 53 std::vector<std::string>&& additionalDataErr, 54 AssociationList&& objects) : 55 EntryIfaces(bus, path.c_str(), true) 56 { 57 id(idErr); 58 severity(severityErr); 59 timestamp(timestampErr); 60 message(std::move(msgErr)); 61 additionalData(std::move(additionalDataErr)); 62 associations(std::move(objects)); 63 64 // Emit deferred signal. 65 this->emit_object_added(); 66 }; 67 68 }; 69 70 } // namespace logging 71 } // namespace phosphor 72