Gunnar Mills | 392f294 | 2017-04-12 11:04:37 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <sdbusplus/bus.hpp> |
| 4 | #include "xyz/openbmc_project/Software/Version/server.hpp" |
| 5 | |
| 6 | namespace phosphor |
| 7 | { |
| 8 | namespace software |
| 9 | { |
| 10 | namespace manager |
| 11 | { |
| 12 | |
| 13 | using VersionInherit = sdbusplus::server::object::object< |
| 14 | sdbusplus::xyz::openbmc_project::Software::server::Version>; |
| 15 | |
| 16 | /** @class Version |
| 17 | * @brief OpenBMC version software management implementation. |
| 18 | * @details A concrete implementation for xyz.openbmc_project.Software.Version |
| 19 | * DBus API. |
| 20 | */ |
| 21 | class Version : public VersionInherit |
| 22 | { |
| 23 | public: |
| 24 | /** @brief Constructs Version Software Manager |
| 25 | * |
Gunnar Mills | cebd102 | 2017-04-17 16:10:15 -0500 | [diff] [blame^] | 26 | * @param[in] bus - The Dbus bus object |
| 27 | * @param[in] objPath - The Dbus object path |
| 28 | * @param[in] versionId - The version identifier |
| 29 | * @param[in] versionPurpose - The version purpose |
Gunnar Mills | 392f294 | 2017-04-12 11:04:37 -0500 | [diff] [blame] | 30 | */ |
| 31 | Version(sdbusplus::bus::bus& bus, |
| 32 | const std::string& objPath, |
Gunnar Mills | cebd102 | 2017-04-17 16:10:15 -0500 | [diff] [blame^] | 33 | const std::string& versionId, |
| 34 | VersionPurpose versionPurpose) : VersionInherit( |
Gunnar Mills | 392f294 | 2017-04-12 11:04:37 -0500 | [diff] [blame] | 35 | bus, (objPath).c_str(), true) |
| 36 | { |
| 37 | // Set properties. |
Gunnar Mills | cebd102 | 2017-04-17 16:10:15 -0500 | [diff] [blame^] | 38 | purpose(versionPurpose); |
Gunnar Mills | 392f294 | 2017-04-12 11:04:37 -0500 | [diff] [blame] | 39 | version(versionId); |
| 40 | |
| 41 | // Emit deferred signal. |
| 42 | emit_object_added(); |
| 43 | } |
| 44 | |
| 45 | /** |
Gunnar Mills | cebd102 | 2017-04-17 16:10:15 -0500 | [diff] [blame^] | 46 | * @brief Read the manifest file to get the value of the key. |
Gunnar Mills | 392f294 | 2017-04-12 11:04:37 -0500 | [diff] [blame] | 47 | * |
Gunnar Mills | cebd102 | 2017-04-17 16:10:15 -0500 | [diff] [blame^] | 48 | * @return The value of the key. |
Gunnar Mills | 392f294 | 2017-04-12 11:04:37 -0500 | [diff] [blame] | 49 | **/ |
Gunnar Mills | cebd102 | 2017-04-17 16:10:15 -0500 | [diff] [blame^] | 50 | static std::string getValue(const std::string& manifestFilePath, |
| 51 | std::string key); |
Gunnar Mills | 392f294 | 2017-04-12 11:04:37 -0500 | [diff] [blame] | 52 | |
| 53 | /** |
Gunnar Mills | cebd102 | 2017-04-17 16:10:15 -0500 | [diff] [blame^] | 54 | * @brief Get the Version id. |
Gunnar Mills | 392f294 | 2017-04-12 11:04:37 -0500 | [diff] [blame] | 55 | * |
| 56 | * @return The id. |
| 57 | **/ |
| 58 | static std::string getId(const std::string& version); |
Gunnar Mills | cebd102 | 2017-04-17 16:10:15 -0500 | [diff] [blame^] | 59 | |
Gunnar Mills | 392f294 | 2017-04-12 11:04:37 -0500 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | } // namespace manager |
| 63 | } // namespace software |
| 64 | } // namespace phosphor |
| 65 | |