xref: /openbmc/pldm/host-bmc/dbus/cable.hpp (revision b40f4f8f)
1 #pragma once
2 
3 #include <sdbusplus/bus.hpp>
4 #include <sdbusplus/server.hpp>
5 #include <sdbusplus/server/object.hpp>
6 #include <xyz/openbmc_project/Inventory/Item/Cable/server.hpp>
7 
8 #include <string>
9 
10 namespace pldm
11 {
12 namespace dbus
13 {
14 
15 using ItemCable = sdbusplus::server::object_t<
16     sdbusplus::xyz::openbmc_project::Inventory::Item::server::Cable>;
17 
18 /**
19  * @class Cable
20  * @brief Dbus support for cable interface and attributes
21  */
22 class Cable : public ItemCable
23 {
24   public:
25     Cable() = delete;
26     ~Cable() = default;
27     Cable(const Cable&) = delete;
28     Cable& operator=(const Cable&) = delete;
29 
Cable(sdbusplus::bus_t & bus,const std::string & objPath)30     Cable(sdbusplus::bus_t& bus, const std::string& objPath) :
31         ItemCable(bus, objPath.c_str())
32     {
33         // cable objects does not need to be store in serialized memory
34     }
35 
36     /** Get length of the cable in meters */
37     double length() const override;
38 
39     /** Set length of the cable in meters */
40     double length(double value) override;
41 
42     /** Get string used to provide the type of
43           a cable, such as optical or coppervalue */
44     std::string cableTypeDescription() const override;
45 
46     /** Set Cable type description */
47     std::string cableTypeDescription(std::string value) override;
48 };
49 
50 } // namespace dbus
51 } // namespace pldm
52