18 #include <peak/dll_interface/peak_dll_interface_util.hpp> 67 std::vector<std::shared_ptr<FirmwareUpdateInformation>> CollectFirmwareUpdateInformation(
68 const std::string& gufPath)
const;
82 std::vector<std::shared_ptr<FirmwareUpdateInformation>> CollectFirmwareUpdateInformation(
83 const std::string& gufPath,
const std::shared_ptr<DeviceDescriptor>& device)
const;
105 void UpdateDevice(
const std::shared_ptr<DeviceDescriptor>& device,
106 const std::shared_ptr<FirmwareUpdateInformation>& updateInformation,
136 const std::string& gufPath)
const 138 CallAndCheckCInterfaceFunction([&] {
140 m_backendHandle, gufPath.c_str(), gufPath.size() + 1);
143 auto numFirmwareUpdateInformation = QueryNumericFromCInterfaceFunction<size_t>(
144 [&](
size_t* _numFirmwareUpdateInformation) {
146 m_backendHandle, _numFirmwareUpdateInformation);
149 std::vector<std::shared_ptr<FirmwareUpdateInformation>> firmwareUpdateInformation;
150 for (
size_t x = 0; x < numFirmwareUpdateInformation; ++x)
152 auto firmwareUpdateInformationHandle =
153 QueryNumericFromCInterfaceFunction<PEAK_FIRMWARE_UPDATE_INFORMATION_HANDLE>(
156 m_backendHandle, x, _firmwareUpdateInformationHandle);
159 firmwareUpdateInformation.emplace_back(
160 std::make_shared<ClassCreator<FirmwareUpdateInformation>>(firmwareUpdateInformationHandle));
163 return firmwareUpdateInformation;
167 const std::string& gufPath,
const std::shared_ptr<DeviceDescriptor>& device)
const 169 if (device ==
nullptr)
174 CallAndCheckCInterfaceFunction([&] {
176 m_backendHandle, gufPath.c_str(), gufPath.size() + 1, device->m_backendHandle);
179 auto numFirmwareUpdateInformation = QueryNumericFromCInterfaceFunction<size_t>(
180 [&](
size_t* _numFirmwareUpdateInformation) {
182 m_backendHandle, _numFirmwareUpdateInformation);
185 std::vector<std::shared_ptr<FirmwareUpdateInformation>> firmwareUpdateInformation;
186 for (
size_t x = 0; x < numFirmwareUpdateInformation; ++x)
188 auto firmwareUpdateInformationHandle =
189 QueryNumericFromCInterfaceFunction<PEAK_FIRMWARE_UPDATE_INFORMATION_HANDLE>(
192 m_backendHandle, x, _firmwareUpdateInformationHandle);
195 firmwareUpdateInformation.emplace_back(
196 std::make_shared<ClassCreator<FirmwareUpdateInformation>>(firmwareUpdateInformationHandle));
199 return firmwareUpdateInformation;
203 const std::shared_ptr<FirmwareUpdateInformation>& updateInformation,
205 Timeout deviceResetDiscoveryTimeout )
207 if (device ==
nullptr)
211 if (updateInformation ==
nullptr)
216 CallAndCheckCInterfaceFunction([&] {
218 device->m_backendHandle, updateInformation->m_backendHandle,
219 progressObserver ? progressObserver->m_backendHandle :
nullptr, deviceResetDiscoveryTimeout);
struct PEAK_FIRMWARE_UPDATER * PEAK_FIRMWARE_UPDATER_HANDLE
Definition: peak_backend.h:469
The exception thrown for pass an invalid argument to a function.
Definition: peak_exception.hpp:73
PEAK_C_API PEAK_FirmwareUpdater_GetFirmwareUpdateInformation(PEAK_FIRMWARE_UPDATER_HANDLE firmwareUpdaterHandle, size_t index, PEAK_FIRMWARE_UPDATE_INFORMATION_HANDLE *firmwareUpdateInformationHandle)
Asks the given firmware updater for the update information with the given index.
PEAK_C_API PEAK_FirmwareUpdater_UpdateDeviceWithResetTimeout(PEAK_FIRMWARE_UPDATER_HANDLE firmwareUpdaterHandle, PEAK_DEVICE_DESCRIPTOR_HANDLE deviceDescriptorHandle, PEAK_FIRMWARE_UPDATE_INFORMATION_HANDLE firmwareUpdateInformationHandle, PEAK_FIRMWARE_UPDATE_PROGRESS_OBSERVER_HANDLE firmwareUpdateProgressObserverHandle, uint64_t deviceResetDiscoveryTimeout_ms)
Tells the given firmware updater to update the given device with the given update information...
PEAK_C_API PEAK_FirmwareUpdater_GetNumFirmwareUpdateInformation(PEAK_FIRMWARE_UPDATER_HANDLE firmwareUpdaterHandle, size_t *numFirmwareUpdateInformation)
Asks the given firmware updater for its number of update information.
The "peak" namespace directly contains convenience functionality like the DeviceManager as well as th...
Definition: peak_dynamic_loader.h:32
void UpdateDevice(const std::shared_ptr< DeviceDescriptor > &device, const std::shared_ptr< FirmwareUpdateInformation > &updateInformation, const FirmwareUpdateProgressObserver *progressObserver=nullptr, Timeout deviceResetDiscoveryTimeout=Timeout(60000ms))
Updates a given device by using a given firmware update information.
Definition: peak_firmware_updater.hpp:202
~FirmwareUpdater()
Definition: peak_firmware_updater.hpp:130
PEAK_C_API PEAK_FirmwareUpdater_Destruct(PEAK_FIRMWARE_UPDATER_HANDLE firmwareUpdaterHandle)
Destroys the given firmware updater.
Allows to update the firmware of a device.
Definition: peak_firmware_updater.hpp:45
FirmwareUpdater()
Definition: peak_firmware_updater.hpp:123
std::vector< std::shared_ptr< FirmwareUpdateInformation > > CollectFirmwareUpdateInformation(const std::string &gufPath) const
Collects all firmware update information of a given *.guf file.
Definition: peak_firmware_updater.hpp:135
Represents a timeout value in milliseconds.
Definition: peak_timeout.hpp:30
Allows to observe a firmware update process.
Definition: peak_firmware_update_progress_observer.hpp:52
PEAK_C_API PEAK_FirmwareUpdater_Construct(PEAK_FIRMWARE_UPDATER_HANDLE *firmwareUpdaterHandle)
Creates a firmware updater.
PEAK_C_API PEAK_FirmwareUpdater_CollectFirmwareUpdateInformation(PEAK_FIRMWARE_UPDATER_HANDLE firmwareUpdaterHandle, const char *gufPath, size_t gufPathSize, PEAK_DEVICE_DESCRIPTOR_HANDLE deviceDescriptorHandle)
Tells the given firmware updater to collect all update information fitting to the given device...
#define PEAK_C_ABI_PREFIX
Definition: peak_dll_defines.h:16
PEAK_C_API PEAK_FirmwareUpdater_CollectAllFirmwareUpdateInformation(PEAK_FIRMWARE_UPDATER_HANDLE firmwareUpdaterHandle, const char *gufPath, size_t gufPathSize)
Tells the given firmware updater to collect all update information from the .guf file.
struct PEAK_FIRMWARE_UPDATE_INFORMATION * PEAK_FIRMWARE_UPDATE_INFORMATION_HANDLE
Definition: peak_backend.h:473