xref: /openbmc/pldm/platform-mc/dbus_impl_fru.hpp (revision efa003298c192460b3c9659d9ffe6abd3d08dc9d)
1 #pragma once
2 
3 #include "xyz/openbmc_project/Inventory/Decorator/Asset/server.hpp"
4 #include "xyz/openbmc_project/Inventory/Decorator/AssetTag/server.hpp"
5 #include "xyz/openbmc_project/Inventory/Decorator/Compatible/server.hpp"
6 #include "xyz/openbmc_project/Inventory/Decorator/Revision/server.hpp"
7 #include "xyz/openbmc_project/Inventory/Item/Board/server.hpp"
8 
9 #include <sdbusplus/bus.hpp>
10 #include <sdbusplus/server/object.hpp>
11 
12 #include <map>
13 
14 namespace pldm
15 {
16 namespace dbus_api
17 {
18 
19 using assetserver =
20     sdbusplus::xyz::openbmc_project::Inventory::Decorator::server::Asset;
21 using assettagserver =
22     sdbusplus::xyz::openbmc_project::Inventory::Decorator::server::AssetTag;
23 using revisionserver =
24     sdbusplus::xyz::openbmc_project::Inventory::Decorator::server::Revision;
25 using compatibleserver =
26     sdbusplus::xyz::openbmc_project::Inventory::Decorator::server::Compatible;
27 using boardserver =
28     sdbusplus::xyz::openbmc_project::Inventory::Item::server::Board;
29 
30 using AssetIntf = sdbusplus::server::object_t<assetserver>;
31 using AssetTagIntf = sdbusplus::server::object_t<assettagserver>;
32 using RevisionIntf = sdbusplus::server::object_t<revisionserver>;
33 using CompatibleIntf = sdbusplus::server::object_t<compatibleserver>;
34 using BoardIntf = sdbusplus::server::object_t<boardserver>;
35 
36 /** @class PldmEntityRequester
37  *  @brief OpenBMC PLDM Inventory entity implementation.
38  *  @details A concrete implementation for the PLDM Inventory entity DBus APIs.
39  */
40 class PldmEntityReq :
41     public AssetIntf,
42     public AssetTagIntf,
43     public RevisionIntf,
44     public CompatibleIntf,
45     public BoardIntf
46 {
47   public:
48     PldmEntityReq() = delete;
49     PldmEntityReq(const PldmEntityReq&) = delete;
50     PldmEntityReq& operator=(const PldmEntityReq&) = delete;
51     PldmEntityReq(PldmEntityReq&&) = delete;
52     PldmEntityReq& operator=(PldmEntityReq&&) = delete;
53     virtual ~PldmEntityReq() = default;
54 
55     /** @brief Constructor to put object onto bus at a dbus path.
56      *  @param[in] bus - Bus to attach to.
57      *  @param[in] path - Path to attach at.
58      */
PldmEntityReq(sdbusplus::bus_t & bus,const std::string & path)59     PldmEntityReq(sdbusplus::bus_t& bus, const std::string& path) :
60         AssetIntf(bus, path.c_str()), AssetTagIntf(bus, path.c_str()),
61         RevisionIntf(bus, path.c_str()), CompatibleIntf(bus, path.c_str()),
62         BoardIntf(bus, path.c_str()) {};
63 
64     /** @brief Set value of partNumber in Decorator.Asset */
65     std::string partNumber(std::string value);
66 
67     /** @brief Set value of serialNumber in Decorator.Asset */
68     std::string serialNumber(std::string value);
69 
70     /** @brief Set value of manufacturer in Decorator.Asset */
71     std::string manufacturer(std::string value);
72 
73     /** @brief Set value of buildDate in Decorator.Asset */
74     std::string buildDate(std::string value);
75 
76     /** @brief Set value of model in Decorator.Asset */
77     std::string model(std::string value);
78 
79     /** @brief Set value of subModel in Decorator.Asset */
80     std::string subModel(std::string value);
81 
82     /** @brief Set value of sparePartNumber in Decorator.Asset */
83     std::string sparePartNumber(std::string value);
84 
85     /** @brief Set value of assetTag in Decorator.AssetTag */
86     std::string assetTag(std::string value);
87 
88     /** @brief Set value of version in Decorator.Revision */
89     std::string version(std::string value);
90 
91     /** @brief Set value of names in in Decorator.Compatible */
92     std::vector<std::string> names(std::vector<std::string> values);
93 };
94 
95 } // namespace dbus_api
96 } // namespace pldm
97