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> |
Gunnar Mills | ec1b41c | 2017-05-02 12:20:36 -0500 | [diff] [blame] | 6 | |
| 7 | namespace phosphor |
| 8 | { |
| 9 | namespace software |
| 10 | { |
| 11 | namespace updater |
| 12 | { |
| 13 | |
| 14 | using ActivationInherit = sdbusplus::server::object::object< |
| 15 | sdbusplus::xyz::openbmc_project::Software::server::Activation>; |
Saqib Khan | b077470 | 2017-05-23 16:02:41 -0500 | [diff] [blame] | 16 | using 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 | */ |
| 24 | class 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 Mills | ec1b41c | 2017-05-02 12:20:36 -0500 | [diff] [blame] | 36 | |
| 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 | */ |
| 42 | class 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 Mills | 2ce7da2 | 2017-05-04 15:37:56 -0500 | [diff] [blame] | 49 | * @param[in] versionId - The software version id |
| 50 | * @param[in] activationStatus - The status of Activation |
Gunnar Mills | ec1b41c | 2017-05-02 12:20:36 -0500 | [diff] [blame] | 51 | */ |
Gunnar Mills | 2ce7da2 | 2017-05-04 15:37:56 -0500 | [diff] [blame] | 52 | 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 Khan | b077470 | 2017-05-23 16:02:41 -0500 | [diff] [blame] | 67 | /** @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 Mills | 2ce7da2 | 2017-05-04 15:37:56 -0500 | [diff] [blame] | 84 | /** @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 Khan | b077470 | 2017-05-23 16:02:41 -0500 | [diff] [blame] | 92 | |
| 93 | /** @brief Persistent ActivationBlocksTransition dbus object */ |
| 94 | std::unique_ptr<ActivationBlocksTransition> activationBlocksTransition; |
Gunnar Mills | ec1b41c | 2017-05-02 12:20:36 -0500 | [diff] [blame] | 95 | }; |
| 96 | |
| 97 | } // namespace updater |
| 98 | } // namespace software |
| 99 | } // namespace phosphor |