blob: cd52fa02fbb3e0cc5471da695d1ca043ca85ed90 [file] [log] [blame]
Gunnar Mills392f2942017-04-12 11:04:37 -05001#pragma once
2
3#include <sdbusplus/bus.hpp>
4#include "xyz/openbmc_project/Software/Version/server.hpp"
5
6namespace phosphor
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 *
Gunnar Millscebd1022017-04-17 16:10:15 -050026 * @param[in] bus - The Dbus bus object
27 * @param[in] objPath - The Dbus object path
28 * @param[in] versionId - The version identifier
29 * @param[in] versionPurpose - The version purpose
Gunnar Mills392f2942017-04-12 11:04:37 -050030 */
31 Version(sdbusplus::bus::bus& bus,
32 const std::string& objPath,
Gunnar Millscebd1022017-04-17 16:10:15 -050033 const std::string& versionId,
34 VersionPurpose versionPurpose) : VersionInherit(
Gunnar Mills392f2942017-04-12 11:04:37 -050035 bus, (objPath).c_str(), true)
36 {
37 // Set properties.
Gunnar Millscebd1022017-04-17 16:10:15 -050038 purpose(versionPurpose);
Gunnar Mills392f2942017-04-12 11:04:37 -050039 version(versionId);
40
41 // Emit deferred signal.
42 emit_object_added();
43 }
44
45 /**
Gunnar Millscebd1022017-04-17 16:10:15 -050046 * @brief Read the manifest file to get the value of the key.
Gunnar Mills392f2942017-04-12 11:04:37 -050047 *
Gunnar Millscebd1022017-04-17 16:10:15 -050048 * @return The value of the key.
Gunnar Mills392f2942017-04-12 11:04:37 -050049 **/
Gunnar Millscebd1022017-04-17 16:10:15 -050050 static std::string getValue(const std::string& manifestFilePath,
51 std::string key);
Gunnar Mills392f2942017-04-12 11:04:37 -050052
53 /**
Gunnar Millscebd1022017-04-17 16:10:15 -050054 * @brief Get the Version id.
Gunnar Mills392f2942017-04-12 11:04:37 -050055 *
56 * @return The id.
57 **/
58 static std::string getId(const std::string& version);
Gunnar Millscebd1022017-04-17 16:10:15 -050059
Gunnar Mills392f2942017-04-12 11:04:37 -050060};
61
62} // namespace manager
63} // namespace software
64} // namespace phosphor
65