OTA upgrade process reference:

1. Preconditions:
  1. The device power is greater than 30% (this value is defined according to the specific product, and the APP can be customized, such as 40%, as long as it is greater than the minimum power limit of the firmware)

  2. The device needs to be connected

2. Check the upgrade
  1. According to the device firmware version information https://idoosmart.github.io/Native_GitBook/en/doc/IDODeviceInfo.html, "${fwVersion1}.${fwVersion2}.${fwVersion3}"

Call OTA according to the interface (server implementation)

  1. After determining that there is an upgrade, download the file to the device according to the ota file address returned by the server
3. Execute the upgrade
  1. Call the file transfer interface and transfer the ota file to the device

  2. After the transfer is completed, the device will automatically enter the upgrade state, and the Bluetooth connection will be disconnected during the period

  3. The device will restart after the upgrade is completed, and the upgrade process ends

Example reference:

Device OTA upgrade is not complicated, you can think of it as just a process of transferring a file to the device

SDK has only one method for transferring all files, reference:

https://idoosmart.github.io/Native_GitBook/en/doc/transfer/IDOFileTransfer.html

The following code in the example is the firmware upgrade:

var items = mutableListOf<IDOTransBaseModel>()

// Firmware
items.add(IDOTransNormalModel(fileType: IDOTransType.FW , filePath: "/xx/xx/xx.fw[bin|zip]", fileName: "xx"))

// Call transfer
val cancelable = sdk.transfer.transferFiles(
items, cancelPre,
{ currentIndex, totalCount, currentProgress, totalProgress ->
print("Transmitting ${currentIndex + 1}/$totalCount...")
},
{ currentIndex: Int, status: IDOTransStatus, errorCode: Int?, finishingTime: Int? ->
if (status != IDOTransStatus .FINISHED || errorCode != 0) {
print("Transmission failed: $errorCode")
}
},
{resultList-> resultList.forEach {
if (it){
//Transmission successful
}else{
//Transfer failed
}
}})
Copyright © 2023-2024 IDO. All rights reserved. all right reserved,powered by Gitbook修改日期: 2024-06-27 14:17:39

results matching ""

    No results matching ""