Gunnar Mills | 9df1316 | 2017-03-08 15:00:08 -0600 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <sdbusplus/bus.hpp> |
| 4 | #include "xyz/openbmc_project/Software/Version/server.hpp" |
| 5 | |
| 6 | namespace openpower |
| 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 | * |
| 26 | * @param[in] bus - The Dbus bus object |
| 27 | * @param[in] objPath - The Dbus object path |
Gunnar Mills | 44c7729 | 2017-03-20 15:02:27 -0500 | [diff] [blame] | 28 | * @param[in] versionId - The Host version identifier |
Gunnar Mills | 9df1316 | 2017-03-08 15:00:08 -0600 | [diff] [blame] | 29 | */ |
| 30 | Version(sdbusplus::bus::bus& bus, |
Gunnar Mills | 1408173 | 2017-03-20 16:22:02 -0500 | [diff] [blame] | 31 | const std::string& objPath, |
| 32 | const std::string& versionId) : VersionInherit( |
| 33 | bus, (objPath).c_str(), true) |
| 34 | { |
| 35 | // Set properties. |
| 36 | purpose(VersionPurpose::Host); |
| 37 | version(versionId); |
| 38 | |
| 39 | // Emit deferred signal. |
| 40 | emit_object_added(); |
| 41 | } |
Gunnar Mills | 44c7729 | 2017-03-20 15:02:27 -0500 | [diff] [blame] | 42 | |
| 43 | /** |
| 44 | * @brief Get the code version identifier. |
| 45 | * |
| 46 | * @return The version identifier. |
| 47 | **/ |
Saqib Khan | 77420d2 | 2017-04-04 11:07:07 -0500 | [diff] [blame] | 48 | static std::string getVersion(const std::string& manifestFilePath); |
Gunnar Mills | 44c7729 | 2017-03-20 15:02:27 -0500 | [diff] [blame] | 49 | |
| 50 | /** |
| 51 | * @brief Get the Host Version id. |
| 52 | * |
| 53 | * @return The id. |
| 54 | **/ |
| 55 | static std::string getId(const std::string& version); |
Gunnar Mills | 9df1316 | 2017-03-08 15:00:08 -0600 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | } // namespace manager |
| 59 | } // namespace software |
| 60 | } // namespace openpower |
| 61 | |