Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 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 | |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 10 | namespace responder |
| 11 | { |
| 12 | |
| 13 | namespace oem_platform |
| 14 | { |
| 15 | |
| 16 | class Handler : public CmdHandler |
| 17 | { |
| 18 | public: |
| 19 | Handler(const pldm::utils::DBusHandler* dBusIntf) : dBusIntf(dBusIntf) |
| 20 | {} |
| 21 | |
| 22 | /** @brief Interface to get the state sensor readings requested by pldm |
| 23 | * requester for OEM types. Each specific type should implement a handler |
| 24 | * of it's own |
| 25 | * |
| 26 | * @param[in] entityType - entity type corresponding to the sensor |
| 27 | * @param[in] entityInstance - entity instance number |
| 28 | * @param[in] stateSetId - state set id |
| 29 | * @param[in] compSensorCnt - composite sensor count |
| 30 | * @param[out] stateField - The state field data for each of the states, |
| 31 | * equal to composite sensor count in number |
| 32 | * |
| 33 | * @return - Success or failure in getting the states. Returns failure in |
| 34 | * terms of PLDM completion codes if fetching atleast one state |
| 35 | * fails |
| 36 | */ |
| 37 | virtual int getOemStateSensorReadingsHandler( |
Brad Bishop | 5079ac4 | 2021-08-19 18:35:06 -0400 | [diff] [blame] | 38 | EntityType entityType, pldm::pdr::EntityInstance entityInstance, |
| 39 | pldm::pdr::StateSetId stateSetId, |
| 40 | pldm::pdr::CompositeCount compSensorCnt, |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 41 | std::vector<get_sensor_state_field>& stateField) = 0; |
| 42 | |
| 43 | /** @brief Interface to set the effecter requested by pldm requester |
| 44 | * for OEM types. Each individual oem type should implement |
| 45 | * it's own handler. |
| 46 | * |
| 47 | * @param[in] entityType - entity type corresponding to the effecter id |
| 48 | * @param[in] entityInstance - entity instance |
| 49 | * @param[in] stateSetId - state set id |
| 50 | * @param[in] compEffecterCnt - composite effecter count |
Varsha Kaverappa | 3fbd39e | 2020-09-28 01:40:22 -0500 | [diff] [blame] | 51 | * @param[in] stateField - The state field data for each of the states, |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 52 | * equal to compEffecterCnt in number |
Varsha Kaverappa | 3fbd39e | 2020-09-28 01:40:22 -0500 | [diff] [blame] | 53 | * @param[in] effecterId - Effecter id |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 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 | */ |
Sampa Misra | 3a0e3b9 | 2020-10-21 05:58:00 -0500 | [diff] [blame] | 59 | virtual int oemSetStateEffecterStatesHandler( |
Varsha Kaverappa | 3fbd39e | 2020-09-28 01:40:22 -0500 | [diff] [blame] | 60 | uint16_t entityType, uint16_t entityInstance, uint16_t stateSetId, |
| 61 | uint8_t compEffecterCnt, |
| 62 | std::vector<set_effecter_state_field>& stateField, |
| 63 | uint16_t effecterId) = 0; |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 64 | |
Sagar Srinivas | 78a225a | 2020-08-27 00:52:20 -0500 | [diff] [blame] | 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 | |
Sagar Srinivas | 7f760b3 | 2021-05-12 07:46:56 -0500 | [diff] [blame] | 71 | /** @brief Interface to check if setEventReceiver is sent to host already. |
| 72 | * If sent then then disableWatchDogTimer() would be called to |
| 73 | * disable the watchdog timer */ |
| 74 | virtual void checkAndDisableWatchDog() = 0; |
| 75 | |
Sagar Srinivas | 79669c9 | 2021-04-28 15:43:30 -0500 | [diff] [blame] | 76 | /** @brief Interface to check if the watchdog timer is running |
| 77 | * |
| 78 | * @return - true if watchdog is running, false otherwise |
| 79 | * */ |
| 80 | virtual bool watchDogRunning() = 0; |
| 81 | |
| 82 | /** @brief Interface to reset the watchdog timer */ |
| 83 | virtual void resetWatchDogTimer() = 0; |
| 84 | |
Sagar Srinivas | 7f760b3 | 2021-05-12 07:46:56 -0500 | [diff] [blame] | 85 | /** @brief Interface to disable the watchdog timer */ |
| 86 | virtual void disableWatchDogTimer() = 0; |
| 87 | |
| 88 | /** @brief Interface to keep track of how many times setEventReceiver |
| 89 | * is sent to host */ |
| 90 | virtual void countSetEventReceiver() = 0; |
| 91 | |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 92 | virtual ~Handler() = default; |
| 93 | |
| 94 | protected: |
| 95 | const pldm::utils::DBusHandler* dBusIntf; |
| 96 | }; |
| 97 | |
| 98 | } // namespace oem_platform |
| 99 | |
| 100 | } // namespace responder |
| 101 | |
| 102 | } // namespace pldm |