Saqib Khan | b077470 | 2017-05-23 16:02:41 -0500 | [diff] [blame] | 1 | #include "activation.hpp" |
| 2 | |
| 3 | namespace phosphor |
| 4 | { |
| 5 | namespace software |
| 6 | { |
| 7 | namespace updater |
| 8 | { |
| 9 | |
| 10 | namespace softwareServer = sdbusplus::xyz::openbmc_project::Software::server; |
| 11 | |
| 12 | auto Activation::activation(Activations value) -> |
| 13 | Activations |
| 14 | { |
| 15 | if (value == softwareServer::Activation::Activations::Activating) |
| 16 | { |
| 17 | if (!activationBlocksTransition) |
| 18 | { |
| 19 | activationBlocksTransition = |
| 20 | std::make_unique<ActivationBlocksTransition>( |
| 21 | bus, |
| 22 | path); |
| 23 | } |
| 24 | } |
| 25 | else |
| 26 | { |
| 27 | activationBlocksTransition.reset(nullptr); |
| 28 | } |
| 29 | return softwareServer::Activation::activation(value); |
| 30 | } |
| 31 | |
| 32 | auto Activation::requestedActivation(RequestedActivations value) -> |
| 33 | RequestedActivations |
| 34 | { |
| 35 | if ((value == softwareServer::Activation::RequestedActivations::Active) && |
| 36 | (softwareServer::Activation::requestedActivation() != |
| 37 | softwareServer::Activation::RequestedActivations::Active)) |
| 38 | { |
| 39 | if ((softwareServer::Activation::activation() == |
| 40 | softwareServer::Activation::Activations::Ready) || |
| 41 | (softwareServer::Activation::activation() == |
| 42 | softwareServer::Activation::Activations::Failed)) |
| 43 | { |
| 44 | Activation::activation( |
| 45 | softwareServer::Activation::Activations::Activating); |
| 46 | |
| 47 | } |
| 48 | } |
| 49 | return softwareServer::Activation::requestedActivation(value); |
| 50 | } |
| 51 | |
| 52 | } // namespace updater |
| 53 | } // namespace software |
| 54 | } // namespace phosphor |