blob: 6ac785b0c760f0d4ddb3ef44b50369944dc8451e [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
Gunnar Mills9b7c0b62017-04-24 12:59:58 -050013using BMCVersionInherit = sdbusplus::server::object::object<
Gunnar Mills2ce7da22017-05-04 15:37:56 -050014 sdbusplus::xyz::openbmc_project::Software::server::Version>;
Gunnar Millsaf4759e2017-02-13 16:50:16 -060015
Gunnar Mills9b7c0b62017-04-24 12:59:58 -050016/** @class BMCVersion
Gunnar Mills2ce7da22017-05-04 15:37:56 -050017 * @brief OpenBMC version software management implementation
Gunnar Mills9b7c0b62017-04-24 12:59:58 -050018 * for the active BMC software image.
Gunnar Mills01a323b2017-01-18 09:48:13 -060019 * @details A concrete implementation for xyz.openbmc_project.Software.Version
Gunnar Mills2ce7da22017-05-04 15:37:56 -050020 * DBus API.
Gunnar Mills01a323b2017-01-18 09:48:13 -060021 */
Gunnar Mills9b7c0b62017-04-24 12:59:58 -050022class BMCVersion : public BMCVersionInherit
Gunnar Mills01a323b2017-01-18 09:48:13 -060023{
24 public:
Gunnar Mills2ce7da22017-05-04 15:37:56 -050025 /** @brief Constructs BMC Version Software Manager for
Gunnar Mills9b7c0b62017-04-24 12:59:58 -050026 * the active BMC software image.
Gunnar Mills01a323b2017-01-18 09:48:13 -060027 *
Gunnar Millsa673ee02017-01-23 16:45:03 -060028 * @note This constructor passes 'true' to the base class in order to
29 * defer dbus object registration until we can
30 * set our properties
31 *
32 * @param[in] bus - The Dbus bus object
33 * @param[in] objPath - The Dbus object path
Gunnar Mills01a323b2017-01-18 09:48:13 -060034 */
Gunnar Mills9b7c0b62017-04-24 12:59:58 -050035 BMCVersion(sdbusplus::bus::bus& bus,
36 const char* objPath) : BMCVersionInherit(
37 bus, (std::string{objPath} + '/' + getId()).c_str(),
38 true)
Gunnar Millsa673ee02017-01-23 16:45:03 -060039 {
40 // Set properties.
41 purpose(VersionPurpose::BMC);
42 version(getVersion());
43
44 // Emit deferred signal.
45 emit_object_added();
46 }
Gunnar Mills01a323b2017-01-18 09:48:13 -060047
48 private:
49 /**
50 * @brief Get the code version identifier.
51 *
52 * @return The version identifier.
53 **/
54 const std::string getVersion() const;
55
56 /**
57 * @brief Get the Software Version id.
58 *
59 * @return The id.
60 **/
61 const std::string getId() const;
62};
63
64} // namespace manager
65} // namespace software
66} // namespace phosphor