blob: 0e8026013562287a51059a29231a2624061f1759 [file] [log] [blame]
Adriana Kobylak2d8fa222017-03-15 12:34:32 -05001#pragma once
2
Adriana Kobylak99c8c0e2017-04-17 13:39:11 -05003#include <sdbusplus/server.hpp>
Adriana Kobylak2d8fa222017-03-15 12:34:32 -05004#include <xyz/openbmc_project/Software/Activation/server.hpp>
Adriana Kobylakea9626f2017-04-05 15:37:40 -05005#include <xyz/openbmc_project/Software/ActivationBlocksTransition/server.hpp>
Saqib Khan7254f0e2017-04-10 21:45:37 -05006#include "xyz/openbmc_project/Software/ExtendedVersion/server.hpp"
Saqib Khan942df8a2017-06-01 14:09:27 -05007#include "xyz/openbmc_project/Software/RedundancyPriority/server.hpp"
Adriana Kobylak2d8fa222017-03-15 12:34:32 -05008
9namespace openpower
10{
11namespace software
12{
Adriana Kobylakbefe5ce2017-04-05 15:57:44 -050013namespace updater
Adriana Kobylak2d8fa222017-03-15 12:34:32 -050014{
15
16using ActivationInherit = sdbusplus::server::object::object<
Saqib Khan7254f0e2017-04-10 21:45:37 -050017 sdbusplus::xyz::openbmc_project::Software::server::ExtendedVersion,
Adriana Kobylak2d8fa222017-03-15 12:34:32 -050018 sdbusplus::xyz::openbmc_project::Software::server::Activation>;
Adriana Kobylakea9626f2017-04-05 15:37:40 -050019using ActivationBlocksTransitionInherit = sdbusplus::server::object::object<
20 sdbusplus::xyz::openbmc_project::Software::server::ActivationBlocksTransition>;
Saqib Khan942df8a2017-06-01 14:09:27 -050021using RedundancyPriorityInherit = sdbusplus::server::object::object<
22 sdbusplus::xyz::openbmc_project::Software::server::RedundancyPriority>;
23
24/** @class RedundancyPriority
25 * @brief OpenBMC RedundancyPriority implementation
26 * @details A concrete implementation for
27 * xyz.openbmc_project.Software.RedundancyPriority DBus API.
28 */
29class RedundancyPriority : public RedundancyPriorityInherit
30{
31 public:
32 /** @brief Constructs RedundancyPriority.
33 *
34 * @param[in] bus - The Dbus bus object
35 * @param[in] path - The Dbus object path
36 */
37 RedundancyPriority(sdbusplus::bus::bus& bus,
38 const std::string& path) :
39 RedundancyPriorityInherit(bus,
40 path.c_str(), true)
41 {
42 // Set Property
43 priority(0);
44 // Emit deferred signal.
45 emit_object_added();
46 }
Saqib Khan2021b4c2017-06-07 14:37:36 -050047
48 /** @brief Overloaded Priority property set function
49 *
50 * @param[in] value - uint8_t
51 *
52 * @return Success or exception thrown
53 */
54 uint8_t priority(uint8_t value) override;
Saqib Khan942df8a2017-06-01 14:09:27 -050055};
Adriana Kobylak2d8fa222017-03-15 12:34:32 -050056
Adriana Kobylak99c8c0e2017-04-17 13:39:11 -050057/** @class ActivationBlocksTransition
58 * @brief OpenBMC ActivationBlocksTransition implementation.
59 * @details A concrete implementation for
60 * xyz.openbmc_project.Software.ActivationBlocksTransition DBus API.
61 */
62class ActivationBlocksTransition : public ActivationBlocksTransitionInherit
63{
64 public:
65 /** @brief Constructs ActivationBlocksTransition.
66 *
67 * @param[in] bus - The Dbus bus object
68 * @param[in] path - The Dbus object path
69 */
70 ActivationBlocksTransition(sdbusplus::bus::bus& bus,
71 const std::string& path) :
72 ActivationBlocksTransitionInherit(bus, path.c_str()) {}
73};
74
Adriana Kobylak2d8fa222017-03-15 12:34:32 -050075/** @class Activation
76 * @brief OpenBMC activation software management implementation.
77 * @details A concrete implementation for
78 * xyz.openbmc_project.Software.Activation DBus API.
79 */
80class Activation : public ActivationInherit
81{
82 public:
83 /** @brief Constructs Activation Software Manager
84 *
85 * @param[in] bus - The Dbus bus object
86 * @param[in] path - The Dbus object path
Saqib Khan7254f0e2017-04-10 21:45:37 -050087 * @param[in] versionId - The software version id
88 * @param[in] extVersion - The extended version
Saqib Khana8ade7e2017-04-12 10:27:56 -050089 * @param[in] activationStatus - The status of Activation
Adriana Kobylak2d8fa222017-03-15 12:34:32 -050090 */
Adriana Kobylakbc37a4c2017-04-10 09:45:36 -050091 Activation(sdbusplus::bus::bus& bus, const std::string& path,
Saqib Khan7254f0e2017-04-10 21:45:37 -050092 std::string& versionId,
Saqib Khana8ade7e2017-04-12 10:27:56 -050093 std::string& extVersion,
94 sdbusplus::xyz::openbmc_project::Software::
95 server::Activation::Activations activationStatus) :
Saqib Khan7254f0e2017-04-10 21:45:37 -050096 ActivationInherit(bus, path.c_str(), true),
Adriana Kobylak99c8c0e2017-04-17 13:39:11 -050097 bus(bus),
98 path(path),
Saqib Khan7254f0e2017-04-10 21:45:37 -050099 versionId(versionId)
100 {
101 // Set Properties.
102 extendedVersion(extVersion);
Saqib Khana8ade7e2017-04-12 10:27:56 -0500103 activation(activationStatus);
Saqib Khan7254f0e2017-04-10 21:45:37 -0500104 // Emit deferred signal.
105 emit_object_added();
106 }
Adriana Kobylakbefe5ce2017-04-05 15:57:44 -0500107
108 /** @brief Overloaded Activation property setter function
109 *
110 * @param[in] value - One of Activation::Activations
111 *
112 * @return Success or exception thrown
113 */
114 Activations activation(Activations value) override;
115
116 /** @brief Overloaded requestedActivation property setter function
117 *
118 * @param[in] value - One of Activation::RequestedActivations
119 *
120 * @return Success or exception thrown
121 */
122 RequestedActivations requestedActivation(RequestedActivations value)
123 override;
124
Adriana Kobylak99c8c0e2017-04-17 13:39:11 -0500125 /** @brief Persistent sdbusplus DBus bus connection */
126 sdbusplus::bus::bus& bus;
127
128 /** @brief Persistent DBus object path */
129 std::string path;
130
Adriana Kobylakbc37a4c2017-04-10 09:45:36 -0500131 /** @brief Version id */
132 std::string versionId;
Adriana Kobylak2d8fa222017-03-15 12:34:32 -0500133
Adriana Kobylak99c8c0e2017-04-17 13:39:11 -0500134 /** @brief Persistent ActivationBlocksTransition dbus object */
135 std::unique_ptr<ActivationBlocksTransition> activationBlocksTransition;
Saqib Khan942df8a2017-06-01 14:09:27 -0500136
137 /** @brief Persistent RedundancyPriority dbus object */
138 std::unique_ptr<RedundancyPriority> redundancyPriority;
Adriana Kobylakea9626f2017-04-05 15:37:40 -0500139};
140
Adriana Kobylakbefe5ce2017-04-05 15:57:44 -0500141} // namespace updater
Adriana Kobylak2d8fa222017-03-15 12:34:32 -0500142} // namespace software
143} // namespace openpower
144