GSUpdater
@objc
public protocol GSUpdater : Peripheral
Updater peripheral interface for Drone and RemoteControl devices.
Allows to:
- Know if there is a locally available firmware that is suitable to update the device.
- Request to update the device using such a firmware.
This peripheral can be retrieved by:
id<GSUpdater> updater = (id<GSUpdater>)[drone getPeripheral:GSPeripherals.updater];
Note
This protocol is for Objective-C only. Swift must use the protocolUpdater
-
All firmwares that are required to be downloaded to update the device to the latest available version.
The array is ordered by firmware application order: first firmwares in the list must be applied before subsequent ones in order to update the device.
Declaration
Swift
@objc(downloadableFirmwares) var gsDownloadableFirmwares: [GSFirmwareInfo] { get }
-
Whether the device is currently up-to-date.
Declaration
Swift
var isUpToDate: Bool { get }
-
Current firmware download operation state, if any is ongoing.
Declaration
Swift
@objc(currentDownload) var gsCurrentDownload: GSUpdaterDownload? { get }
-
All firmwares that are required to be applied to update the device to the latest available version.
The array is ordered by firmware application order: first firmwares in the list must be applied before subsequent ones in order to update the device.
Declaration
Swift
@objc(applicableFirmwares) var gsApplicableFirmwares: [GSFirmwareInfo] { get }
-
Current update operation state, if any is ongoing.
Declaration
Swift
@objc(currentUpdate) var gsCurrentUpdate: GSUpdaterUpdate? { get }
-
Ideal version.
This version is not necessarily local. It is the version that the drone will reach if all downloadable firmwares are downloaded and if all applicable updates are applied. This version is
nil
if there is no downloadable firmwares and no applicable firmwares.Note
This version might differ from the greater version of all downloadable and applicable firmwares if, and only if, the ideal firmware is local but cannot be applied because an intermediate, not downloaded, firmware is required first.Declaration
Swift
var idealVersion: FirmwareVersion? { get }
-
Requests download of the next downloadable firmware that should be applied to update the device towards the latest available version.
This method does nothing but return
false
ifdownloadUnavailabilityReasons
is not empty, or if there is nodownloadableFirmwares
.Declaration
Swift
@discardableResult func downloadNextFirmware() -> Bool
Return Value
true
if the download started -
Requests download of all downloadable firmware that should be applied to update the device to the latest available version.
This method does nothing but return
false
ifdownloadUnavailabilityReasons
is not empty, or if there is nodownloadableFirmwares
.Declaration
Swift
@discardableResult func downloadAllFirmwares() -> Bool
Return Value
true
if the download started -
Cancels an ongoing firmware(s) download operation.
Declaration
Swift
@discardableResult func cancelDownload() -> Bool
Return Value
true
if an ongoing firmware download operation has been canceled -
Requests device update to the next currently applicable firmware version.
This method does nothing but return
false
ifupdateUnavailabilityReasons
is not empty, or if there is noapplicableFirmwares
.Declaration
Swift
@discardableResult func updateToNextFirmware() -> Bool
Return Value
true
if the update started -
Requests device update to the latest applicable firmware version.
This method will update the device by applying all
applicableFirmwares
in order, until the device is up-to-date. After each firmware is applied, the device will reboot. The application has the responsibility to ensure to reconnect to the device after the update, so that this peripheral may proceed automatically with the next firmware update, if any.This method does nothing but return
false
ifupdateUnavailabilityReasons
is not empty, or if there is noapplicableFirmwares
.Declaration
Swift
@discardableResult func updateToLatestFirmware() -> Bool
Return Value
true
if the update started -
Cancels an ongoing firmware(s) update operation.
Declaration
Swift
@discardableResult func cancelUpdate() -> Bool
Return Value
true
if an ongoing firmware update operation has been canceled -
Tells whether download is not available (partly) due to the given reason.
Declaration
Swift
func isPreventingDownload(reason: UpdaterDownloadUnavailabilityReason) -> Bool
Parameters
reason
the reason to query
Return Value
true
if the reason is preventing any download to start -
Tells whether update is not available (partly) due to the given reason.
Declaration
Swift
func isPreventingUpdate(reason: UpdaterUpdateUnavailabilityReason) -> Bool
Parameters
reason
the reason to query
Return Value
true
if the reason is preventing any update to start