blob: 6ba2b750f4c037ad38a9a5331f551cbe4c250fa5 [file] [log] [blame]
#pragma once
#include "config.h"
#include <sdbusplus/server.hpp>
#include <xyz/openbmc_project/Software/Activation/server.hpp>
#include <xyz/openbmc_project/Software/ExtendedVersion/server.hpp>
namespace phosphor
{
namespace software
{
namespace updater
{
using ActivationInherit = sdbusplus::server::object::object<
sdbusplus::xyz::openbmc_project::Software::server::ExtendedVersion,
sdbusplus::xyz::openbmc_project::Software::server::Activation>;
/** @class Activation
* @brief OpenBMC activation software management implementation.
* @details A concrete implementation for
* xyz.openbmc_project.Software.Activation DBus API.
*/
class Activation : public ActivationInherit
{
public:
/** @brief Constructs Activation Software Manager
*
* @param[in] bus - The Dbus bus object
* @param[in] path - The Dbus object path
* @param[in] versionId - The software version id
* @param[in] extVersion - The extended version
* @param[in] activationStatus - The status of Activation
*/
Activation(sdbusplus::bus::bus& bus, const std::string& path,
const std::string& versionId, const std::string& extVersion,
sdbusplus::xyz::openbmc_project::Software::server::Activation::
Activations activationStatus) :
ActivationInherit(bus, path.c_str(), true),
bus(bus), path(path), versionId(versionId)
{
// Set Properties.
extendedVersion(extVersion);
activation(activationStatus);
// Emit deferred signal.
emit_object_added();
}
/** @brief Overloaded Activation property setter function
*
* @param[in] value - One of Activation::Activations
*
* @return Success or exception thrown
*/
Activations activation(Activations value) override;
/** @brief Activation */
using ActivationInherit::activation;
/** @brief Overloaded requestedActivation property setter function
*
* @param[in] value - One of Activation::RequestedActivations
*
* @return Success or exception thrown
*/
RequestedActivations
requestedActivation(RequestedActivations value) override;
/** @brief Persistent sdbusplus DBus bus connection */
sdbusplus::bus::bus& bus;
/** @brief Persistent DBus object path */
std::string path;
/** @brief Version id */
std::string versionId;
};
} // namespace updater
} // namespace software
} // namespace phosphor