Gunnar Mills | ec1b41c | 2017-05-02 12:20:36 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Saqib Khan | b077470 | 2017-05-23 16:02:41 -0500 | [diff] [blame] | 3 | #include <sdbusplus/server.hpp> |
Gunnar Mills | ec1b41c | 2017-05-02 12:20:36 -0500 | [diff] [blame] | 4 | #include <xyz/openbmc_project/Software/Activation/server.hpp> |
Saqib Khan | b077470 | 2017-05-23 16:02:41 -0500 | [diff] [blame] | 5 | #include <xyz/openbmc_project/Software/ActivationBlocksTransition/server.hpp> |
Saqib Khan | 4c1aec0 | 2017-07-06 11:46:13 -0500 | [diff] [blame^] | 6 | #include "xyz/openbmc_project/Software/RedundancyPriority/server.hpp" |
Gunnar Mills | ec1b41c | 2017-05-02 12:20:36 -0500 | [diff] [blame] | 7 | |
| 8 | namespace phosphor |
| 9 | { |
| 10 | namespace software |
| 11 | { |
| 12 | namespace updater |
| 13 | { |
| 14 | |
| 15 | using ActivationInherit = sdbusplus::server::object::object< |
| 16 | sdbusplus::xyz::openbmc_project::Software::server::Activation>; |
Saqib Khan | b077470 | 2017-05-23 16:02:41 -0500 | [diff] [blame] | 17 | using ActivationBlocksTransitionInherit = sdbusplus::server::object::object< |
| 18 | sdbusplus::xyz::openbmc_project::Software::server::ActivationBlocksTransition>; |
Saqib Khan | 4c1aec0 | 2017-07-06 11:46:13 -0500 | [diff] [blame^] | 19 | using RedundancyPriorityInherit = sdbusplus::server::object::object< |
| 20 | sdbusplus::xyz::openbmc_project::Software::server::RedundancyPriority>; |
| 21 | |
| 22 | class ItemUpdater; |
| 23 | class Activation; |
| 24 | class RedundancyPriority; |
| 25 | |
| 26 | /** @class RedundancyPriority |
| 27 | * @brief OpenBMC RedundancyPriority implementation |
| 28 | * @details A concrete implementation for |
| 29 | * xyz.openbmc_project.Software.RedundancyPriority DBus API. |
| 30 | */ |
| 31 | class RedundancyPriority : public RedundancyPriorityInherit |
| 32 | { |
| 33 | public: |
| 34 | /** @brief Constructs RedundancyPriority. |
| 35 | * |
| 36 | * @param[in] bus - The Dbus bus object |
| 37 | * @param[in] path - The Dbus object path |
| 38 | * @param[in] parent - Parent object. |
| 39 | * @param[in] value - The redundancyPriority value |
| 40 | */ |
| 41 | RedundancyPriority(sdbusplus::bus::bus& bus, |
| 42 | const std::string& path, |
| 43 | Activation& parent, |
| 44 | uint8_t value) : |
| 45 | RedundancyPriorityInherit(bus, |
| 46 | path.c_str(), true), |
| 47 | parent(parent) |
| 48 | { |
| 49 | // Set Property |
| 50 | priority(value); |
| 51 | // Emit deferred signal. |
| 52 | emit_object_added(); |
| 53 | } |
| 54 | |
| 55 | /** @brief Overloaded Priority property set function |
| 56 | * |
| 57 | * @param[in] value - uint8_t |
| 58 | * |
| 59 | * @return Success or exception thrown |
| 60 | */ |
| 61 | uint8_t priority(uint8_t value) override; |
| 62 | |
| 63 | /** @brief Priority property get function |
| 64 | * |
| 65 | * @returns uint8_t - The Priority value |
| 66 | */ |
| 67 | using RedundancyPriorityInherit::priority; |
| 68 | |
| 69 | /** @brief Parent Object. */ |
| 70 | Activation& parent; |
| 71 | }; |
Saqib Khan | b077470 | 2017-05-23 16:02:41 -0500 | [diff] [blame] | 72 | |
| 73 | /** @class ActivationBlocksTransition |
| 74 | * @brief OpenBMC ActivationBlocksTransition implementation. |
| 75 | * @details A concrete implementation for |
| 76 | * xyz.openbmc_project.Software.ActivationBlocksTransition DBus API. |
| 77 | */ |
| 78 | class ActivationBlocksTransition : public ActivationBlocksTransitionInherit |
| 79 | { |
| 80 | public: |
| 81 | /** @brief Constructs ActivationBlocksTransition. |
| 82 | * |
| 83 | * @param[in] bus - The Dbus bus object |
| 84 | * @param[in] path - The Dbus object path |
| 85 | */ |
| 86 | ActivationBlocksTransition(sdbusplus::bus::bus& bus, |
| 87 | const std::string& path) : |
| 88 | ActivationBlocksTransitionInherit(bus, path.c_str()) {} |
| 89 | }; |
Gunnar Mills | ec1b41c | 2017-05-02 12:20:36 -0500 | [diff] [blame] | 90 | |
| 91 | /** @class Activation |
| 92 | * @brief OpenBMC activation software management implementation. |
| 93 | * @details A concrete implementation for |
| 94 | * xyz.openbmc_project.Software.Activation DBus API. |
| 95 | */ |
| 96 | class Activation : public ActivationInherit |
| 97 | { |
| 98 | public: |
| 99 | /** @brief Constructs Activation Software Manager |
| 100 | * |
| 101 | * @param[in] bus - The Dbus bus object |
| 102 | * @param[in] path - The Dbus object path |
Saqib Khan | 4c1aec0 | 2017-07-06 11:46:13 -0500 | [diff] [blame^] | 103 | * @param[in] parent - Parent object. |
Gunnar Mills | 2ce7da2 | 2017-05-04 15:37:56 -0500 | [diff] [blame] | 104 | * @param[in] versionId - The software version id |
| 105 | * @param[in] activationStatus - The status of Activation |
Gunnar Mills | ec1b41c | 2017-05-02 12:20:36 -0500 | [diff] [blame] | 106 | */ |
Gunnar Mills | 2ce7da2 | 2017-05-04 15:37:56 -0500 | [diff] [blame] | 107 | Activation(sdbusplus::bus::bus& bus, const std::string& path, |
Saqib Khan | 4c1aec0 | 2017-07-06 11:46:13 -0500 | [diff] [blame^] | 108 | ItemUpdater& parent, |
Gunnar Mills | 2ce7da2 | 2017-05-04 15:37:56 -0500 | [diff] [blame] | 109 | std::string& versionId, |
| 110 | sdbusplus::xyz::openbmc_project::Software:: |
| 111 | server::Activation::Activations activationStatus) : |
| 112 | ActivationInherit(bus, path.c_str(), true), |
| 113 | bus(bus), |
| 114 | path(path), |
Saqib Khan | 4c1aec0 | 2017-07-06 11:46:13 -0500 | [diff] [blame^] | 115 | parent(parent), |
Gunnar Mills | 2ce7da2 | 2017-05-04 15:37:56 -0500 | [diff] [blame] | 116 | versionId(versionId) |
| 117 | { |
| 118 | // Set Properties. |
| 119 | activation(activationStatus); |
| 120 | // Emit deferred signal. |
| 121 | emit_object_added(); |
| 122 | } |
| 123 | |
Saqib Khan | b077470 | 2017-05-23 16:02:41 -0500 | [diff] [blame] | 124 | /** @brief Overloaded Activation property setter function |
| 125 | * |
| 126 | * @param[in] value - One of Activation::Activations |
| 127 | * |
| 128 | * @return Success or exception thrown |
| 129 | */ |
| 130 | Activations activation(Activations value) override; |
| 131 | |
| 132 | /** @brief Overloaded requestedActivation property setter function |
| 133 | * |
| 134 | * @param[in] value - One of Activation::RequestedActivations |
| 135 | * |
| 136 | * @return Success or exception thrown |
| 137 | */ |
| 138 | RequestedActivations requestedActivation(RequestedActivations value) |
| 139 | override; |
| 140 | |
Gunnar Mills | 2ce7da2 | 2017-05-04 15:37:56 -0500 | [diff] [blame] | 141 | /** @brief Persistent sdbusplus DBus bus connection */ |
| 142 | sdbusplus::bus::bus& bus; |
| 143 | |
| 144 | /** @brief Persistent DBus object path */ |
| 145 | std::string path; |
| 146 | |
Saqib Khan | 4c1aec0 | 2017-07-06 11:46:13 -0500 | [diff] [blame^] | 147 | /** @brief Parent Object. */ |
| 148 | ItemUpdater& parent; |
| 149 | |
Gunnar Mills | 2ce7da2 | 2017-05-04 15:37:56 -0500 | [diff] [blame] | 150 | /** @brief Version id */ |
| 151 | std::string versionId; |
Saqib Khan | b077470 | 2017-05-23 16:02:41 -0500 | [diff] [blame] | 152 | |
| 153 | /** @brief Persistent ActivationBlocksTransition dbus object */ |
| 154 | std::unique_ptr<ActivationBlocksTransition> activationBlocksTransition; |
Saqib Khan | 4c1aec0 | 2017-07-06 11:46:13 -0500 | [diff] [blame^] | 155 | |
| 156 | /** @brief Persistent RedundancyPriority dbus object */ |
| 157 | std::unique_ptr<RedundancyPriority> redundancyPriority; |
Gunnar Mills | ec1b41c | 2017-05-02 12:20:36 -0500 | [diff] [blame] | 158 | }; |
| 159 | |
| 160 | } // namespace updater |
| 161 | } // namespace software |
| 162 | } // namespace phosphor |