blob: b4614dd9635531de09fd0dcc00a9c9b4ff3df4ef [file] [log] [blame]
Pavithra Barithaya0f74c982020-04-27 02:17:10 -05001#pragma once
2
3#include "xyz/openbmc_project/PLDM/PDR/server.hpp"
4
George Liuc453e162022-12-21 17:16:23 +08005#include <libpldm/pdr.h>
6#include <libpldm/platform.h>
7
Pavithra Barithaya0f74c982020-04-27 02:17:10 -05008#include <sdbusplus/bus.hpp>
9#include <sdbusplus/server/object.hpp>
Pavithra Barithaya0f74c982020-04-27 02:17:10 -050010
George Liu6492f522020-06-16 10:34:05 +080011#include <vector>
Pavithra Barithaya0f74c982020-04-27 02:17:10 -050012
13namespace pldm
14{
15namespace dbus_api
16{
17
Patrick Williams84b790c2022-07-22 19:26:56 -050018using PdrIntf = sdbusplus::server::object_t<
Pavithra Barithaya0f74c982020-04-27 02:17:10 -050019 sdbusplus::xyz::openbmc_project::PLDM::server::PDR>;
20
21/** @class Pdr
22 * @brief OpenBMC PLDM.PDR Implementation
23 * @details A concrete implementation for the
24 * xyz.openbmc_project.PLDM.PDR DBus APIs.
25 */
26class Pdr : public PdrIntf
27{
28 public:
29 Pdr() = delete;
30 Pdr(const Pdr&) = delete;
31 Pdr& operator=(const Pdr&) = delete;
32 Pdr(Pdr&&) = delete;
33 Pdr& operator=(Pdr&&) = delete;
34 virtual ~Pdr() = default;
35
36 /** @brief Constructor to put object onto bus at a dbus path.
37 * @param[in] bus - Bus to attach to.
38 * @param[in] path - Path to attach at.
39 * @param[in] repo - pointer to BMC's primary PDR repo
40 */
Patrick Williams84b790c2022-07-22 19:26:56 -050041 Pdr(sdbusplus::bus_t& bus, const std::string& path, const pldm_pdr* repo) :
42 PdrIntf(bus, path.c_str()), pdrRepo(repo){};
Pavithra Barithaya0f74c982020-04-27 02:17:10 -050043
44 /** @brief Implementation for PdrIntf.FindStateEffecterPDR
45 * @param[in] tid - PLDM terminus ID.
46 * @param[in] entityID - entity that can be associated with PLDM State set.
47 * @param[in] stateSetId - value that identifies PLDM State set.
48 */
49 std::vector<std::vector<uint8_t>>
50 findStateEffecterPDR(uint8_t tid, uint16_t entityID,
51 uint16_t stateSetId) override;
52
Deepak Kodihallifaf096f2020-06-04 12:17:47 -050053 /** @brief Implementation for PdrIntf.FindStateSensorPDR
54 * @param[in] tid - PLDM terminus ID.
55 * @param[in] entityID - entity that can be associated with PLDM State set.
56 * @param[in] stateSetId - value that identifies PLDM State set.
57 */
58 std::vector<std::vector<uint8_t>>
Chicago Duan738e4d82020-05-28 16:39:19 +080059 findStateSensorPDR(uint8_t tid, uint16_t entityID,
60 uint16_t stateSetId) override;
Deepak Kodihallifaf096f2020-06-04 12:17:47 -050061
Pavithra Barithaya0f74c982020-04-27 02:17:10 -050062 private:
63 /** @brief pointer to BMC's primary PDR repo */
64 const pldm_pdr* pdrRepo;
65};
66
67} // namespace dbus_api
68} // namespace pldm