Create Constructor for BMC Activation

- Create Activation Block Transition
- Create override functions so that actions can be taken
  based on the value that the properties are being set to.
- Create ActivationBlockTransition when the Activating
  property is set to Activating. Remove it when the property
  is set to anything else.

Change-Id: Id48d049cca54ae0bcbed6afe41e67e20e6a5e44c
Signed-off-by: Saqib Khan <khansa@us.ibm.com>
diff --git a/activation.cpp b/activation.cpp
new file mode 100644
index 0000000..3f8795c
--- /dev/null
+++ b/activation.cpp
@@ -0,0 +1,54 @@
+#include "activation.hpp"
+
+namespace phosphor
+{
+namespace software
+{
+namespace updater
+{
+
+namespace softwareServer = sdbusplus::xyz::openbmc_project::Software::server;
+
+auto Activation::activation(Activations value) ->
+        Activations
+{
+    if (value == softwareServer::Activation::Activations::Activating)
+    {
+        if (!activationBlocksTransition)
+        {
+            activationBlocksTransition =
+                      std::make_unique<ActivationBlocksTransition>(
+                                bus,
+                                path);
+        }
+    }
+    else
+    {
+        activationBlocksTransition.reset(nullptr);
+    }
+    return softwareServer::Activation::activation(value);
+}
+
+auto Activation::requestedActivation(RequestedActivations value) ->
+        RequestedActivations
+{
+    if ((value == softwareServer::Activation::RequestedActivations::Active) &&
+        (softwareServer::Activation::requestedActivation() !=
+                  softwareServer::Activation::RequestedActivations::Active))
+    {
+        if ((softwareServer::Activation::activation() ==
+                    softwareServer::Activation::Activations::Ready) ||
+            (softwareServer::Activation::activation() ==
+                    softwareServer::Activation::Activations::Failed))
+        {
+            Activation::activation(
+                    softwareServer::Activation::Activations::Activating);
+
+        }
+    }
+    return softwareServer::Activation::requestedActivation(value);
+}
+
+} // namespace updater
+} // namespace software
+} // namespace phosphor