blob: 9bbfbd0865ed840b8814c77a73f8074cccf5c748 [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 Mills9b7c0b62017-04-24 12:59:58 -050014using BMCVersionInherit = sdbusplus::server::object::object<
Gunnar Millsaf4759e2017-02-13 16:50:16 -060015 sdbusplus::xyz::openbmc_project::Software::server::Version,
16 sdbusplus::xyz::openbmc_project::Software::server::Activation>;
Gunnar Mills9b7c0b62017-04-24 12:59:58 -050017 // TODO: Move activation interface to Item Updater.
Gunnar Millsaf4759e2017-02-13 16:50:16 -060018
Gunnar Mills9b7c0b62017-04-24 12:59:58 -050019/** @class BMCVersion
20 * @brief OpenBMC version and activation software management implementation
21 * for the active BMC software image.
Gunnar Mills01a323b2017-01-18 09:48:13 -060022 * @details A concrete implementation for xyz.openbmc_project.Software.Version
Gunnar Mills9b7c0b62017-04-24 12:59:58 -050023 * and xyz.openbmc_project.Software.Activation DBus APIs.
Gunnar Mills01a323b2017-01-18 09:48:13 -060024 */
Gunnar Mills9b7c0b62017-04-24 12:59:58 -050025class BMCVersion : public BMCVersionInherit
Gunnar Mills01a323b2017-01-18 09:48:13 -060026{
27 public:
Gunnar Mills9b7c0b62017-04-24 12:59:58 -050028 /** @brief Constructs BMC Version and Activation Software Manager for
29 * the active BMC software image.
Gunnar Mills01a323b2017-01-18 09:48:13 -060030 *
Gunnar Millsa673ee02017-01-23 16:45:03 -060031 * @note This constructor passes 'true' to the base class in order to
32 * defer dbus object registration until we can
33 * set our properties
34 *
35 * @param[in] bus - The Dbus bus object
36 * @param[in] objPath - The Dbus object path
Gunnar Mills01a323b2017-01-18 09:48:13 -060037 */
Gunnar Mills9b7c0b62017-04-24 12:59:58 -050038 BMCVersion(sdbusplus::bus::bus& bus,
39 const char* objPath) : BMCVersionInherit(
40 bus, (std::string{objPath} + '/' + getId()).c_str(),
41 true)
Gunnar Millsa673ee02017-01-23 16:45:03 -060042 {
43 // Set properties.
44 purpose(VersionPurpose::BMC);
45 version(getVersion());
Gunnar Mills89484c72017-01-27 11:26:51 -060046 activation(Activations::Active);
47 // requestedActivation default is "None", so no need to set.
Gunnar Millsa673ee02017-01-23 16:45:03 -060048
49 // Emit deferred signal.
50 emit_object_added();
51 }
Gunnar Mills01a323b2017-01-18 09:48:13 -060052
53 private:
54 /**
55 * @brief Get the code version identifier.
56 *
57 * @return The version identifier.
58 **/
59 const std::string getVersion() const;
60
61 /**
62 * @brief Get the Software Version id.
63 *
64 * @return The id.
65 **/
66 const std::string getId() const;
67};
68
69} // namespace manager
70} // namespace software
71} // namespace phosphor