common: use aserver property constructor

Since PDI gen code now [1] supports constructing DBus interfaces with
property values, simplify the common code to use that API.

Tested: Unit Tests Pass

References:
[1] https://gerrit.openbmc.org/c/openbmc/sdbusplus/+/78790

Change-Id: Ic29531b391f8609377105dbcbac2e8a55b29746c
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/common/include/software.hpp b/common/include/software.hpp
index 849e959..a8477bf 100644
--- a/common/include/software.hpp
+++ b/common/include/software.hpp
@@ -20,20 +20,6 @@
 namespace phosphor::software
 {
 
-// Need to declare this class to initialize the protected members of our base
-// class. This prevents "Conditional jump or move depends on uninitialised
-// value(s)" when properties are updated for the first time.
-class SoftwareActivationProgress :
-    private sdbusplus::aserver::xyz::openbmc_project::software::
-        ActivationProgress<Software>
-{
-  public:
-    SoftwareActivationProgress(sdbusplus::async::context& ctx,
-                               const char* objPath);
-
-    void setProgress(int progressArg);
-};
-
 using SoftwareActivationBlocksTransition = sdbusplus::aserver::xyz::
     openbmc_project::software::ActivationBlocksTransition<Software>;
 
@@ -95,8 +81,9 @@
     // and is deleted again afterwards.
     // This member is public since the device specific update function
     // needs to update the progress.
-    std::unique_ptr<SoftwareActivationProgress> softwareActivationProgress =
-        nullptr;
+    std::unique_ptr<sdbusplus::aserver::xyz::openbmc_project::software::
+                        ActivationProgress<Software>>
+        softwareActivationProgress = nullptr;
 
     static long int getRandomId();
 
diff --git a/common/src/device.cpp b/common/src/device.cpp
index b71b2cb..1e4b810 100644
--- a/common/src/device.cpp
+++ b/common/src/device.cpp
@@ -9,6 +9,7 @@
 #include <sdbusplus/async/context.hpp>
 #include <sdbusplus/bus.hpp>
 #include <xyz/openbmc_project/Association/Definitions/server.hpp>
+#include <xyz/openbmc_project/Software/ActivationProgress/aserver.hpp>
 #include <xyz/openbmc_project/State/Host/client.hpp>
 
 #include <utility>
@@ -17,6 +18,13 @@
 
 using namespace phosphor::software::device;
 
+using SoftwareActivationProgress =
+    sdbusplus::aserver::xyz::openbmc_project::software::ActivationProgress<
+        phosphor::software::Software>;
+
+using SoftwareActivationProgressProperties = sdbusplus::common::xyz::
+    openbmc_project::software::ActivationProgress::properties_t;
+
 const auto applyTimeImmediate = sdbusplus::common::xyz::openbmc_project::
     software::ApplyTime::RequestedApplyTimes::Immediate;
 
@@ -145,7 +153,7 @@
         return false;
     }
 
-    softwarePending->softwareActivationProgress->setProgress(progress);
+    softwarePending->softwareActivationProgress->progress(progress);
 
     return true;
 }
@@ -162,7 +170,8 @@
     std::string objPath = softwarePending->objectPath;
 
     softwarePending->softwareActivationProgress =
-        std::make_unique<SoftwareActivationProgress>(ctx, objPath.c_str());
+        std::make_unique<SoftwareActivationProgress>(
+            ctx, objPath.c_str(), SoftwareActivationProgressProperties{0});
 
     softwarePending->setActivationBlocksTransition(true);
 
diff --git a/common/src/software.cpp b/common/src/software.cpp
index 5fb8a8a..3a02763 100644
--- a/common/src/software.cpp
+++ b/common/src/software.cpp
@@ -19,36 +19,18 @@
 
 const static std::string baseObjPathSoftware = "/xyz/openbmc_project/software/";
 
-SoftwareActivationProgress::SoftwareActivationProgress(
-    sdbusplus::async::context& ctx, const char* objPath) :
-    ActivationProgress(ctx, objPath)
-{
-    // This prevents "Conditional jump or move depends on uninitialised
-    // value(s)"
-    // when properties are updated for the first time
-    progress_ = 0;
-}
-
-void SoftwareActivationProgress::setProgress(int progressArg)
-{
-    progress(progressArg);
-}
-
 Software::Software(sdbusplus::async::context& ctx, Device& parent) :
     Software(ctx, parent, getRandomSoftwareId(parent))
 {}
 
 Software::Software(sdbusplus::async::context& ctx, Device& parent,
                    const std::string& swid) :
-    SoftwareActivation(ctx, (baseObjPathSoftware + swid).c_str()),
+    SoftwareActivation(ctx, (baseObjPathSoftware + swid).c_str(),
+                       Activation::properties_t{Activations::NotReady,
+                                                RequestedActivations::None}),
     objectPath(baseObjPathSoftware + swid), parentDevice(parent), swid(swid),
     ctx(ctx)
 {
-    // initialize the members of our base class to prevent
-    // "Conditional jump or move depends on uninitialised value(s)"
-    activation_ = Activations::NotReady;
-    requested_activation_ = RequestedActivations::None;
-
     std::string objPath = baseObjPathSoftware + swid;
 
     debug("{SWID}: created dbus interfaces on path {OBJPATH}", "SWID", swid,
@@ -88,17 +70,18 @@
     {
         std::string path = objectPath;
         associationDefinitions =
-            std::make_unique<SoftwareAssociationDefinitions>(ctx, path.c_str());
+            std::make_unique<SoftwareAssociationDefinitions>(
+                ctx, path.c_str(),
+                SoftwareAssociationDefinitions::properties_t{{}});
     }
 
-    std::vector<std::tuple<std::string, std::string, std::string>> assocs;
-
     if (endpoint.empty())
     {
-        associationDefinitions->associations(assocs);
         co_return;
     }
 
+    std::vector<std::tuple<std::string, std::string, std::string>> assocs;
+
     if (isRunning)
     {
         debug("{SWID}: creating 'running' association to {OBJPATH}", "SWID",
@@ -126,21 +109,17 @@
 {
     debug("{SWID}: set version {VERSION}", "SWID", swid, "VERSION", versionStr);
 
-    const bool emitSignal = !version;
-
     if (!version)
     {
-        version =
-            std::make_unique<SoftwareVersion>(ctx, objectPath.str.c_str());
+        version = std::make_unique<SoftwareVersion>(
+            ctx, objectPath.str.c_str(),
+            SoftwareVersion::properties_t{versionStr, versionPurpose});
+        version->emit_added();
+        return;
     }
 
     version->version(versionStr);
     version->purpose(versionPurpose);
-
-    if (emitSignal)
-    {
-        version->emit_added();
-    }
 }
 
 SoftwareVersion::VersionPurpose Software::getPurpose()