Add activation, item_updater and version
Implement part of functions of Activation, ItemUpdater and Version.
Tested: Upload a dummy PSU tarball, and verify the activation object is
created with expected ExtendedVersion, and the object is deleted
when Delete is invoked.
Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I7b9d29f46914ace93d27a715b32c80957e88a0aa
diff --git a/src/activation.hpp b/src/activation.hpp
new file mode 100644
index 0000000..6ba2b75
--- /dev/null
+++ b/src/activation.hpp
@@ -0,0 +1,83 @@
+#pragma once
+
+#include "config.h"
+
+#include <sdbusplus/server.hpp>
+#include <xyz/openbmc_project/Software/Activation/server.hpp>
+#include <xyz/openbmc_project/Software/ExtendedVersion/server.hpp>
+
+namespace phosphor
+{
+namespace software
+{
+namespace updater
+{
+
+using ActivationInherit = sdbusplus::server::object::object<
+ sdbusplus::xyz::openbmc_project::Software::server::ExtendedVersion,
+ sdbusplus::xyz::openbmc_project::Software::server::Activation>;
+
+/** @class Activation
+ * @brief OpenBMC activation software management implementation.
+ * @details A concrete implementation for
+ * xyz.openbmc_project.Software.Activation DBus API.
+ */
+class Activation : public ActivationInherit
+{
+ public:
+ /** @brief Constructs Activation Software Manager
+ *
+ * @param[in] bus - The Dbus bus object
+ * @param[in] path - The Dbus object path
+ * @param[in] versionId - The software version id
+ * @param[in] extVersion - The extended version
+ * @param[in] activationStatus - The status of Activation
+ */
+ Activation(sdbusplus::bus::bus& bus, const std::string& path,
+ const std::string& versionId, const std::string& extVersion,
+ sdbusplus::xyz::openbmc_project::Software::server::Activation::
+ Activations activationStatus) :
+ ActivationInherit(bus, path.c_str(), true),
+ bus(bus), path(path), versionId(versionId)
+ {
+ // Set Properties.
+ extendedVersion(extVersion);
+ activation(activationStatus);
+
+ // Emit deferred signal.
+ emit_object_added();
+ }
+
+ /** @brief Overloaded Activation property setter function
+ *
+ * @param[in] value - One of Activation::Activations
+ *
+ * @return Success or exception thrown
+ */
+ Activations activation(Activations value) override;
+
+ /** @brief Activation */
+ using ActivationInherit::activation;
+
+ /** @brief Overloaded requestedActivation property setter function
+ *
+ * @param[in] value - One of Activation::RequestedActivations
+ *
+ * @return Success or exception thrown
+ */
+ RequestedActivations
+ requestedActivation(RequestedActivations value) override;
+
+ /** @brief Persistent sdbusplus DBus bus connection */
+ sdbusplus::bus::bus& bus;
+
+ /** @brief Persistent DBus object path */
+ std::string path;
+
+ /** @brief Version id */
+ std::string versionId;
+};
+
+} // namespace updater
+} // namespace software
+} // namespace phosphor