blob: 5968145eea648de22b87cfb5237f2e7f85ec5e63 [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
17/** @class Entry
18 * @brief OpenBMC logging entry implementation.
19 * @details A concrete implementation for the
Deepak Kodihallib388da62017-02-27 00:47:12 -060020 * xyz.openbmc_project.Logging.Entry and
21 * org.openbmc.Associations DBus APIs.
Adriana Kobylak88d7cf82017-01-24 12:30:15 -060022 */
Deepak Kodihallib388da62017-02-27 00:47:12 -060023class Entry : public EntryIfaces
Adriana Kobylak88d7cf82017-01-24 12:30:15 -060024{
25 public:
26 Entry() = delete;
27 Entry(const Entry&) = delete;
28 Entry& operator=(const Entry&) = delete;
29 Entry(Entry&&) = delete;
30 Entry& operator=(Entry&&) = delete;
31 virtual ~Entry() = default;
32
Adriana Kobylakdf995fa2017-01-08 15:14:02 -060033 /** @brief Constructor to put object onto bus at a dbus path.
Adriana Kobylak4ea7f312017-01-10 12:52:34 -060034 * Defer signal registration (pass true for deferSignal to the
35 * base class) until after the properties are set.
Adriana Kobylakdf995fa2017-01-08 15:14:02 -060036 * @param[in] bus - Bus to attach to.
37 * @param[in] path - Path to attach at.
Adriana Kobylakc5f0bbd2017-01-22 14:56:04 -060038 * @param[in] idErr - The error entry id.
39 * @param[in] timestampErr - The commit timestamp.
40 * @param[in] severityErr - The severity of the error.
41 * @param[in] msgErr - The message of the error.
42 * @param[in] additionalDataErr - The error metadata.
Adriana Kobylak88d7cf82017-01-24 12:30:15 -060043 */
Adriana Kobylak4ea7f312017-01-10 12:52:34 -060044 Entry(sdbusplus::bus::bus& bus,
45 const std::string& path,
46 uint32_t idErr,
Adriana Kobylakc5f0bbd2017-01-22 14:56:04 -060047 uint64_t timestampErr,
Adriana Kobylak4ea7f312017-01-10 12:52:34 -060048 Level severityErr,
49 std::string&& msgErr,
50 std::vector<std::string>&& additionalDataErr) :
Deepak Kodihallib388da62017-02-27 00:47:12 -060051 EntryIfaces(bus, path.c_str(), true)
Adriana Kobylak4ea7f312017-01-10 12:52:34 -060052 {
53 id(idErr);
54 severity(severityErr);
Adriana Kobylakc5f0bbd2017-01-22 14:56:04 -060055 timestamp(timestampErr);
Adriana Kobylak4ea7f312017-01-10 12:52:34 -060056 message(std::move(msgErr));
57 additionalData(std::move(additionalDataErr));
58
59 // Emit deferred signal.
60 this->emit_object_added();
61 };
62
Adriana Kobylak88d7cf82017-01-24 12:30:15 -060063};
64
65} // namespace logging
66} // namespace phosphor