11521f6d1SDeepak Kodihalli #include "dbus_impl_pdr.hpp" 21521f6d1SDeepak Kodihalli 3d130e1a3SDeepak Kodihalli #include "common/utils.hpp" 41521f6d1SDeepak Kodihalli #include "xyz/openbmc_project/Common/error.hpp" 51521f6d1SDeepak Kodihalli 6*c453e164SGeorge Liu #include <libpldm/pdr.h> 7*c453e164SGeorge Liu #include <libpldm/pldm_types.h> 8*c453e164SGeorge Liu 91521f6d1SDeepak Kodihalli #include <iostream> 101521f6d1SDeepak Kodihalli 111521f6d1SDeepak Kodihalli using namespace sdbusplus::xyz::openbmc_project::Common::Error; 121521f6d1SDeepak Kodihalli 131521f6d1SDeepak Kodihalli namespace pldm 141521f6d1SDeepak Kodihalli { 151521f6d1SDeepak Kodihalli namespace dbus_api 161521f6d1SDeepak Kodihalli { 171521f6d1SDeepak Kodihalli 181521f6d1SDeepak Kodihalli std::vector<std::vector<uint8_t>> Pdr::findStateEffecterPDR(uint8_t tid, 191521f6d1SDeepak Kodihalli uint16_t entityID, 201521f6d1SDeepak Kodihalli uint16_t stateSetId) 211521f6d1SDeepak Kodihalli { 221521f6d1SDeepak Kodihalli auto pdrs = 231521f6d1SDeepak Kodihalli pldm::utils::findStateEffecterPDR(tid, entityID, stateSetId, pdrRepo); 241521f6d1SDeepak Kodihalli 251521f6d1SDeepak Kodihalli if (pdrs.empty()) 261521f6d1SDeepak Kodihalli { 271521f6d1SDeepak Kodihalli throw ResourceNotFound(); 281521f6d1SDeepak Kodihalli } 291521f6d1SDeepak Kodihalli 301521f6d1SDeepak Kodihalli return pdrs; 311521f6d1SDeepak Kodihalli } 321521f6d1SDeepak Kodihalli 331521f6d1SDeepak Kodihalli std::vector<std::vector<uint8_t>> 341521f6d1SDeepak Kodihalli Pdr::findStateSensorPDR(uint8_t tid, uint16_t entityID, uint16_t stateSetId) 351521f6d1SDeepak Kodihalli { 361521f6d1SDeepak Kodihalli auto pdrs = 371521f6d1SDeepak Kodihalli pldm::utils::findStateSensorPDR(tid, entityID, stateSetId, pdrRepo); 381521f6d1SDeepak Kodihalli if (pdrs.empty()) 391521f6d1SDeepak Kodihalli { 401521f6d1SDeepak Kodihalli throw ResourceNotFound(); 411521f6d1SDeepak Kodihalli } 421521f6d1SDeepak Kodihalli return pdrs; 431521f6d1SDeepak Kodihalli } 441521f6d1SDeepak Kodihalli } // namespace dbus_api 451521f6d1SDeepak Kodihalli } // namespace pldm 46