blob: 9d6dda8ca7049ffc3105f066bedc3bd4ab2e4f2a [file] [log] [blame]
Unive Tien7ad45b42025-08-18 06:04:53 +00001#pragma once
2
3#include "common/types.hpp"
4#include "common/utils.hpp"
5
6#include <xyz/openbmc_project/Association/Definitions/server.hpp>
7#include <xyz/openbmc_project/Software/Version/server.hpp>
8
9class FirmwareInventoryTest;
10
11namespace pldm::fw_update
12{
13
14class FirmwareInventory;
15using SoftwareVersion = sdbusplus::server::object_t<
16 sdbusplus::xyz::openbmc_project::Software::server::Version>;
17using SoftwareAssociationDefinitions = sdbusplus::server::object_t<
18 sdbusplus::xyz::openbmc_project::Association::server::Definitions>;
19
20using SoftwareVersionPurpose = SoftwareVersion::VersionPurpose;
21
22using namespace pldm;
23
24class FirmwareInventory
25{
26 public:
27 friend class ::FirmwareInventoryTest;
28 FirmwareInventory() = delete;
29 FirmwareInventory(const FirmwareInventory&) = delete;
30 FirmwareInventory(FirmwareInventory&&) = delete;
31 FirmwareInventory& operator=(const FirmwareInventory&) = delete;
32 FirmwareInventory& operator=(FirmwareInventory&&) = delete;
33 ~FirmwareInventory() = default;
34
35 /**
36 * @brief Constructor
37 * @param[in] softwareIdentifier - Software identifier containing EID and
38 * component identifier
39 * @param[in] softwarePath - D-Bus object path for the firmware inventory
40 * entry
41 * @param[in] softwareVersion - Active version of the firmware
42 * @param[in] associatedEndpoint - D-Bus object path of the endpoint
43 * associated with the firmware
44 * @param[in] descriptors - Descriptors associated with the firmware
45 * @param[in] componentInfo - Component information associated with the
46 * firmware
47 * @param[in] purpose - Purpose of the software version, default is Unknown
48 * @note The descriptors and componentInfo parameters are reserved for
49 * future use and currently not used in the implementation.
50 */
51 explicit FirmwareInventory(
52 SoftwareIdentifier /*softwareIdentifier*/,
53 const std::string& softwarePath, const std::string& softwareVersion,
54 const std::string& associatedEndpoint,
Unive Tien7ad45b42025-08-18 06:04:53 +000055 SoftwareVersionPurpose purpose = SoftwareVersionPurpose::Unknown);
56
57 private:
58 /**
59 * @brief Reference to the sdbusplus bus
60 */
61 sdbusplus::bus_t& bus = utils::DBusHandler::getBus();
62
63 /**
64 * @brief The D-Bus object path for the firmware inventory entry, obtained
65 * by
66 */
67 std::string softwarePath;
68
69 /**
70 * @brief Software association object that represents the associations
71 * for the firmware
72 */
73 SoftwareAssociationDefinitions association;
74
75 /**
76 * @brief Software version object that represents the firmware version
77 */
78 SoftwareVersion version;
79};
80
81} // namespace pldm::fw_update