xref: /openbmc/pldm/pldmd/dbus_impl_pdr.cpp (revision 16c2a0a03e5daac77e204eb99e00711490fb6e26)
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 
6c453e164SGeorge Liu #include <libpldm/pdr.h>
7c453e164SGeorge Liu #include <libpldm/pldm_types.h>
8c453e164SGeorge Liu 
91521f6d1SDeepak Kodihalli using namespace sdbusplus::xyz::openbmc_project::Common::Error;
101521f6d1SDeepak Kodihalli 
111521f6d1SDeepak Kodihalli namespace pldm
121521f6d1SDeepak Kodihalli {
131521f6d1SDeepak Kodihalli namespace dbus_api
141521f6d1SDeepak Kodihalli {
151521f6d1SDeepak Kodihalli 
findStateEffecterPDR(uint8_t tid,uint16_t entityID,uint16_t stateSetId)16*16c2a0a0SPatrick Williams std::vector<std::vector<uint8_t>> Pdr::findStateEffecterPDR(
17*16c2a0a0SPatrick Williams     uint8_t tid, uint16_t entityID, uint16_t stateSetId)
181521f6d1SDeepak Kodihalli {
19*16c2a0a0SPatrick Williams     auto pdrs =
20*16c2a0a0SPatrick Williams         pldm::utils::findStateEffecterPDR(tid, entityID, stateSetId, pdrRepo);
211521f6d1SDeepak Kodihalli 
221521f6d1SDeepak Kodihalli     if (pdrs.empty())
231521f6d1SDeepak Kodihalli     {
241521f6d1SDeepak Kodihalli         throw ResourceNotFound();
251521f6d1SDeepak Kodihalli     }
261521f6d1SDeepak Kodihalli 
271521f6d1SDeepak Kodihalli     return pdrs;
281521f6d1SDeepak Kodihalli }
291521f6d1SDeepak Kodihalli 
301521f6d1SDeepak Kodihalli std::vector<std::vector<uint8_t>>
findStateSensorPDR(uint8_t tid,uint16_t entityID,uint16_t stateSetId)311521f6d1SDeepak Kodihalli     Pdr::findStateSensorPDR(uint8_t tid, uint16_t entityID, uint16_t stateSetId)
321521f6d1SDeepak Kodihalli {
33*16c2a0a0SPatrick Williams     auto pdrs =
34*16c2a0a0SPatrick Williams         pldm::utils::findStateSensorPDR(tid, entityID, stateSetId, pdrRepo);
351521f6d1SDeepak Kodihalli     if (pdrs.empty())
361521f6d1SDeepak Kodihalli     {
371521f6d1SDeepak Kodihalli         throw ResourceNotFound();
381521f6d1SDeepak Kodihalli     }
391521f6d1SDeepak Kodihalli     return pdrs;
401521f6d1SDeepak Kodihalli }
411521f6d1SDeepak Kodihalli } // namespace dbus_api
421521f6d1SDeepak Kodihalli } // namespace pldm
43