#pragma once #include #include #include #include #include namespace estoraged { using BasicVariantType = std::variant, std::string, int64_t, uint64_t, double, int32_t, uint32_t, int16_t, uint16_t, uint8_t, bool>; /* Map of properties for the config interface. */ using StorageData = boost::container::flat_map; using ManagedStorageType = boost::container::flat_map; const constexpr char* emmcConfigInterface = "xyz.openbmc_project.Configuration.EmmcDevice"; /** @class GetStorageConfiguration * @brief Object used to find Entity Manager config objects. * @details eStoraged will create a new D-Bus object for each config object. */ class GetStorageConfiguration : public std::enable_shared_from_this { public: /** @brief Constructor for GetStorageConfiguration * * @param[in] connection - shared_ptr to D-Bus connection object. * @param[in] callbackFunc - callback to run after finding the config * objects. */ GetStorageConfiguration( std::shared_ptr connection, std::function&& callbackFunc) : dbusConnection(std::move(connection)), callback(std::move(callbackFunc)) {} GetStorageConfiguration& operator=(const GetStorageConfiguration&) = delete; GetStorageConfiguration(const GetStorageConfiguration&) = delete; GetStorageConfiguration(GetStorageConfiguration&&) = default; GetStorageConfiguration& operator=(GetStorageConfiguration&&) = default; /** @brief Destructor for GetStorageConfiguration. * @details This will execute the callback provided to the constructor. */ ~GetStorageConfiguration(); /** @brief Find the Entity Manager config objects for eStoraged. */ void getConfiguration(); /** @brief Get the D-Bus properties from the config object. * * @param[in] path - D-Bus object path of the config object. * @param[in] owner - D-Bus service that owns the config object. */ void getStorageInfo(const std::string& path, const std::string& owner); /** @brief Map containing config objects with corresponding properties. */ ManagedStorageType respData; /** @brief Connection to D-Bus. */ std::shared_ptr dbusConnection; private: /** @brief callback to process the config object data in respData. */ std::function callback; }; } // namespace estoraged