version: Added erase callback and delete method
Added erase callback, and delete method
as part of implementing image Object.Delete
to delete images.
Change-Id: If3251138c79e05693217fa3ae3f5b238e9c61df4
Signed-off-by: Leonel Gonzalez <lgonzalez@us.ibm.com>
diff --git a/activation.hpp b/activation.hpp
index f550e37..41d055e 100644
--- a/activation.hpp
+++ b/activation.hpp
@@ -142,6 +142,9 @@
*/
Activations activation(Activations value) override;
+ /** @brief Activation */
+ using ActivationInherit::activation;
+
/** @brief Overloaded requestedActivation property setter function
*
* @param[in] value - One of Activation::RequestedActivations
diff --git a/version.cpp b/version.cpp
index 24f201c..c7fab30 100644
--- a/version.cpp
+++ b/version.cpp
@@ -101,6 +101,14 @@
return version;
}
+void Version::delete_()
+{
+ if (eraseCallback)
+ {
+ eraseCallback(getId(version()));
+ }
+}
+
} // namespace manager
} // namespace software
} // namepsace phosphor
diff --git a/version.hpp b/version.hpp
index 0144873..fcd57eb 100755
--- a/version.hpp
+++ b/version.hpp
@@ -2,7 +2,9 @@
#include <sdbusplus/bus.hpp>
#include "xyz/openbmc_project/Software/Version/server.hpp"
+#include "xyz/openbmc_project/Object/Delete/server.hpp"
#include "xyz/openbmc_project/Common/FilePath/server.hpp"
+#include <functional>
namespace phosphor
{
@@ -11,8 +13,11 @@
namespace manager
{
+typedef std::function<void(std::string)> eraseFunc;
+
using VersionInherit = sdbusplus::server::object::object<
sdbusplus::xyz::openbmc_project::Software::server::Version,
+ sdbusplus::xyz::openbmc_project::Object::server::Delete,
sdbusplus::xyz::openbmc_project::Common::server::FilePath>;
/** @class Version
@@ -67,6 +72,18 @@
* @return The version identifier.
*/
static std::string getBMCVersion();
+
+ /**
+ * @brief Delete the d-bus object and image.
+ */
+ void delete_() override;
+
+
+ private:
+ /**
+ * @brief The parent's erase callback.
+ */
+ eraseFunc eraseCallback;
};
} // namespace manager