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