1 #pragma once
2 
3 #include "common/types.hpp"
4 #include "common/utils.hpp"
5 #include "pldmd/handler.hpp"
6 
7 namespace pldm
8 {
9 
10 using namespace pdr;
11 
12 namespace responder
13 {
14 
15 namespace oem_platform
16 {
17 
18 class Handler : public CmdHandler
19 {
20   public:
21     Handler(const pldm::utils::DBusHandler* dBusIntf) : dBusIntf(dBusIntf)
22     {}
23 
24     /** @brief Interface to get the state sensor readings requested by pldm
25      *  requester for OEM types. Each specific type should implement a handler
26      *  of it's own
27      *
28      *  @param[in] entityType - entity type corresponding to the sensor
29      *  @param[in] entityInstance - entity instance number
30      *  @param[in] stateSetId - state set id
31      *  @param[in] compSensorCnt - composite sensor count
32      *  @param[out] stateField - The state field data for each of the states,
33      *                           equal to composite sensor count in number
34      *
35      *  @return - Success or failure in getting the states. Returns failure in
36      *            terms of PLDM completion codes if fetching atleast one state
37      *            fails
38      */
39     virtual int getOemStateSensorReadingsHandler(
40         EntityType entityType, EntityInstance entityInstance,
41         StateSetId stateSetId, CompositeCount compSensorCnt,
42         std::vector<get_sensor_state_field>& stateField) = 0;
43 
44     /** @brief Interface to set the effecter requested by pldm requester
45      *         for OEM types. Each individual oem type should implement
46      *         it's own handler.
47      *
48      *  @param[in] entityType - entity type corresponding to the effecter id
49      *  @param[in] entityInstance - entity instance
50      *  @param[in] stateSetId - state set id
51      *  @param[in] compEffecterCnt - composite effecter count
52      *  @param[in] stateField - The state field data for each of the states,
53      *                         equal to compEffecterCnt in number
54      *  @param[in] effecterId - Effecter id
55      *
56      *  @return - Success or failure in setting the states.Returns failure in
57      *            terms of PLDM completion codes if atleast one state fails to
58      *            be set
59      */
60     virtual int oemSetStateEffecterStatesHandler(
61         uint16_t entityType, uint16_t entityInstance, uint16_t stateSetId,
62         uint8_t compEffecterCnt,
63         std::vector<set_effecter_state_field>& stateField,
64         uint16_t effecterId) = 0;
65 
66     /** @brief Interface to generate the OEM PDRs
67      *
68      * @param[in] repo - instance of concrete implementation of Repo
69      */
70     virtual void buildOEMPDR(pdr_utils::Repo& repo) = 0;
71 
72     virtual ~Handler() = default;
73 
74   protected:
75     const pldm::utils::DBusHandler* dBusIntf;
76 };
77 
78 } // namespace oem_platform
79 
80 } // namespace responder
81 
82 } // namespace pldm
83