summaryrefslogtreecommitdiffstats
path: root/src/event_entry.hpp
diff options
context:
space:
mode:
authorRatan Gupta <ratagupt@in.ibm.com>2017-10-06 21:37:01 +0530
committerRatan Gupta <ratagupt@in.ibm.com>2018-02-23 20:05:18 +0530
commit3e84ec6645bcea669805947f1409b58b4b0d9f72 (patch)
treeff1adf181670223651713503ecc06887f403e821 /src/event_entry.hpp
parentcd22786a280372a2e31c61dffabae204a8ab9d8b (diff)
downloadphosphor-dbus-monitor-3e84ec6645bcea669805947f1409b58b4b0d9f72.tar.gz
phosphor-dbus-monitor-3e84ec6645bcea669805947f1409b58b4b0d9f72.zip
Implement create function in event manager
Implement the logging event interface. Create the dbus event object based on the event type. Change-Id: Idfa9e5c43f170d904fd25f22d73e0509b1785fc9 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
Diffstat (limited to 'src/event_entry.hpp')
-rw-r--r--src/event_entry.hpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/event_entry.hpp b/src/event_entry.hpp
new file mode 100644
index 0000000..7be66d9
--- /dev/null
+++ b/src/event_entry.hpp
@@ -0,0 +1,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