Remove Configuration interface prefix from utils APIs
This eliminates some repetitive verbosity from daemons that handle a lot
of different sensor types (such as hwmontempsensor and psusensor). It
also positions us to more cleanly use a single data structure for both
existing APIs like GetSensorConfiguration() and
setupPropertiesChangedMatches(), as well as upcoming I2C
device-management support.
Tested: hwmontempsensor and adcsensor on romed8hm3 continue to behave as
they did previously.
Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Change-Id: I9d80475ca4160c8d2ff0afab942709496d51238d
diff --git a/src/Utils.cpp b/src/Utils.cpp
index cf9ff75..7b33cb7 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -142,6 +142,7 @@
ManagedObjectType& resp, bool useCache)
{
static ManagedObjectType managedObj;
+ std::string typeIntf = configInterfaceName(type);
if (!useCache)
{
@@ -169,7 +170,7 @@
{
for (const auto& [intf, cfg] : pathPair.second)
{
- if (intf.starts_with(type))
+ if (intf.starts_with(typeIntf))
{
resp.emplace(pathPair);
break;
@@ -705,7 +706,8 @@
auto match = std::make_unique<sdbusplus::bus::match_t>(
static_cast<sdbusplus::bus_t&>(bus),
"type='signal',member='PropertiesChanged',path_namespace='" +
- std::string(inventoryPath) + "',arg0namespace='" + type + "'",
+ std::string(inventoryPath) + "',arg0namespace='" +
+ configInterfaceName(type) + "'",
handler);
matches.emplace_back(std::move(match));
}