blob: 479cdd6c6dcb6d4896edd6514c03e78b9203f666 [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());
Gunnar Mills89484c72017-01-27 11:26:51 -060045 activation(Activations::Active);
46 // requestedActivation default is "None", so no need to set.
Gunnar Millsa673ee02017-01-23 16:45:03 -060047
48 // Emit deferred signal.
49 emit_object_added();
50 }
Gunnar Mills01a323b2017-01-18 09:48:13 -060051
52 private:
53 /**
54 * @brief Get the code version identifier.
55 *
56 * @return The version identifier.
57 **/
58 const std::string getVersion() const;
59
60 /**
61 * @brief Get the Software Version id.
62 *
63 * @return The id.
64 **/
65 const std::string getId() const;
66};
67
68} // namespace manager
69} // namespace software
70} // namespace phosphor