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