use new sdbusplus match constructors

Change-Id: Ib2dc2b482448422c8497da3af269047288f2159a
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/item_updater.cpp b/item_updater.cpp
index 9427414..59c07f2 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -16,18 +16,13 @@
 
 using namespace phosphor::logging;
 
-int ItemUpdater::createActivation(sd_bus_message* msg,
-                                  void* userData,
-                                  sd_bus_error* retErr)
+void ItemUpdater::createActivation(sdbusplus::message::message& msg)
 {
-    auto* updater = static_cast<ItemUpdater*>(userData);
-    auto m = sdbusplus::message::message(msg);
-
     sdbusplus::message::object_path objPath;
     std::map<std::string,
-        std::map<std::string,
-        sdbusplus::message::variant<std::string>>> interfaces;
-    m.read(objPath, interfaces);
+             std::map<std::string,
+                      sdbusplus::message::variant<std::string>>> interfaces;
+    msg.read(objPath, interfaces);
     std::string path(std::move(objPath));
 
     for (const auto& intf : interfaces)
@@ -42,13 +37,12 @@
             if (!property.first.compare("Purpose"))
             {
                 // Only process the BMC images
-                std::string value = sdbusplus::message::variant_ns::get <
-                                    std::string > (property.second);
-                if (value.compare(convertForMessage(server::Version::
-                                                    VersionPurpose::
-                                                    BMC).c_str()))
+                auto value = sdbusplus::message::variant_ns::get<std::string>(
+                        property.second);
+                if (value !=
+                    convertForMessage(server::Version::VersionPurpose::BMC))
                 {
-                    return 0;
+                    return;
                 }
             }
         }
@@ -60,25 +54,24 @@
     {
         log<level::ERR>("No version id found in object path",
                         entry("OBJPATH=%s", path));
-        return -1;
+        return;
     }
 
     auto versionId = path.substr(pos + 1);
 
-    if (updater->activations.find(versionId) == updater->activations.end())
+    if (activations.find(versionId) == activations.end())
     {
         // For now set all BMC code versions to active
-        auto activationState = server::Activation::Activations::Active;
+        constexpr auto activationState =
+                server::Activation::Activations::Active;
 
-        updater->activations.insert(std::make_pair(
-                                        versionId,
-                                        std::make_unique<Activation>(
-                                            updater->bus,
-                                            path,
-                                            versionId,
-                                            activationState)));
+        activations.insert(
+                std::make_pair(
+                        versionId,
+                        std::make_unique<Activation>(
+                                bus, path, versionId, activationState)));
     }
-    return 0;
+    return;
 }
 
 } // namespace updater
diff --git a/item_updater.hpp b/item_updater.hpp
index 1a36226..e9bea6f 100644
--- a/item_updater.hpp
+++ b/item_updater.hpp
@@ -10,6 +10,8 @@
 namespace updater
 {
 
+namespace MatchRules = sdbusplus::bus::match::rules;
+
 /** @class ItemUpdater
  *  @brief Manages the activation of the BMC version items.
  */
@@ -31,24 +33,22 @@
                     bus(bus),
                     versionMatch(
                             bus,
-                           "type='signal',"
-                           "member='InterfacesAdded',"
-                           "path='/xyz/openbmc_project/software',"
-                           "interface='org.freedesktop.DBus.ObjectManager'",
-                            createActivation,
-                            this) {};
+                            MatchRules::interfacesAdded() +
+                            MatchRules::path("/xyz/openbmc_project/software"),
+                            std::bind(
+                                    std::mem_fn(&ItemUpdater::createActivation),
+                                    this,
+                                    std::placeholders::_1))
+        {
+        };
 
     private:
         /** @brief Callback function for Software.Version match.
          *  @details Creates an Activation dbus object.
          *
          * @param[in]  msg       - Data associated with subscribed signal
-         * @param[in]  userData  - Pointer to this object instance
-         * @param[out] retError  - Required param
          */
-        static int createActivation(sd_bus_message* msg,
-                                    void* userData,
-                                    sd_bus_error* retError);
+        void createActivation(sdbusplus::message::message& msg);
 
         /** @brief Persistent sdbusplus DBus bus connection. */
         sdbusplus::bus::bus& bus;
@@ -58,7 +58,7 @@
         std::map<std::string, std::unique_ptr<Activation>> activations;
 
         /** @brief sdbusplus signal match for Software.Version */
-        sdbusplus::server::match::match versionMatch;
+        sdbusplus::bus::match_t versionMatch;
 
 };