blob: 7212cc248f50edb420c0b29bc117bf3781ec3c78 [file] [log] [blame]
Gunnar Mills01a323b2017-01-18 09:48:13 -06001#pragma once
Gunnar Mills01a323b2017-01-18 09:48:13 -06002
3#include <sdbusplus/bus.hpp>
4#include "xyz/openbmc_project/Software/Version/server.hpp"
5
6namespace phosphor
7{
8namespace software
9{
10namespace 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 */
18class 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 Millsa673ee02017-01-23 16:45:03 -060024 * @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 Mills01a323b2017-01-18 09:48:13 -060030 */
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 Millsa673ee02017-01-23 16:45:03 -060036 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 Mills01a323b2017-01-18 09:48:13 -060045
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