| #include "activation.hpp" |
| #include "item_updater.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::Active) |
| { |
| redundancyPriority.reset(nullptr); |
| } |
| |
| if (value == softwareServer::Activation::Activations::Activating) |
| { |
| if (!activationBlocksTransition) |
| { |
| activationBlocksTransition = |
| std::make_unique<ActivationBlocksTransition>( |
| bus, |
| path); |
| } |
| |
| //TODO openbmc/openbmc#1756 - Add Logic for Code Update |
| if (!redundancyPriority) |
| { |
| redundancyPriority = |
| std::make_unique<RedundancyPriority>( |
| bus, |
| path, |
| *this, |
| 0); |
| } |
| |
| activationBlocksTransition.reset(nullptr); |
| return softwareServer::Activation::activation( |
| softwareServer::Activation::Activations::Active); |
| } |
| 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); |
| } |
| |
| uint8_t RedundancyPriority::priority(uint8_t value) |
| { |
| parent.parent.freePriority(value); |
| return softwareServer::RedundancyPriority::priority(value); |
| } |
| |
| } // namespace updater |
| } // namespace software |
| } // namespace phosphor |