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/MCUTempSensor.cpp b/src/MCUTempSensor.cpp
index b856bdb..39b7259 100644
--- a/src/MCUTempSensor.cpp
+++ b/src/MCUTempSensor.cpp
@@ -296,16 +296,10 @@
});
};
- sdbusplus::bus::match_t configMatch(
- static_cast<sdbusplus::bus_t&>(*systemBus),
- "type='signal',member='PropertiesChanged',"
- "path_namespace='" +
- std::string(inventoryPath) +
- "',"
- "arg0namespace='" +
- configInterface + "'",
- eventHandler);
-
+ std::vector<std::unique_ptr<sdbusplus::bus::match_t>> matches =
+ setupPropertiesChangedMatches(
+ *systemBus, std::to_array<const char*>({configInterface}),
+ eventHandler);
setupManufacturingModeMatch(*systemBus);
io.run();
return 0;