blob: 1c631a9914389cad7dd7407c268e622ea5cbb32d [file] [log] [blame]
Adriana Kobylak88d7cf82017-01-24 12:30:15 -06001#pragma once
2
3#include <sdbusplus/bus.hpp>
4#include <sdbusplus/server/object.hpp>
5#include "xyz/openbmc_project/Logging/Entry/server.hpp"
Deepak Kodihallib388da62017-02-27 00:47:12 -06006#include "org/openbmc/Associations/server.hpp"
Adriana Kobylak88d7cf82017-01-24 12:30:15 -06007
8namespace phosphor
9{
10namespace logging
11{
Adriana Kobylak88d7cf82017-01-24 12:30:15 -060012
Deepak Kodihallib388da62017-02-27 00:47:12 -060013using EntryIfaces = sdbusplus::server::object::object<
14 sdbusplus::xyz::openbmc_project::Logging::server::Entry,
15 sdbusplus::org::openbmc::server::Associations>;
Adriana Kobylak88d7cf82017-01-24 12:30:15 -060016
Deepak Kodihalli35b46372017-02-27 04:58:18 -060017using AssociationList =
18 std::vector<std::tuple<std::string, std::string, std::string>>;
19
Adriana Kobylak88d7cf82017-01-24 12:30:15 -060020/** @class Entry
21 * @brief OpenBMC logging entry implementation.
22 * @details A concrete implementation for the
Deepak Kodihallib388da62017-02-27 00:47:12 -060023 * xyz.openbmc_project.Logging.Entry and
24 * org.openbmc.Associations DBus APIs.
Adriana Kobylak88d7cf82017-01-24 12:30:15 -060025 */
Deepak Kodihallib388da62017-02-27 00:47:12 -060026class Entry : public EntryIfaces
Adriana Kobylak88d7cf82017-01-24 12:30:15 -060027{
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
Adriana Kobylakdf995fa2017-01-08 15:14:02 -060036 /** @brief Constructor to put object onto bus at a dbus path.
Adriana Kobylak4ea7f312017-01-10 12:52:34 -060037 * Defer signal registration (pass true for deferSignal to the
38 * base class) until after the properties are set.
Adriana Kobylakdf995fa2017-01-08 15:14:02 -060039 * @param[in] bus - Bus to attach to.
40 * @param[in] path - Path to attach at.
Adriana Kobylakc5f0bbd2017-01-22 14:56:04 -060041 * @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.
Adriana Kobylak88d7cf82017-01-24 12:30:15 -060046 */
Adriana Kobylak4ea7f312017-01-10 12:52:34 -060047 Entry(sdbusplus::bus::bus& bus,
48 const std::string& path,
49 uint32_t idErr,
Adriana Kobylakc5f0bbd2017-01-22 14:56:04 -060050 uint64_t timestampErr,
Adriana Kobylak4ea7f312017-01-10 12:52:34 -060051 Level severityErr,
52 std::string&& msgErr,
Deepak Kodihalli35b46372017-02-27 04:58:18 -060053 std::vector<std::string>&& additionalDataErr,
54 AssociationList&& objects) :
Deepak Kodihallib388da62017-02-27 00:47:12 -060055 EntryIfaces(bus, path.c_str(), true)
Adriana Kobylak4ea7f312017-01-10 12:52:34 -060056 {
57 id(idErr);
58 severity(severityErr);
Adriana Kobylakc5f0bbd2017-01-22 14:56:04 -060059 timestamp(timestampErr);
Adriana Kobylak4ea7f312017-01-10 12:52:34 -060060 message(std::move(msgErr));
61 additionalData(std::move(additionalDataErr));
Deepak Kodihalli35b46372017-02-27 04:58:18 -060062 associations(std::move(objects));
Deepak Kodihalli1c9f16e2017-03-27 03:50:01 -050063 resolved(false);
Adriana Kobylak4ea7f312017-01-10 12:52:34 -060064
65 // Emit deferred signal.
66 this->emit_object_added();
67 };
68
Adriana Kobylak88d7cf82017-01-24 12:30:15 -060069};
70
71} // namespace logging
72} // namespace phosphor