Adriana Kobylak | 88d7cf8 | 2017-01-24 12:30:15 -0600 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <sdbusplus/bus.hpp> |
| 4 | #include <sdbusplus/server/object.hpp> |
| 5 | #include "xyz/openbmc_project/Logging/Entry/server.hpp" |
Deepak Kodihalli | b388da6 | 2017-02-27 00:47:12 -0600 | [diff] [blame] | 6 | #include "org/openbmc/Associations/server.hpp" |
Adriana Kobylak | 88d7cf8 | 2017-01-24 12:30:15 -0600 | [diff] [blame] | 7 | |
| 8 | namespace phosphor |
| 9 | { |
| 10 | namespace logging |
| 11 | { |
Adriana Kobylak | 88d7cf8 | 2017-01-24 12:30:15 -0600 | [diff] [blame] | 12 | |
Deepak Kodihalli | b388da6 | 2017-02-27 00:47:12 -0600 | [diff] [blame] | 13 | using EntryIfaces = sdbusplus::server::object::object< |
| 14 | sdbusplus::xyz::openbmc_project::Logging::server::Entry, |
| 15 | sdbusplus::org::openbmc::server::Associations>; |
Adriana Kobylak | 88d7cf8 | 2017-01-24 12:30:15 -0600 | [diff] [blame] | 16 | |
Deepak Kodihalli | 35b4637 | 2017-02-27 04:58:18 -0600 | [diff] [blame] | 17 | using AssociationList = |
| 18 | std::vector<std::tuple<std::string, std::string, std::string>>; |
| 19 | |
Adriana Kobylak | 88d7cf8 | 2017-01-24 12:30:15 -0600 | [diff] [blame] | 20 | /** @class Entry |
| 21 | * @brief OpenBMC logging entry implementation. |
| 22 | * @details A concrete implementation for the |
Deepak Kodihalli | b388da6 | 2017-02-27 00:47:12 -0600 | [diff] [blame] | 23 | * xyz.openbmc_project.Logging.Entry and |
| 24 | * org.openbmc.Associations DBus APIs. |
Adriana Kobylak | 88d7cf8 | 2017-01-24 12:30:15 -0600 | [diff] [blame] | 25 | */ |
Deepak Kodihalli | b388da6 | 2017-02-27 00:47:12 -0600 | [diff] [blame] | 26 | class Entry : public EntryIfaces |
Adriana Kobylak | 88d7cf8 | 2017-01-24 12:30:15 -0600 | [diff] [blame] | 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 | |
Adriana Kobylak | df995fa | 2017-01-08 15:14:02 -0600 | [diff] [blame] | 36 | /** @brief Constructor to put object onto bus at a dbus path. |
Adriana Kobylak | 4ea7f31 | 2017-01-10 12:52:34 -0600 | [diff] [blame] | 37 | * Defer signal registration (pass true for deferSignal to the |
| 38 | * base class) until after the properties are set. |
Adriana Kobylak | df995fa | 2017-01-08 15:14:02 -0600 | [diff] [blame] | 39 | * @param[in] bus - Bus to attach to. |
| 40 | * @param[in] path - Path to attach at. |
Adriana Kobylak | c5f0bbd | 2017-01-22 14:56:04 -0600 | [diff] [blame] | 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. |
Adriana Kobylak | 88d7cf8 | 2017-01-24 12:30:15 -0600 | [diff] [blame] | 46 | */ |
Adriana Kobylak | 4ea7f31 | 2017-01-10 12:52:34 -0600 | [diff] [blame] | 47 | Entry(sdbusplus::bus::bus& bus, |
| 48 | const std::string& path, |
| 49 | uint32_t idErr, |
Adriana Kobylak | c5f0bbd | 2017-01-22 14:56:04 -0600 | [diff] [blame] | 50 | uint64_t timestampErr, |
Adriana Kobylak | 4ea7f31 | 2017-01-10 12:52:34 -0600 | [diff] [blame] | 51 | Level severityErr, |
| 52 | std::string&& msgErr, |
Deepak Kodihalli | 35b4637 | 2017-02-27 04:58:18 -0600 | [diff] [blame] | 53 | std::vector<std::string>&& additionalDataErr, |
| 54 | AssociationList&& objects) : |
Deepak Kodihalli | b388da6 | 2017-02-27 00:47:12 -0600 | [diff] [blame] | 55 | EntryIfaces(bus, path.c_str(), true) |
Adriana Kobylak | 4ea7f31 | 2017-01-10 12:52:34 -0600 | [diff] [blame] | 56 | { |
| 57 | id(idErr); |
| 58 | severity(severityErr); |
Adriana Kobylak | c5f0bbd | 2017-01-22 14:56:04 -0600 | [diff] [blame] | 59 | timestamp(timestampErr); |
Adriana Kobylak | 4ea7f31 | 2017-01-10 12:52:34 -0600 | [diff] [blame] | 60 | message(std::move(msgErr)); |
| 61 | additionalData(std::move(additionalDataErr)); |
Deepak Kodihalli | 35b4637 | 2017-02-27 04:58:18 -0600 | [diff] [blame] | 62 | associations(std::move(objects)); |
Deepak Kodihalli | 16aed11 | 2017-03-31 00:11:46 -0500 | [diff] [blame^] | 63 | // Store a copy of associations in case we need to recreate |
| 64 | assocs = associations(); |
Deepak Kodihalli | 1c9f16e | 2017-03-27 03:50:01 -0500 | [diff] [blame] | 65 | resolved(false); |
Adriana Kobylak | 4ea7f31 | 2017-01-10 12:52:34 -0600 | [diff] [blame] | 66 | |
| 67 | // Emit deferred signal. |
| 68 | this->emit_object_added(); |
| 69 | }; |
| 70 | |
Deepak Kodihalli | 16aed11 | 2017-03-31 00:11:46 -0500 | [diff] [blame^] | 71 | private: |
| 72 | /** @brief This entry's associations */ |
| 73 | AssociationList assocs = {}; |
Adriana Kobylak | 88d7cf8 | 2017-01-24 12:30:15 -0600 | [diff] [blame] | 74 | }; |
| 75 | |
| 76 | } // namespace logging |
| 77 | } // namespace phosphor |