FirmwareUpdateManager
public protocol FirmwareUpdateManager : AnyObject
Provides a way to check, apply and execute firmware updates.
-
Publishes current firmware update state.
Declaration
Swift
var state: AnyPublisher<FirmwareUpdateState, Never> { get }
-
Checks for updates and publishes the available updates info or an error.
If vid/pid is provided, SDK will overwrite tag vid/pid and check updates. After success response, update info will be wrapped with tag vid/pid again to apply tag updates.
Declaration
Swift
func checkUpdates( vendorID: String?, productID: String?, forceCheck: Bool ) -> AnyPublisher<[DFUUpdateInfo], FirmwareUpdateError>
-
Applies updates on the device. Publishes result as success/failure.
Declaration
Swift
func applyUpdates( _ updates: [DFUUpdateInfo], shouldAutoExecute: Bool ) -> AnyPublisher<FirmwareUpdateState, Never>
Parameters
updates
list of update info to be applied.
shouldAutoExecute
‘true’ if the firmware should be auto executed after transfer complete.
-
Activates the uploaded firmware binaries and reboots the relevant hardware to run the updated code.
Declaration
Swift
func executeUpdates()
-
Checks firmware update for loadable modules and publishes array of updates if available or an error.
Declaration
Swift
func checkModuleUpdates(_ modules: [Module], forceCheck: Bool) -> DFUUpdatePublisher
Parameters
modules
List of
Module
for which the update has to be checked.forceCheck
If
true
, api will check for update info from cloud instead of cache. -
Checks all loadable module updates and publish the available updates or an error.
Declaration
Swift
func checkModuleUpdates(forceCheck: Bool) -> DFUUpdatePublisher
Parameters
forceCheck
If
true
, api will check for update info from cloud instead of cache. -
Stops the firmware transfer process.
Throws an exception if updates has invalid state to stop the transfer process. States other than
preparingForTransfer
,transferring
andtransferred
are not valid states to stop the process.Declaration
Swift
func stopUpdates() throws
-
applyModuleUpdates(_:
Extension method) Apply module updates. Publishes result as success/failure. Auto execute should be
true
as module does not require execution part.Declaration
Swift
public func applyModuleUpdates( _ updates: [DFUUpdateInfo] ) -> AnyPublisher<FirmwareUpdateState, Never>
Parameters
updates
list of module update info to be applied.
-
checkUpdates(forceCheck:
Extension method) Checks for updates and publishes the available updates info or an error.
Declaration
Swift
public func checkUpdates(forceCheck: Bool) -> AnyPublisher<[DFUUpdateInfo], FirmwareUpdateError>
Parameters
forceCheck
If
true
, api will check for update info from cloud instead of cache.