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 | } |
| 47 | }; |
Adriana Kobylak | 2d8fa22 | 2017-03-15 12:34:32 -0500 | [diff] [blame] | 48 | |
Adriana Kobylak | 99c8c0e | 2017-04-17 13:39:11 -0500 | [diff] [blame] | 49 | /** @class ActivationBlocksTransition |
| 50 | * @brief OpenBMC ActivationBlocksTransition implementation. |
| 51 | * @details A concrete implementation for |
| 52 | * xyz.openbmc_project.Software.ActivationBlocksTransition DBus API. |
| 53 | */ |
| 54 | class ActivationBlocksTransition : public ActivationBlocksTransitionInherit |
| 55 | { |
| 56 | public: |
| 57 | /** @brief Constructs ActivationBlocksTransition. |
| 58 | * |
| 59 | * @param[in] bus - The Dbus bus object |
| 60 | * @param[in] path - The Dbus object path |
| 61 | */ |
| 62 | ActivationBlocksTransition(sdbusplus::bus::bus& bus, |
| 63 | const std::string& path) : |
| 64 | ActivationBlocksTransitionInherit(bus, path.c_str()) {} |
| 65 | }; |
| 66 | |
Adriana Kobylak | 2d8fa22 | 2017-03-15 12:34:32 -0500 | [diff] [blame] | 67 | /** @class Activation |
| 68 | * @brief OpenBMC activation software management implementation. |
| 69 | * @details A concrete implementation for |
| 70 | * xyz.openbmc_project.Software.Activation DBus API. |
| 71 | */ |
| 72 | class Activation : public ActivationInherit |
| 73 | { |
| 74 | public: |
| 75 | /** @brief Constructs Activation Software Manager |
| 76 | * |
| 77 | * @param[in] bus - The Dbus bus object |
| 78 | * @param[in] path - The Dbus object path |
Saqib Khan | 7254f0e | 2017-04-10 21:45:37 -0500 | [diff] [blame] | 79 | * @param[in] versionId - The software version id |
| 80 | * @param[in] extVersion - The extended version |
Saqib Khan | a8ade7e | 2017-04-12 10:27:56 -0500 | [diff] [blame] | 81 | * @param[in] activationStatus - The status of Activation |
Adriana Kobylak | 2d8fa22 | 2017-03-15 12:34:32 -0500 | [diff] [blame] | 82 | */ |
Adriana Kobylak | bc37a4c | 2017-04-10 09:45:36 -0500 | [diff] [blame] | 83 | Activation(sdbusplus::bus::bus& bus, const std::string& path, |
Saqib Khan | 7254f0e | 2017-04-10 21:45:37 -0500 | [diff] [blame] | 84 | std::string& versionId, |
Saqib Khan | a8ade7e | 2017-04-12 10:27:56 -0500 | [diff] [blame] | 85 | std::string& extVersion, |
| 86 | sdbusplus::xyz::openbmc_project::Software:: |
| 87 | server::Activation::Activations activationStatus) : |
Saqib Khan | 7254f0e | 2017-04-10 21:45:37 -0500 | [diff] [blame] | 88 | ActivationInherit(bus, path.c_str(), true), |
Adriana Kobylak | 99c8c0e | 2017-04-17 13:39:11 -0500 | [diff] [blame] | 89 | bus(bus), |
| 90 | path(path), |
Saqib Khan | 7254f0e | 2017-04-10 21:45:37 -0500 | [diff] [blame] | 91 | versionId(versionId) |
| 92 | { |
| 93 | // Set Properties. |
| 94 | extendedVersion(extVersion); |
Saqib Khan | a8ade7e | 2017-04-12 10:27:56 -0500 | [diff] [blame] | 95 | activation(activationStatus); |
Saqib Khan | 7254f0e | 2017-04-10 21:45:37 -0500 | [diff] [blame] | 96 | // Emit deferred signal. |
| 97 | emit_object_added(); |
| 98 | } |
Adriana Kobylak | befe5ce | 2017-04-05 15:57:44 -0500 | [diff] [blame] | 99 | |
| 100 | /** @brief Overloaded Activation property setter function |
| 101 | * |
| 102 | * @param[in] value - One of Activation::Activations |
| 103 | * |
| 104 | * @return Success or exception thrown |
| 105 | */ |
| 106 | Activations activation(Activations value) override; |
| 107 | |
| 108 | /** @brief Overloaded requestedActivation property setter function |
| 109 | * |
| 110 | * @param[in] value - One of Activation::RequestedActivations |
| 111 | * |
| 112 | * @return Success or exception thrown |
| 113 | */ |
| 114 | RequestedActivations requestedActivation(RequestedActivations value) |
| 115 | override; |
| 116 | |
Adriana Kobylak | 99c8c0e | 2017-04-17 13:39:11 -0500 | [diff] [blame] | 117 | /** @brief Persistent sdbusplus DBus bus connection */ |
| 118 | sdbusplus::bus::bus& bus; |
| 119 | |
| 120 | /** @brief Persistent DBus object path */ |
| 121 | std::string path; |
| 122 | |
Adriana Kobylak | bc37a4c | 2017-04-10 09:45:36 -0500 | [diff] [blame] | 123 | /** @brief Version id */ |
| 124 | std::string versionId; |
Adriana Kobylak | 2d8fa22 | 2017-03-15 12:34:32 -0500 | [diff] [blame] | 125 | |
Adriana Kobylak | 99c8c0e | 2017-04-17 13:39:11 -0500 | [diff] [blame] | 126 | /** @brief Persistent ActivationBlocksTransition dbus object */ |
| 127 | std::unique_ptr<ActivationBlocksTransition> activationBlocksTransition; |
Saqib Khan | 942df8a | 2017-06-01 14:09:27 -0500 | [diff] [blame] | 128 | |
| 129 | /** @brief Persistent RedundancyPriority dbus object */ |
| 130 | std::unique_ptr<RedundancyPriority> redundancyPriority; |
Adriana Kobylak | ea9626f | 2017-04-05 15:37:40 -0500 | [diff] [blame] | 131 | }; |
| 132 | |
Adriana Kobylak | befe5ce | 2017-04-05 15:57:44 -0500 | [diff] [blame] | 133 | } // namespace updater |
Adriana Kobylak | 2d8fa22 | 2017-03-15 12:34:32 -0500 | [diff] [blame] | 134 | } // namespace software |
| 135 | } // namespace openpower |
| 136 | |