#pragma once #include "MctpRequester.hpp" #include "NvidiaGpuMctpVdm.hpp" #include #include #include #include #include #include #include #include #include #include #include using InventoryRequestBuffer = std::array; using InventoryResponseBuffer = std::array; class Inventory : public std::enable_shared_from_this { public: Inventory(const std::shared_ptr& conn, sdbusplus::asio::object_server& objectServer, const std::string& inventoryName, mctp::MctpRequester& mctpRequester, gpu::DeviceIdentification deviceType, uint8_t eid, boost::asio::io_context& io); private: struct PropertyInfo { std::shared_ptr interface; std::string propertyName; int retryCount{0}; bool isPending{false}; }; void sendInventoryPropertyRequest(gpu::InventoryPropertyId propertyId); void handleInventoryPropertyResponse(gpu::InventoryPropertyId propertyId, int sendRecvMsgResult); void processNextProperty(); void processInventoryProperty(gpu::InventoryPropertyId propertyId); void registerProperty( gpu::InventoryPropertyId propertyId, const std::shared_ptr& interface, const std::string& propertyName); std::optional getNextPendingProperty() const; static void markPropertyPending( std::unordered_map::iterator it); static void markPropertyProcessed( std::unordered_map::iterator it); std::shared_ptr assetIface; std::shared_ptr acceleratorInterface; std::string name; mctp::MctpRequester& mctpRequester; gpu::DeviceIdentification deviceType; uint8_t eid; boost::asio::steady_timer retryTimer; std::unordered_map properties; std::shared_ptr requestBuffer; std::shared_ptr responseBuffer; static constexpr std::chrono::seconds retryDelay{5}; static constexpr int maxRetryAttempts = 3; };