blob: 16f55646ac9911b36a87e67f2650977c1d4c2291 [file] [log] [blame]
Pavithra Barithaya0f74c982020-04-27 02:17:10 -05001#pragma once
2
3#include "xyz/openbmc_project/PLDM/PDR/server.hpp"
4
5#include <sdbusplus/bus.hpp>
6#include <sdbusplus/server/object.hpp>
7#include <vector>
8
9#include "libpldm/pdr.h"
10#include "libpldm/platform.h"
11
12namespace pldm
13{
14namespace dbus_api
15{
16
17using PdrIntf = sdbusplus::server::object::object<
18 sdbusplus::xyz::openbmc_project::PLDM::server::PDR>;
19
20/** @class Pdr
21 * @brief OpenBMC PLDM.PDR Implementation
22 * @details A concrete implementation for the
23 * xyz.openbmc_project.PLDM.PDR DBus APIs.
24 */
25class Pdr : public PdrIntf
26{
27 public:
28 Pdr() = delete;
29 Pdr(const Pdr&) = delete;
30 Pdr& operator=(const Pdr&) = delete;
31 Pdr(Pdr&&) = delete;
32 Pdr& operator=(Pdr&&) = delete;
33 virtual ~Pdr() = default;
34
35 /** @brief Constructor to put object onto bus at a dbus path.
36 * @param[in] bus - Bus to attach to.
37 * @param[in] path - Path to attach at.
38 * @param[in] repo - pointer to BMC's primary PDR repo
39 */
40 Pdr(sdbusplus::bus::bus& bus, const std::string& path,
41 const pldm_pdr* repo) :
42 PdrIntf(bus, path.c_str(), repo),
43 pdrRepo(repo){};
44
45 /** @brief Implementation for PdrIntf.FindStateEffecterPDR
46 * @param[in] tid - PLDM terminus ID.
47 * @param[in] entityID - entity that can be associated with PLDM State set.
48 * @param[in] stateSetId - value that identifies PLDM State set.
49 */
50 std::vector<std::vector<uint8_t>>
51 findStateEffecterPDR(uint8_t tid, uint16_t entityID,
52 uint16_t stateSetId) override;
53
Deepak Kodihallifaf096f2020-06-04 12:17:47 -050054 /** @brief Implementation for PdrIntf.FindStateSensorPDR
55 * @param[in] tid - PLDM terminus ID.
56 * @param[in] entityID - entity that can be associated with PLDM State set.
57 * @param[in] stateSetId - value that identifies PLDM State set.
58 */
59 std::vector<std::vector<uint8_t>>
Deepak Kodihalli5c634072020-06-04 12:47:21 -050060 findStateSensorPDR(uint8_t /*tid*/, uint16_t /*entityID*/,
John Wangd6631b42020-06-05 15:03:30 +080061 uint16_t /*stateSetId*/) override
Deepak Kodihallifaf096f2020-06-04 12:17:47 -050062 {
63 return {};
64 }
65
Pavithra Barithaya0f74c982020-04-27 02:17:10 -050066 private:
67 /** @brief pointer to BMC's primary PDR repo */
68 const pldm_pdr* pdrRepo;
69};
70
71} // namespace dbus_api
72} // namespace pldm