Refactor PropertiesChanged handler setup
Most sensor daemons had pretty much the same duplicated open-coded
pattern for setting up PropertiesChanged signal matches; introduce a
helper function to reduce the duplication and make things more readable.
Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Change-Id: I803a21eea2f6d7fc71b50d54bb8fd57a104f3349
diff --git a/src/NVMeSensorMain.cpp b/src/NVMeSensorMain.cpp
index dc85f70..ae86e6b 100644
--- a/src/NVMeSensorMain.cpp
+++ b/src/NVMeSensorMain.cpp
@@ -254,12 +254,10 @@
});
};
- sdbusplus::bus::match_t configMatch(
- static_cast<sdbusplus::bus_t&>(*systemBus),
- "type='signal',member='PropertiesChanged',path_namespace='" +
- std::string(inventoryPath) + "',arg0namespace='" +
- std::string(NVMeSensor::configType) + "'",
- eventHandler);
+ std::vector<std::unique_ptr<sdbusplus::bus::match_t>> matches =
+ setupPropertiesChangedMatches(
+ *systemBus, std::to_array<const char*>({NVMeSensor::configType}),
+ eventHandler);
// Watch for entity-manager to remove configuration interfaces
// so the corresponding sensors can be removed.