Adriana Kobylak | 2d8fa22 | 2017-03-15 12:34:32 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Adriana Kobylak | 99c8c0e | 2017-04-17 13:39:11 -0500 | [diff] [blame] | 3 | #include <sdbusplus/server.hpp> |
Adriana Kobylak | 2d8fa22 | 2017-03-15 12:34:32 -0500 | [diff] [blame] | 4 | #include <xyz/openbmc_project/Software/Activation/server.hpp> |
Adriana Kobylak | ea9626f | 2017-04-05 15:37:40 -0500 | [diff] [blame] | 5 | #include <xyz/openbmc_project/Software/ActivationBlocksTransition/server.hpp> |
Saqib Khan | 7254f0e | 2017-04-10 21:45:37 -0500 | [diff] [blame] | 6 | #include "xyz/openbmc_project/Software/ExtendedVersion/server.hpp" |
Saqib Khan | 942df8a | 2017-06-01 14:09:27 -0500 | [diff] [blame] | 7 | #include "xyz/openbmc_project/Software/RedundancyPriority/server.hpp" |
Adriana Kobylak | 2d8fa22 | 2017-03-15 12:34:32 -0500 | [diff] [blame] | 8 | |
| 9 | namespace openpower |
| 10 | { |
| 11 | namespace software |
| 12 | { |
Adriana Kobylak | befe5ce | 2017-04-05 15:57:44 -0500 | [diff] [blame] | 13 | namespace updater |
Adriana Kobylak | 2d8fa22 | 2017-03-15 12:34:32 -0500 | [diff] [blame] | 14 | { |
| 15 | |
| 16 | using ActivationInherit = sdbusplus::server::object::object< |
Saqib Khan | 7254f0e | 2017-04-10 21:45:37 -0500 | [diff] [blame] | 17 | sdbusplus::xyz::openbmc_project::Software::server::ExtendedVersion, |
Adriana Kobylak | 2d8fa22 | 2017-03-15 12:34:32 -0500 | [diff] [blame] | 18 | sdbusplus::xyz::openbmc_project::Software::server::Activation>; |
Adriana Kobylak | ea9626f | 2017-04-05 15:37:40 -0500 | [diff] [blame] | 19 | using ActivationBlocksTransitionInherit = sdbusplus::server::object::object< |
| 20 | sdbusplus::xyz::openbmc_project::Software::server::ActivationBlocksTransition>; |
Saqib Khan | 942df8a | 2017-06-01 14:09:27 -0500 | [diff] [blame] | 21 | using 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 | */ |
| 29 | class 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 Khan | 2021b4c | 2017-06-07 14:37:36 -0500 | [diff] [blame] | 47 | |
| 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 Khan | 942df8a | 2017-06-01 14:09:27 -0500 | [diff] [blame] | 55 | }; |
Adriana Kobylak | 2d8fa22 | 2017-03-15 12:34:32 -0500 | [diff] [blame] | 56 | |
Adriana Kobylak | 99c8c0e | 2017-04-17 13:39:11 -0500 | [diff] [blame] | 57 | /** @class ActivationBlocksTransition |
| 58 | * @brief OpenBMC ActivationBlocksTransition implementation. |
| 59 | * @details A concrete implementation for |
| 60 | * xyz.openbmc_project.Software.ActivationBlocksTransition DBus API. |
| 61 | */ |
| 62 | class 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 Kobylak | 2d8fa22 | 2017-03-15 12:34:32 -0500 | [diff] [blame] | 75 | /** @class Activation |
| 76 | * @brief OpenBMC activation software management implementation. |
| 77 | * @details A concrete implementation for |
| 78 | * xyz.openbmc_project.Software.Activation DBus API. |
| 79 | */ |
| 80 | class 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 Khan | 7254f0e | 2017-04-10 21:45:37 -0500 | [diff] [blame] | 87 | * @param[in] versionId - The software version id |
| 88 | * @param[in] extVersion - The extended version |
Saqib Khan | a8ade7e | 2017-04-12 10:27:56 -0500 | [diff] [blame] | 89 | * @param[in] activationStatus - The status of Activation |
Adriana Kobylak | 2d8fa22 | 2017-03-15 12:34:32 -0500 | [diff] [blame] | 90 | */ |
Adriana Kobylak | bc37a4c | 2017-04-10 09:45:36 -0500 | [diff] [blame] | 91 | Activation(sdbusplus::bus::bus& bus, const std::string& path, |
Saqib Khan | 7254f0e | 2017-04-10 21:45:37 -0500 | [diff] [blame] | 92 | std::string& versionId, |
Saqib Khan | a8ade7e | 2017-04-12 10:27:56 -0500 | [diff] [blame] | 93 | std::string& extVersion, |
| 94 | sdbusplus::xyz::openbmc_project::Software:: |
| 95 | server::Activation::Activations activationStatus) : |
Saqib Khan | 7254f0e | 2017-04-10 21:45:37 -0500 | [diff] [blame] | 96 | ActivationInherit(bus, path.c_str(), true), |
Adriana Kobylak | 99c8c0e | 2017-04-17 13:39:11 -0500 | [diff] [blame] | 97 | bus(bus), |
| 98 | path(path), |
Saqib Khan | 7254f0e | 2017-04-10 21:45:37 -0500 | [diff] [blame] | 99 | versionId(versionId) |
| 100 | { |
| 101 | // Set Properties. |
| 102 | extendedVersion(extVersion); |
Saqib Khan | a8ade7e | 2017-04-12 10:27:56 -0500 | [diff] [blame] | 103 | activation(activationStatus); |
Saqib Khan | 7254f0e | 2017-04-10 21:45:37 -0500 | [diff] [blame] | 104 | // Emit deferred signal. |
| 105 | emit_object_added(); |
| 106 | } |
Adriana Kobylak | befe5ce | 2017-04-05 15:57:44 -0500 | [diff] [blame] | 107 | |
| 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 Kobylak | 99c8c0e | 2017-04-17 13:39:11 -0500 | [diff] [blame] | 125 | /** @brief Persistent sdbusplus DBus bus connection */ |
| 126 | sdbusplus::bus::bus& bus; |
| 127 | |
| 128 | /** @brief Persistent DBus object path */ |
| 129 | std::string path; |
| 130 | |
Adriana Kobylak | bc37a4c | 2017-04-10 09:45:36 -0500 | [diff] [blame] | 131 | /** @brief Version id */ |
| 132 | std::string versionId; |
Adriana Kobylak | 2d8fa22 | 2017-03-15 12:34:32 -0500 | [diff] [blame] | 133 | |
Adriana Kobylak | 99c8c0e | 2017-04-17 13:39:11 -0500 | [diff] [blame] | 134 | /** @brief Persistent ActivationBlocksTransition dbus object */ |
| 135 | std::unique_ptr<ActivationBlocksTransition> activationBlocksTransition; |
Saqib Khan | 942df8a | 2017-06-01 14:09:27 -0500 | [diff] [blame] | 136 | |
| 137 | /** @brief Persistent RedundancyPriority dbus object */ |
| 138 | std::unique_ptr<RedundancyPriority> redundancyPriority; |
Adriana Kobylak | ea9626f | 2017-04-05 15:37:40 -0500 | [diff] [blame] | 139 | }; |
| 140 | |
Adriana Kobylak | befe5ce | 2017-04-05 15:57:44 -0500 | [diff] [blame] | 141 | } // namespace updater |
Adriana Kobylak | 2d8fa22 | 2017-03-15 12:34:32 -0500 | [diff] [blame] | 142 | } // namespace software |
| 143 | } // namespace openpower |
| 144 | |