Cleanup the code related to emit_interface_added

sdbusplus now supports action::emit_interface_added() when an object is
constructed, so the code that manually invokes emit_interface_added()
could be cleaned up and use the above action instead.

Tested:Tested on fp5280g2, and psu update is normal.

Signed-off-by: Albert Zhang <zhanghaodi@inspur.com>
Change-Id: I0ca12a0941c1d45c860478c6f0d72675668de653
diff --git a/src/activation.hpp b/src/activation.hpp
index bc95065..95fe069 100644
--- a/src/activation.hpp
+++ b/src/activation.hpp
@@ -46,27 +46,20 @@
      */
     ActivationBlocksTransition(sdbusplus::bus::bus& bus,
                                const std::string& path) :
-        ActivationBlocksTransitionInherit(bus, path.c_str(), true),
-        bus(bus), path(path)
+        ActivationBlocksTransitionInherit(bus, path.c_str(),
+                                          action::emit_interface_added),
+        bus(bus)
     {
-        std::vector<std::string> interfaces({interface});
-        bus.emit_interfaces_added(path.c_str(), interfaces);
         enableRebootGuard();
     }
 
     ~ActivationBlocksTransition()
     {
-        std::vector<std::string> interfaces({interface});
-        bus.emit_interfaces_removed(path.c_str(), interfaces);
         disableRebootGuard();
     }
 
   private:
-    // TODO Remove once openbmc/openbmc#1975 is resolved
-    static constexpr auto interface =
-        "xyz.openbmc_project.Software.ActivationBlocksTransition";
     sdbusplus::bus::bus& bus;
-    std::string path;
 
     /** @brief Enables a Guard that blocks any BMC reboot commands */
     void enableRebootGuard();
@@ -87,25 +80,11 @@
      * @param[in] path   - The Dbus object path
      */
     ActivationProgress(sdbusplus::bus::bus& bus, const std::string& path) :
-        ActivationProgressInherit(bus, path.c_str(), true), bus(bus), path(path)
+        ActivationProgressInherit(bus, path.c_str(),
+                                  action::emit_interface_added)
     {
         progress(0);
-        std::vector<std::string> interfaces({interface});
-        bus.emit_interfaces_added(path.c_str(), interfaces);
     }
-
-    ~ActivationProgress()
-    {
-        std::vector<std::string> interfaces({interface});
-        bus.emit_interfaces_removed(path.c_str(), interfaces);
-    }
-
-  private:
-    // TODO Remove once openbmc/openbmc#1975 is resolved
-    static constexpr auto interface =
-        "xyz.openbmc_project.Software.ActivationProgress";
-    sdbusplus::bus::bus& bus;
-    std::string path;
 };
 
 using ActivationInherit = sdbusplus::server::object::object<
diff --git a/src/version.hpp b/src/version.hpp
index e26bb31..2f72189 100644
--- a/src/version.hpp
+++ b/src/version.hpp
@@ -40,17 +40,9 @@
      */
     Delete(sdbusplus::bus::bus& bus, const std::string& path,
            Version& version) :
-        DeleteInherit(bus, path.c_str(), true),
-        version(version), bus(bus), path(path)
+        DeleteInherit(bus, path.c_str(), action::emit_interface_added),
+        version(version)
     {
-        std::vector<std::string> interfaces({interface});
-        bus.emit_interfaces_added(path.c_str(), interfaces);
-    }
-
-    ~Delete()
-    {
-        std::vector<std::string> interfaces({interface});
-        bus.emit_interfaces_removed(path.c_str(), interfaces);
     }
 
     /**
@@ -63,10 +55,6 @@
   private:
     /** @brief The Version Object. */
     Version& version;
-
-    static constexpr auto interface = "xyz.openbmc_project.Object.Delete";
-    sdbusplus::bus::bus& bus;
-    std::string path;
 };
 
 /** @class Version