blob: b5790c9bd60056bdb89e05f6cdf133f1d6ae8eec [file]
#include "fw-update/activation.hpp"
#include "fw-update/update_manager.hpp"
namespace pldm
{
namespace fw_update
{
ActivationIntf::Activations Activation::activation(
ActivationIntf::Activations value)
{
if (value == ActivationIntf::Activations::Activating)
{
if (ActivationIntf::activation() != ActivationIntf::Activations::Ready)
{
return ActivationIntf::activation();
}
deleteImpl.reset();
updateManager->activatePackage();
}
else if (value == ActivationIntf::Activations::Active ||
value == ActivationIntf::Activations::Failed)
{
if (!deleteImpl)
{
deleteImpl = std::make_unique<Delete>(bus, objPath, updateManager);
}
}
return ActivationIntf::activation(value);
}
void Delete::delete_()
{
updateManager->resetActivationState();
}
} // namespace fw_update
} // namespace pldm