Gunnar Mills | 01a323b | 2017-01-18 09:48:13 -0600 | [diff] [blame] | 1 | #pragma once |
Gunnar Mills | 01a323b | 2017-01-18 09:48:13 -0600 | [diff] [blame] | 2 | |
| 3 | #include <sdbusplus/bus.hpp> |
| 4 | #include "xyz/openbmc_project/Software/Version/server.hpp" |
Gunnar Mills | ed92dfa | 2017-01-27 10:41:49 -0600 | [diff] [blame] | 5 | #include "xyz/openbmc_project/Software/Activation/server.hpp" |
Gunnar Mills | 01a323b | 2017-01-18 09:48:13 -0600 | [diff] [blame] | 6 | |
| 7 | namespace phosphor |
| 8 | { |
| 9 | namespace software |
| 10 | { |
| 11 | namespace manager |
| 12 | { |
| 13 | |
Gunnar Mills | af4759e | 2017-02-13 16:50:16 -0600 | [diff] [blame] | 14 | using VersionInherit = sdbusplus::server::object::object< |
| 15 | sdbusplus::xyz::openbmc_project::Software::server::Version, |
| 16 | sdbusplus::xyz::openbmc_project::Software::server::Activation>; |
| 17 | |
Gunnar Mills | 01a323b | 2017-01-18 09:48:13 -0600 | [diff] [blame] | 18 | /** @class Version |
| 19 | * @brief OpenBMC version software management implementation. |
| 20 | * @details A concrete implementation for xyz.openbmc_project.Software.Version |
| 21 | * DBus API. |
| 22 | */ |
Gunnar Mills | af4759e | 2017-02-13 16:50:16 -0600 | [diff] [blame] | 23 | class Version : public VersionInherit |
Gunnar Mills | 01a323b | 2017-01-18 09:48:13 -0600 | [diff] [blame] | 24 | { |
| 25 | public: |
| 26 | /** @brief Constructs Version Software Manager |
| 27 | * |
Gunnar Mills | a673ee0 | 2017-01-23 16:45:03 -0600 | [diff] [blame] | 28 | * @note This constructor passes 'true' to the base class in order to |
| 29 | * defer dbus object registration until we can |
| 30 | * set our properties |
| 31 | * |
| 32 | * @param[in] bus - The Dbus bus object |
| 33 | * @param[in] objPath - The Dbus object path |
Gunnar Mills | 01a323b | 2017-01-18 09:48:13 -0600 | [diff] [blame] | 34 | */ |
| 35 | Version(sdbusplus::bus::bus& bus, |
Gunnar Mills | af4759e | 2017-02-13 16:50:16 -0600 | [diff] [blame] | 36 | const char* objPath) : VersionInherit( |
| 37 | bus, (std::string{objPath} + '/' + getId()).c_str(), true) |
Gunnar Mills | a673ee0 | 2017-01-23 16:45:03 -0600 | [diff] [blame] | 38 | { |
| 39 | // Set properties. |
| 40 | purpose(VersionPurpose::BMC); |
| 41 | version(getVersion()); |
Gunnar Mills | 89484c7 | 2017-01-27 11:26:51 -0600 | [diff] [blame] | 42 | activation(Activations::Active); |
| 43 | // requestedActivation default is "None", so no need to set. |
Gunnar Mills | a673ee0 | 2017-01-23 16:45:03 -0600 | [diff] [blame] | 44 | |
| 45 | // Emit deferred signal. |
| 46 | emit_object_added(); |
| 47 | } |
Gunnar Mills | 01a323b | 2017-01-18 09:48:13 -0600 | [diff] [blame] | 48 | |
| 49 | private: |
| 50 | /** |
| 51 | * @brief Get the code version identifier. |
| 52 | * |
| 53 | * @return The version identifier. |
| 54 | **/ |
| 55 | const std::string getVersion() const; |
| 56 | |
| 57 | /** |
| 58 | * @brief Get the Software Version id. |
| 59 | * |
| 60 | * @return The id. |
| 61 | **/ |
| 62 | const std::string getId() const; |
| 63 | }; |
| 64 | |
| 65 | } // namespace manager |
| 66 | } // namespace software |
| 67 | } // namespace phosphor |