Lei YU | 01539e7 | 2019-07-31 10:57:38 +0800 | [diff] [blame^] | 1 | #pragma once |
| 2 | |
| 3 | #include "config.h" |
| 4 | |
| 5 | #include <sdbusplus/server.hpp> |
| 6 | #include <xyz/openbmc_project/Software/Activation/server.hpp> |
| 7 | #include <xyz/openbmc_project/Software/ExtendedVersion/server.hpp> |
| 8 | |
| 9 | namespace phosphor |
| 10 | { |
| 11 | namespace software |
| 12 | { |
| 13 | namespace updater |
| 14 | { |
| 15 | |
| 16 | using ActivationInherit = sdbusplus::server::object::object< |
| 17 | sdbusplus::xyz::openbmc_project::Software::server::ExtendedVersion, |
| 18 | sdbusplus::xyz::openbmc_project::Software::server::Activation>; |
| 19 | |
| 20 | /** @class Activation |
| 21 | * @brief OpenBMC activation software management implementation. |
| 22 | * @details A concrete implementation for |
| 23 | * xyz.openbmc_project.Software.Activation DBus API. |
| 24 | */ |
| 25 | class Activation : public ActivationInherit |
| 26 | { |
| 27 | public: |
| 28 | /** @brief Constructs Activation Software Manager |
| 29 | * |
| 30 | * @param[in] bus - The Dbus bus object |
| 31 | * @param[in] path - The Dbus object path |
| 32 | * @param[in] versionId - The software version id |
| 33 | * @param[in] extVersion - The extended version |
| 34 | * @param[in] activationStatus - The status of Activation |
| 35 | */ |
| 36 | Activation(sdbusplus::bus::bus& bus, const std::string& path, |
| 37 | const std::string& versionId, const std::string& extVersion, |
| 38 | sdbusplus::xyz::openbmc_project::Software::server::Activation:: |
| 39 | Activations activationStatus) : |
| 40 | ActivationInherit(bus, path.c_str(), true), |
| 41 | bus(bus), path(path), versionId(versionId) |
| 42 | { |
| 43 | // Set Properties. |
| 44 | extendedVersion(extVersion); |
| 45 | activation(activationStatus); |
| 46 | |
| 47 | // Emit deferred signal. |
| 48 | emit_object_added(); |
| 49 | } |
| 50 | |
| 51 | /** @brief Overloaded Activation property setter function |
| 52 | * |
| 53 | * @param[in] value - One of Activation::Activations |
| 54 | * |
| 55 | * @return Success or exception thrown |
| 56 | */ |
| 57 | Activations activation(Activations value) override; |
| 58 | |
| 59 | /** @brief Activation */ |
| 60 | using ActivationInherit::activation; |
| 61 | |
| 62 | /** @brief Overloaded requestedActivation property setter function |
| 63 | * |
| 64 | * @param[in] value - One of Activation::RequestedActivations |
| 65 | * |
| 66 | * @return Success or exception thrown |
| 67 | */ |
| 68 | RequestedActivations |
| 69 | requestedActivation(RequestedActivations value) override; |
| 70 | |
| 71 | /** @brief Persistent sdbusplus DBus bus connection */ |
| 72 | sdbusplus::bus::bus& bus; |
| 73 | |
| 74 | /** @brief Persistent DBus object path */ |
| 75 | std::string path; |
| 76 | |
| 77 | /** @brief Version id */ |
| 78 | std::string versionId; |
| 79 | }; |
| 80 | |
| 81 | } // namespace updater |
| 82 | } // namespace software |
| 83 | } // namespace phosphor |