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