xref: /openbmc/pldm/pldmd/dbus_impl_pdr.cpp (revision 16c2a0a0)
1 #include "dbus_impl_pdr.hpp"
2 
3 #include "common/utils.hpp"
4 #include "xyz/openbmc_project/Common/error.hpp"
5 
6 #include <libpldm/pdr.h>
7 #include <libpldm/pldm_types.h>
8 
9 using namespace sdbusplus::xyz::openbmc_project::Common::Error;
10 
11 namespace pldm
12 {
13 namespace dbus_api
14 {
15 
findStateEffecterPDR(uint8_t tid,uint16_t entityID,uint16_t stateSetId)16 std::vector<std::vector<uint8_t>> Pdr::findStateEffecterPDR(
17     uint8_t tid, uint16_t entityID, uint16_t stateSetId)
18 {
19     auto pdrs =
20         pldm::utils::findStateEffecterPDR(tid, entityID, stateSetId, pdrRepo);
21 
22     if (pdrs.empty())
23     {
24         throw ResourceNotFound();
25     }
26 
27     return pdrs;
28 }
29 
30 std::vector<std::vector<uint8_t>>
findStateSensorPDR(uint8_t tid,uint16_t entityID,uint16_t stateSetId)31     Pdr::findStateSensorPDR(uint8_t tid, uint16_t entityID, uint16_t stateSetId)
32 {
33     auto pdrs =
34         pldm::utils::findStateSensorPDR(tid, entityID, stateSetId, pdrRepo);
35     if (pdrs.empty())
36     {
37         throw ResourceNotFound();
38     }
39     return pdrs;
40 }
41 } // namespace dbus_api
42 } // namespace pldm
43