platform-mc: Support register OEM mechanism to poll events
When the terminus only supports the `Poll-based message` type as `Table
17 - EventMessageSupported command format` in DSP0248 V1.3.0, BMC needs
polling the events from the terminus.
Add method to register OEM mechanism to poll the event from terminus.
Change-Id: I9c10d66ce076de3ddb38c9a391c3784b57ebb934
Signed-off-by: Dung Cao <dung@os.amperecomputing.com>
Signed-off-by: Dung Cao <dung@os.amperecomputing.com>
diff --git a/platform-mc/manager.hpp b/platform-mc/manager.hpp
index 29d924a..213f1f5 100644
--- a/platform-mc/manager.hpp
+++ b/platform-mc/manager.hpp
@@ -16,6 +16,9 @@
namespace platform_mc
{
+using PollHandler = std::function<exec::task<int>(pldm_tid_t tid)>;
+using PollHandlers = std::vector<PollHandler>;
+
/**
* @brief Manager
*
@@ -209,6 +212,23 @@
eventManager.registerPolledEventHandler(eventClass, handlers);
}
+ /** @brief Register OEM flow to poll the PLDM Event use
+ * PollForPlatformEventMessage command
+ *
+ * @param[in] handler - Poll event handlerr
+ */
+ void registerOEMPollMethod(PollHandler handler)
+ {
+ pollHandlers.push_back(std::move(handler));
+ }
+
+ /** @brief OEM task to do OEM event polling
+ *
+ * @param[in] tid - Destination TID
+ * @return coroutine return_value - PLDM completion code
+ */
+ exec::task<int> oemPollForPlatformEvent(pldm_tid_t tid);
+
private:
/** @brief List of discovered termini */
TerminiMapper termini{};
@@ -224,6 +244,9 @@
/** @brief Store event manager handler */
EventManager eventManager;
+
+ /** @brief map of PLDM event type to EventHandlers */
+ PollHandlers pollHandlers;
};
} // namespace platform_mc
} // namespace pldm