blob: 58abe1affa64d13fcc5d859fa9f24719adf136d0 [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
Gunnar Millsaf4759e2017-02-13 16:50:16 -060014using VersionInherit = sdbusplus::server::object::object<
15 sdbusplus::xyz::openbmc_project::Software::server::Version,
16 sdbusplus::xyz::openbmc_project::Software::server::Activation>;
17
Gunnar Mills01a323b2017-01-18 09:48:13 -060018/** @class Version
19 * @brief OpenBMC version software management implementation.
20 * @details A concrete implementation for xyz.openbmc_project.Software.Version
21 * DBus API.
22 */
Gunnar Millsaf4759e2017-02-13 16:50:16 -060023class Version : public VersionInherit
Gunnar Mills01a323b2017-01-18 09:48:13 -060024{
25 public:
26 /** @brief Constructs Version Software Manager
27 *
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 */
35 Version(sdbusplus::bus::bus& bus,
Gunnar Millsaf4759e2017-02-13 16:50:16 -060036 const char* objPath) : VersionInherit(
37 bus, (std::string{objPath} + '/' + getId()).c_str(), true)
Gunnar Millsa673ee02017-01-23 16:45:03 -060038 {
39 // Set properties.
40 purpose(VersionPurpose::BMC);
41 version(getVersion());
Gunnar Mills89484c72017-01-27 11:26:51 -060042 activation(Activations::Active);
43 // requestedActivation default is "None", so no need to set.
Gunnar Millsa673ee02017-01-23 16:45:03 -060044
45 // Emit deferred signal.
46 emit_object_added();
47 }
Gunnar Mills01a323b2017-01-18 09:48:13 -060048
49 private:
50 /**
51 * @brief Get the code version identifier.
52 *
53 * @return The version identifier.
54 **/
55 const std::string getVersion() const;
56
57 /**
58 * @brief Get the Software Version id.
59 *
60 * @return The id.
61 **/
62 const std::string getId() const;
63};
64
65} // namespace manager
66} // namespace software
67} // namespace phosphor