chassis: use latest sdbusplus match APIs

Change-Id: I1be75ab5af362d683be76afb47d8c411f0f4a4b2
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/chassis_state_manager.cpp b/chassis_state_manager.cpp
index 13abbb9..e1a2e0f 100644
--- a/chassis_state_manager.cpp
+++ b/chassis_state_manager.cpp
@@ -149,23 +149,15 @@
 
 }
 
-int Chassis::sysStateChangeSignal(sd_bus_message *msg, void *userData,
-                                  sd_bus_error *retError)
-{
-    return static_cast<Chassis*>(userData)->sysStateChange(msg, retError);
-}
-
-int Chassis::sysStateChange(sd_bus_message* msg,
-                            sd_bus_error* retError)
+int Chassis::sysStateChange(sdbusplus::message::message& msg)
 {
     uint32_t newStateID {};
     sdbusplus::message::object_path newStateObjPath;
     std::string newStateUnit{};
     std::string newStateResult{};
 
-    auto sdPlusMsg = sdbusplus::message::message(msg);
     //Read the msg and populate each variable
-    sdPlusMsg.read(newStateID, newStateObjPath, newStateUnit, newStateResult);
+    msg.read(newStateID, newStateObjPath, newStateUnit, newStateResult);
 
     if((newStateUnit == CHASSIS_STATE_POWEROFF_TGT) &&
        (newStateResult == "done") &&
diff --git a/chassis_state_manager.hpp b/chassis_state_manager.hpp
index 0c6d5a1..132e30e 100644
--- a/chassis_state_manager.hpp
+++ b/chassis_state_manager.hpp
@@ -1,5 +1,6 @@
 #pragma once
 
+#include <functional>
 #include <sdbusplus/bus.hpp>
 #include "xyz/openbmc_project/State/Chassis/server.hpp"
 
@@ -10,13 +11,16 @@
 namespace manager
 {
 
+using ChassisInherit = sdbusplus::server::object::object<
+        sdbusplus::xyz::openbmc_project::State::server::Chassis>;
+namespace sdbusRule = sdbusplus::bus::match::rules;
+
 /** @class Chassis
  *  @brief OpenBMC chassis state management implementation.
  *  @details A concrete implementation for xyz.openbmc_project.State.Chassis
  *  DBus API.
  */
-class Chassis : public sdbusplus::server::object::object<
-                sdbusplus::xyz::openbmc_project::State::server::Chassis>
+class Chassis : public ChassisInherit
 {
     public:
         /** @brief Constructs Chassis State Manager
@@ -32,17 +36,16 @@
         Chassis(sdbusplus::bus::bus& bus,
                 const char* busName,
                 const char* objPath) :
-                sdbusplus::server::object::object<
-                    sdbusplus::xyz::openbmc_project::State::server::Chassis>(
-                            bus, objPath, true),
+                ChassisInherit(bus, objPath, true),
                 bus(bus),
                 systemdSignals(bus,
-                               "type='signal',"
-                               "member='JobRemoved',"
-                               "path='/org/freedesktop/systemd1',"
-                               "interface='org.freedesktop.systemd1.Manager'",
-                                sysStateChangeSignal,
-                                this)
+                               sdbusRule::type::signal() +
+                               sdbusRule::member("JobRemoved") +
+                               sdbusRule::path("/org/freedesktop/systemd1") +
+                               sdbusRule::interface(
+                                    "org.freedesktop.systemd1.Manager"),
+                               std::bind(std::mem_fn(&Chassis::sysStateChange),
+                                         this, std::placeholders::_1))
         {
             subscribeToSystemdSignals();
 
@@ -92,36 +95,21 @@
          **/
         bool stateActive(const std::string& target);
 
-        /** @brief Callback function on systemd state changes
-         *
-         * Will just do a call into the appropriate object for processing
-         *
-         * @param[in]  msg       - Data associated with subscribed signal
-         * @param[in]  userData  - Pointer to this object instance
-         * @param[out] retError  - Not used but required with signal API
-         *
-         */
-        static int sysStateChangeSignal(sd_bus_message* msg,
-                                        void* userData,
-                                        sd_bus_error* retError);
-
         /** @brief Check if systemd state change is relevant to this object
          *
          * Instance specific interface to handle the detected systemd state
          * change
          *
          * @param[in]  msg       - Data associated with subscribed signal
-         * @param[out] retError  - Not used but required with signal API
          *
          */
-        int sysStateChange(sd_bus_message* msg,
-                           sd_bus_error* retError);
+        int sysStateChange(sdbusplus::message::message& msg);
 
         /** @brief Persistent sdbusplus DBus connection. */
         sdbusplus::bus::bus& bus;
 
         /** @brief Used to subscribe to dbus systemd signals **/
-        sdbusplus::server::match::match systemdSignals;
+        sdbusplus::bus::match_t systemdSignals;
 };
 
 } // namespace manager