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