blob: 09183f1d7f9390fa1d60460e0b5b9d27460be7cc [file] [log] [blame]
Gunnar Millsec1b41c2017-05-02 12:20:36 -05001#pragma once
2
Saqib Khanb0774702017-05-23 16:02:41 -05003#include <sdbusplus/server.hpp>
Gunnar Millsec1b41c2017-05-02 12:20:36 -05004#include <xyz/openbmc_project/Software/Activation/server.hpp>
Saqib Khanb0774702017-05-23 16:02:41 -05005#include <xyz/openbmc_project/Software/ActivationBlocksTransition/server.hpp>
Gunnar Millsec1b41c2017-05-02 12:20:36 -05006
7namespace phosphor
8{
9namespace software
10{
11namespace updater
12{
13
14using ActivationInherit = sdbusplus::server::object::object<
15 sdbusplus::xyz::openbmc_project::Software::server::Activation>;
Saqib Khanb0774702017-05-23 16:02:41 -050016using ActivationBlocksTransitionInherit = sdbusplus::server::object::object<
17 sdbusplus::xyz::openbmc_project::Software::server::ActivationBlocksTransition>;
18
19/** @class ActivationBlocksTransition
20 * @brief OpenBMC ActivationBlocksTransition implementation.
21 * @details A concrete implementation for
22 * xyz.openbmc_project.Software.ActivationBlocksTransition DBus API.
23 */
24class ActivationBlocksTransition : public ActivationBlocksTransitionInherit
25{
26 public:
27 /** @brief Constructs ActivationBlocksTransition.
28 *
29 * @param[in] bus - The Dbus bus object
30 * @param[in] path - The Dbus object path
31 */
32 ActivationBlocksTransition(sdbusplus::bus::bus& bus,
33 const std::string& path) :
34 ActivationBlocksTransitionInherit(bus, path.c_str()) {}
35};
Gunnar Millsec1b41c2017-05-02 12:20:36 -050036
37/** @class Activation
38 * @brief OpenBMC activation software management implementation.
39 * @details A concrete implementation for
40 * xyz.openbmc_project.Software.Activation DBus API.
41 */
42class Activation : public ActivationInherit
43{
44 public:
45 /** @brief Constructs Activation Software Manager
46 *
47 * @param[in] bus - The Dbus bus object
48 * @param[in] path - The Dbus object path
Gunnar Mills2ce7da22017-05-04 15:37:56 -050049 * @param[in] versionId - The software version id
50 * @param[in] activationStatus - The status of Activation
Gunnar Millsec1b41c2017-05-02 12:20:36 -050051 */
Gunnar Mills2ce7da22017-05-04 15:37:56 -050052 Activation(sdbusplus::bus::bus& bus, const std::string& path,
53 std::string& versionId,
54 sdbusplus::xyz::openbmc_project::Software::
55 server::Activation::Activations activationStatus) :
56 ActivationInherit(bus, path.c_str(), true),
57 bus(bus),
58 path(path),
59 versionId(versionId)
60 {
61 // Set Properties.
62 activation(activationStatus);
63 // Emit deferred signal.
64 emit_object_added();
65 }
66
Saqib Khanb0774702017-05-23 16:02:41 -050067 /** @brief Overloaded Activation property setter function
68 *
69 * @param[in] value - One of Activation::Activations
70 *
71 * @return Success or exception thrown
72 */
73 Activations activation(Activations value) override;
74
75 /** @brief Overloaded requestedActivation property setter function
76 *
77 * @param[in] value - One of Activation::RequestedActivations
78 *
79 * @return Success or exception thrown
80 */
81 RequestedActivations requestedActivation(RequestedActivations value)
82 override;
83
Gunnar Mills2ce7da22017-05-04 15:37:56 -050084 /** @brief Persistent sdbusplus DBus bus connection */
85 sdbusplus::bus::bus& bus;
86
87 /** @brief Persistent DBus object path */
88 std::string path;
89
90 /** @brief Version id */
91 std::string versionId;
Saqib Khanb0774702017-05-23 16:02:41 -050092
93 /** @brief Persistent ActivationBlocksTransition dbus object */
94 std::unique_ptr<ActivationBlocksTransition> activationBlocksTransition;
Gunnar Millsec1b41c2017-05-02 12:20:36 -050095};
96
97} // namespace updater
98} // namespace software
99} // namespace phosphor