summaryrefslogtreecommitdiffstats
path: root/src/event_entry.hpp
blob: 7be66d960e99cef8ffd4fee8e550879374854891 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#pragma once

#include "sdbusplus.hpp"
#include "xyz/openbmc_project/Logging/Event/server.hpp"

#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/object.hpp>

namespace phosphor
{
namespace events
{

using namespace phosphor::dbus::monitoring;

using EntryIface = sdbusplus::server::object::object <
                        sdbusplus::xyz::openbmc_project::Logging::server::Event >;

/** @class Entry
 *  @brief OpenBMC Event entry implementation.
 *  @details A concrete implementation for the
 *  xyz.openbmc_project.Event.Entry.
 */
class Entry : public EntryIface
{
    public:
        Entry() = delete;
        Entry(const Entry&) = delete;
        Entry& operator=(const Entry&) = delete;
        Entry(Entry&&) = delete;
        Entry& operator=(Entry&&) = delete;
        virtual ~Entry() = default;

        /** @brief Constructor to put object onto bus at a dbus path.
         *  @param[in] path - Path to attach at.
         *  @param[in] eventId - The event entry id.
         *  @param[in] timestamp - timestamp when the event created.
         *  @param[in] msg - The message of the event.
         *  @param[in] metaData - The event metadata.
         */
        Entry(
            const std::string& path,
            uint64_t eventTimestamp,
            std::string&& msg,
            std::vector<std::string>&& metaData) :
                EntryIface(SDBusPlus::getBus(), path.c_str(), true),
                objectPath(path)
            {
                timestamp(eventTimestamp);
                message(msg);
                additionalData(metaData);
                // Emit deferred signal.
                this->emit_object_added();
            }

        /** @brief Path of Object. */
        std::string objectPath;

};

} // namespace events
} // namespace phosphor
OpenPOWER on IntegriCloud