oem ibm: infrastructure for oem handlers
1. This commit adds the framework for an oem handler
which can be used by specific oem use-cases
for implementing various commands.
2. This commit adds implementation for getStateSensorReadings
and setStateEffecterStates commands for oem state sets.
3. Also adds implementation for inband code update.
Change-Id: Ib38a66ee381dd06b93f6a9313d51de1c23e6ee65
Signed-off-by: Sampa Misra <sampmisr@in.ibm.com>
diff --git a/libpldmresponder/oem_handler.hpp b/libpldmresponder/oem_handler.hpp
new file mode 100644
index 0000000..52d0027
--- /dev/null
+++ b/libpldmresponder/oem_handler.hpp
@@ -0,0 +1,75 @@
+#pragma once
+
+#include "common/types.hpp"
+#include "common/utils.hpp"
+#include "pldmd/handler.hpp"
+
+namespace pldm
+{
+
+using namespace pdr;
+
+namespace responder
+{
+
+namespace oem_platform
+{
+
+class Handler : public CmdHandler
+{
+ public:
+ Handler(const pldm::utils::DBusHandler* dBusIntf) : dBusIntf(dBusIntf)
+ {}
+
+ /** @brief Interface to get the state sensor readings requested by pldm
+ * requester for OEM types. Each specific type should implement a handler
+ * of it's own
+ *
+ * @param[in] entityType - entity type corresponding to the sensor
+ * @param[in] entityInstance - entity instance number
+ * @param[in] stateSetId - state set id
+ * @param[in] compSensorCnt - composite sensor count
+ * @param[out] stateField - The state field data for each of the states,
+ * equal to composite sensor count in number
+ *
+ * @return - Success or failure in getting the states. Returns failure in
+ * terms of PLDM completion codes if fetching atleast one state
+ * fails
+ */
+ virtual int getOemStateSensorReadingsHandler(
+ EntityType entityType, EntityInstance entityInstance,
+ StateSetId stateSetId, CompositeCount compSensorCnt,
+ std::vector<get_sensor_state_field>& stateField) = 0;
+
+ /** @brief Interface to set the effecter requested by pldm requester
+ * for OEM types. Each individual oem type should implement
+ * it's own handler.
+ *
+ * @param[in] entityType - entity type corresponding to the effecter id
+ * @param[in] entityInstance - entity instance
+ * @param[in] stateSetId - state set id
+ * @param[in] compEffecterCnt - composite effecter count
+ * param[in] stateField - The state field data for each of the states,
+ * equal to compEffecterCnt in number
+ *
+ * @return - Success or failure in setting the states.Returns failure in
+ * terms of PLDM completion codes if atleast one state fails to
+ * be set
+ */
+
+ virtual int oemSetStateEffecterStatesHandler(
+ EntityType entityType, EntityInstance entityInstance,
+ StateSetId stateSetId, CompositeCount compEffecterCnt,
+ const std::vector<set_effecter_state_field>& stateField) = 0;
+
+ virtual ~Handler() = default;
+
+ protected:
+ const pldm::utils::DBusHandler* dBusIntf;
+};
+
+} // namespace oem_platform
+
+} // namespace responder
+
+} // namespace pldm