pldm: Implement Cable interface
Adding support to host Cable dbus interface.
Based on the PDRs received from remote PLDM terminus,
PLDM hosts the dbus interface based on the entity type.
The Cable interface is defined at [1].
[1]: https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Inventory/Item/Cable.interface.yaml
Change-Id: I23f02387c1d50ce8d9c5921760740760cea2cd47
Signed-off-by: Archana Kakani <archana.kakani@ibm.com>
diff --git a/host-bmc/dbus/custom_dbus.cpp b/host-bmc/dbus/custom_dbus.cpp
index cfe3a42..204c9fa 100644
--- a/host-bmc/dbus/custom_dbus.cpp
+++ b/host-bmc/dbus/custom_dbus.cpp
@@ -98,5 +98,24 @@
}
}
+void CustomDBus::implementCableInterface(const std::string& path)
+{
+ if (!cable.contains(path))
+ {
+ cable.emplace(path, std::make_unique<Cable>(
+ pldm::utils::DBusHandler::getBus(), path));
+ }
+}
+
+void CustomDBus::setCableAttributes(const std::string& path, double length,
+ const std::string& cableDescription)
+{
+ if (cable.contains(path))
+ {
+ cable.at(path)->length(length);
+ cable.at(path)->cableTypeDescription(cableDescription);
+ }
+}
+
} // namespace dbus
} // namespace pldm