xref: /openbmc/pldm/pldmd/dbus_impl_pdr.cpp (revision ade5f9b1)
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 #include <iostream>
10 
11 using namespace sdbusplus::xyz::openbmc_project::Common::Error;
12 
13 namespace pldm
14 {
15 namespace dbus_api
16 {
17 
18 std::vector<std::vector<uint8_t>> Pdr::findStateEffecterPDR(uint8_t tid,
19                                                             uint16_t entityID,
20                                                             uint16_t stateSetId)
21 {
22     auto pdrs =
23         pldm::utils::findStateEffecterPDR(tid, entityID, stateSetId, pdrRepo);
24 
25     if (pdrs.empty())
26     {
27         throw ResourceNotFound();
28     }
29 
30     return pdrs;
31 }
32 
33 std::vector<std::vector<uint8_t>>
34     Pdr::findStateSensorPDR(uint8_t tid, uint16_t entityID, uint16_t stateSetId)
35 {
36     auto pdrs =
37         pldm::utils::findStateSensorPDR(tid, entityID, stateSetId, pdrRepo);
38     if (pdrs.empty())
39     {
40         throw ResourceNotFound();
41     }
42     return pdrs;
43 }
44 } // namespace dbus_api
45 } // namespace pldm
46