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