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      *
55      *  @return - Success or failure in setting the states.Returns failure in
56      *            terms of PLDM completion codes if atleast one state fails to
57      *            be set
58      */
59 
60     virtual int oemSetStateEffecterStatesHandler(
61         EntityType entityType, EntityInstance entityInstance,
62         StateSetId stateSetId, CompositeCount compEffecterCnt,
63         const std::vector<set_effecter_state_field>& stateField) = 0;
64 
65     /** @brief Interface to generate the OEM PDRs
66      *
67      * @param[in] repo - instance of concrete implementation of Repo
68      */
69     virtual void buildOEMPDR(pdr_utils::Repo& repo) = 0;
70 
71     virtual ~Handler() = default;
72 
73   protected:
74     const pldm::utils::DBusHandler* dBusIntf;
75 };
76 
77 } // namespace oem_platform
78 
79 } // namespace responder
80 
81 } // namespace pldm
82