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