ifm3d
ifm3d::SWUpdater Class Reference

Public Types

using Ptr = std::shared_ptr< SWUpdater >
 
using FlashStatusCb = std::function< void(float, const std::string &)>
 Signature for user callback to receive status information about firmware flashing. More...
 

Public Member Functions

 SWUpdater (ifm3d::Device::Ptr cam, const ifm3d::SWUpdater::FlashStatusCb &cb={}, const std::uint16_t swupdate_recovery_port=ifm3d::SWUPDATER_RECOVERY_PORT)
 Ctor. More...
 
 SWUpdater (SWUpdater &&)=delete
 
SWUpdateroperator= (SWUpdater &&)=delete
 
 SWUpdater (SWUpdater &)=delete
 
SWUpdateroperator= (const SWUpdater &)=delete
 
void RebootToRecovery ()
 Reboots the device from productive to recovery. More...
 
bool WaitForRecovery (long timeout_millis=0)
 Polls on status of the device, waiting for it to present in recovery mode. More...
 
void RebootToProductive ()
 Reboots the device from recovery to productive. More...
 
bool WaitForProductive (long timeout_millis=0)
 Polls on status of the device, waiting for it to present in productive mode. More...
 
bool FlashFirmware (const std::string &swu_file, long timeout_millis=0)
 Uploads a firmware image to the device's recovery system. More...
 

Public Attributes

class IFM3D_SWUPDATER_LOCAL Impl
 

Member Typedef Documentation

◆ FlashStatusCb

using ifm3d::SWUpdater::FlashStatusCb = std::function<void(float, const std::string&)>

Signature for user callback to receive status information about firmware flashing.

The first parameter is a percentage (0.0-1.0) indicating the status of uploading the file to the device.

The second parameter is a status message from the device during install.

Constructor & Destructor Documentation

◆ SWUpdater()

ifm3d::SWUpdater::SWUpdater ( ifm3d::Device::Ptr  cam,
const ifm3d::SWUpdater::FlashStatusCb cb = {},
const std::uint16_t  swupdate_recovery_port = ifm3d::SWUPDATER_RECOVERY_PORT 
)

Ctor.

Parameters
camDevice object to manipulate
cbOptional user-defined callback to handle status updates
swupdate_recovery_portswupate recovery port for the device

Member Function Documentation

◆ FlashFirmware()

bool ifm3d::SWUpdater::FlashFirmware ( const std::string &  swu_file,
long  timeout_millis = 0 
)

Uploads a firmware image to the device's recovery system.

Assumes device has already been rebooted to recovery mode.

Parameters
[in]swu_fileThe firmware image file to flash to the device.
[in]timeout_millisTimeout in millis to wait for the firmware upload to complete. If timeout_millis is set to 0, this function will block indefinitely.

NOTE: Firmware uploading and flashing typically takes several minutes. The blocking version of the API (timeout_millis = 0) is recommended in most cases. If a timeout is truly required, it is recommended to use a value of at least 300000 (5 minutes).

Exceptions
ifm3d::error_ton error

◆ RebootToProductive()

void ifm3d::SWUpdater::RebootToProductive ( )

Reboots the device from recovery to productive.

The function returns immediately, but the reboot process takes some time. The function WaitForProductive may be used to poll for completion.

Exceptions
ifm3d::error_ton error

◆ RebootToRecovery()

void ifm3d::SWUpdater::RebootToRecovery ( )

Reboots the device from productive to recovery.

The function returns immediately, but the reboot process takes some time. The function WaitForRecovery may be used to poll for completion.

Exceptions
ifm3d::error_ton error

◆ WaitForProductive()

bool ifm3d::SWUpdater::WaitForProductive ( long  timeout_millis = 0)

Polls on status of the device, waiting for it to present in productive mode.

Should be used following a call to RebootToProductive().

Parameters
[in]timeout_millisTimeout in millis to wait for the device to become available. If timeout_millis is set to 0, this function will block indefinitely. If timeout_millis is set to -1, this function will check once and return immediately.
Returns
true if the device became available w/in timeout_millis, false otherwise.
Exceptions
ifm3d::error_ton error

◆ WaitForRecovery()

bool ifm3d::SWUpdater::WaitForRecovery ( long  timeout_millis = 0)

Polls on status of the device, waiting for it to present in recovery mode.

Should be used following a call to RebootToRecovery().

Parameters
[in]timeout_millisTimeout in millis to wait for the recovery system to become available. If timeout_millis is set to 0, this function will block indefinitely. If timeout_millis is set to -1, this function will check once and return immediately.
Returns
true if the recovery system became available w/in timeout_millis, false otherwise.
Exceptions
ifm3d::error_ton error

The documentation for this class was generated from the following file: