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/include/Utils.hpp b/include/Utils.hpp
index fdd1d8d..fb543f4 100644
--- a/include/Utils.hpp
+++ b/include/Utils.hpp
@@ -14,6 +14,7 @@
#include <memory>
#include <optional>
#include <regex>
+#include <span>
#include <string>
#include <tuple>
#include <utility>
@@ -337,3 +338,7 @@
const double& scaleFactor);
void setupManufacturingModeMatch(sdbusplus::asio::connection& conn);
bool getManufacturingMode();
+std::vector<std::unique_ptr<sdbusplus::bus::match_t>>
+ setupPropertiesChangedMatches(
+ sdbusplus::asio::connection& bus, std::span<const char* const> types,
+ const std::function<void(sdbusplus::message_t&)>& handler);