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" |
| 6 | |
| 7 | namespace phosphor |
| 8 | { |
| 9 | namespace logging |
| 10 | { |
| 11 | namespace details |
| 12 | { |
| 13 | |
| 14 | template <typename T> |
| 15 | using ServerObject = typename sdbusplus::server::object::object<T>; |
| 16 | |
| 17 | using EntryIface = |
| 18 | sdbusplus::xyz::openbmc_project::Logging::server::Entry; |
| 19 | |
| 20 | } // namespace details |
| 21 | |
| 22 | /** @class Entry |
| 23 | * @brief OpenBMC logging entry implementation. |
| 24 | * @details A concrete implementation for the |
| 25 | * xyz.openbmc_project.Logging.Entry DBus API. |
| 26 | */ |
Adriana Kobylak | df995fa | 2017-01-08 15:14:02 -0600 | [diff] [blame] | 27 | class Entry : public details::ServerObject<details::EntryIface> |
Adriana Kobylak | 88d7cf8 | 2017-01-24 12:30:15 -0600 | [diff] [blame] | 28 | { |
| 29 | public: |
| 30 | Entry() = delete; |
| 31 | Entry(const Entry&) = delete; |
| 32 | Entry& operator=(const Entry&) = delete; |
| 33 | Entry(Entry&&) = delete; |
| 34 | Entry& operator=(Entry&&) = delete; |
| 35 | virtual ~Entry() = default; |
| 36 | |
Adriana Kobylak | df995fa | 2017-01-08 15:14:02 -0600 | [diff] [blame] | 37 | /** @brief Constructor to put object onto bus at a dbus path. |
Adriana Kobylak | 4ea7f31 | 2017-01-10 12:52:34 -0600 | [diff] [blame^] | 38 | * Defer signal registration (pass true for deferSignal to the |
| 39 | * base class) until after the properties are set. |
Adriana Kobylak | df995fa | 2017-01-08 15:14:02 -0600 | [diff] [blame] | 40 | * @param[in] bus - Bus to attach to. |
| 41 | * @param[in] path - Path to attach at. |
Adriana Kobylak | 4ea7f31 | 2017-01-10 12:52:34 -0600 | [diff] [blame^] | 42 | * @param[in] properties - Desired Entry properties. |
Adriana Kobylak | 88d7cf8 | 2017-01-24 12:30:15 -0600 | [diff] [blame] | 43 | */ |
Adriana Kobylak | 4ea7f31 | 2017-01-10 12:52:34 -0600 | [diff] [blame^] | 44 | Entry(sdbusplus::bus::bus& bus, |
| 45 | const std::string& path, |
| 46 | uint32_t idErr, |
| 47 | Level severityErr, |
| 48 | std::string&& msgErr, |
| 49 | std::vector<std::string>&& additionalDataErr) : |
| 50 | details::ServerObject<details::EntryIface> |
| 51 | (bus, path.c_str(), true) |
| 52 | { |
| 53 | id(idErr); |
| 54 | severity(severityErr); |
| 55 | message(std::move(msgErr)); |
| 56 | additionalData(std::move(additionalDataErr)); |
| 57 | |
| 58 | // Emit deferred signal. |
| 59 | this->emit_object_added(); |
| 60 | }; |
| 61 | |
Adriana Kobylak | 88d7cf8 | 2017-01-24 12:30:15 -0600 | [diff] [blame] | 62 | }; |
| 63 | |
| 64 | } // namespace logging |
| 65 | } // namespace phosphor |