Correlated properties callback stub
This commit includes stub implementation of utility and other APIs
required to implement the correlated properties callback.
Change-Id: I6c58b6126203cbb70aab5b2a84f8f7b09d83d06e
Signed-off-by: Souvik Roy <souvikroyofficial10@gmail.com>
diff --git a/vpd-manager/include/utility/dbus_utility.hpp b/vpd-manager/include/utility/dbus_utility.hpp
index 3d0ba61..b0a6bc2 100644
--- a/vpd-manager/include/utility/dbus_utility.hpp
+++ b/vpd-manager/include/utility/dbus_utility.hpp
@@ -755,5 +755,38 @@
}
return l_objectPaths;
}
+
+/**
+ * @brief API to get Dbus service name for given connection identifier.
+ *
+ * @param[in] i_connectionId - Dbus connection ID.
+ *
+ * @return On success, returns the DBus service associated with given connection
+ * ID, empty string otherwise.
+ */
+inline std::string getServiceNameFromConnectionId(
+ [[maybe_unused]] const std::string& i_connectionId) noexcept
+{
+ std::string l_serviceName;
+ try
+ {
+ if (i_connectionId.empty())
+ {
+ throw std::runtime_error("Empty connection ID");
+ }
+
+ /* TODO:
+ - get PID corresponding to the connection ID
+ - use PID to get corresponding encoded service name string
+ - decode service name string */
+ }
+ catch (const std::exception& l_ex)
+ {
+ logging::logMessage(
+ "Failed to get service name from connection ID: [" +
+ i_connectionId + "]. error: " + std::string(l_ex.what()));
+ }
+ return l_serviceName;
+}
} // namespace dbusUtility
} // namespace vpd