blob: 3f8795c6228fd5a1d00d8aa6f9f6f77d0e97b028 [file] [log] [blame]
Saqib Khanb0774702017-05-23 16:02:41 -05001#include "activation.hpp"
2
3namespace phosphor
4{
5namespace software
6{
7namespace updater
8{
9
10namespace softwareServer = sdbusplus::xyz::openbmc_project::Software::server;
11
12auto 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
32auto 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