blob: 74db7beedfe26086168b9c6ce355dd7bbd4d941c [file] [log] [blame]
Gunnar Mills9df13162017-03-08 15:00:08 -06001#pragma once
2
3#include <sdbusplus/bus.hpp>
4#include "xyz/openbmc_project/Software/Version/server.hpp"
5
6namespace openpower
7{
8namespace software
9{
10namespace manager
11{
12
13using VersionInherit = sdbusplus::server::object::object<
14 sdbusplus::xyz::openbmc_project::Software::server::Version>;
15
16/** @class Version
17 * @brief OpenBMC version software management implementation.
18 * @details A concrete implementation for xyz.openbmc_project.Software.Version
19 * DBus API.
20 */
21class Version : public VersionInherit
22{
23 public:
24 /** @brief Constructs Version Software Manager
25 *
26 * @param[in] bus - The Dbus bus object
27 * @param[in] objPath - The Dbus object path
Gunnar Mills44c77292017-03-20 15:02:27 -050028 * @param[in] versionId - The Host version identifier
Gunnar Mills9df13162017-03-08 15:00:08 -060029 */
30 Version(sdbusplus::bus::bus& bus,
Gunnar Mills14081732017-03-20 16:22:02 -050031 const std::string& objPath,
32 const std::string& versionId) : VersionInherit(
33 bus, (objPath).c_str(), true)
34 {
35 // Set properties.
36 purpose(VersionPurpose::Host);
37 version(versionId);
38
39 // Emit deferred signal.
40 emit_object_added();
41 }
Gunnar Mills44c77292017-03-20 15:02:27 -050042
43 /**
44 * @brief Get the code version identifier.
45 *
46 * @return The version identifier.
47 **/
Saqib Khan77420d22017-04-04 11:07:07 -050048 static std::string getVersion(const std::string& manifestFilePath);
Gunnar Mills44c77292017-03-20 15:02:27 -050049
50 /**
51 * @brief Get the Host Version id.
52 *
53 * @return The id.
54 **/
55 static std::string getId(const std::string& version);
Gunnar Mills9df13162017-03-08 15:00:08 -060056};
57
58} // namespace manager
59} // namespace software
60} // namespace openpower
61