Device EPO Upgrade
Function Overview
Epo upgrade management (supported by v4.0.41 and above), used to control automatic and manual epo upgrade management.
IDOEpoManager
Properties
enableAutoUpgrade
Enable automatic epo upgrade, default is: off
status
Current upgrade status IDOEpoUpgradeStatus
isSupported
Is epo upgrade supported?
delegateGetGps
The app provides the current mobile phone GPS information for quick device positioning, IDOEpoManagerDelegate
Methods
lastUpdateTimestamp(completion:)
Get the timestamp of the last update, in milliseconds
Parameters:
completion: Returns 0 if no record is found
shouldUpdateForEPO(isForce:completion:)
Is update required
Parameters:
isForce: Force update
- completion: completion callback
willStartInstall(isForce:retryCount:)
Start the upgrade task
- Parameters:
- isForce: Whether to force update
- retryCount: Number of retries, no retries by default
stop()
Stop the upgrade task
Note: epo has been transferred to the device, and the device is performing an upgrade. This situation cannot be terminated
listenEpoUpgrade(funcStatus:downProgress:sendProgress:funcComplete:)
Listen for epo upgrade callback (global listening once)
- Parameters:
- funcStatus: Upgrade status
- downProgress: Download progress
- sendProgress: Send progress
- completion: completion callback
Example
Swift
// 1. Initialize, configure and set listener (global listening once)
IDOEpoManager.shared.enableAutoUpgrade = true // Enable automatic upgrade (optional)
IDOEpoManager.shared.delegateGetGps = self
IDOEpoManager.shared.listenEpoUpgrade { status in
print("epo---- status:\(status)")
} downProgress: { progress in
print("epo---- down progress:\(progress)")
} sendProgress: { progress in
print("epo---- send progress:\(progress)")
} funcComplete: { errCode in
print("epo---- complete:\(errCode)")
}
// 2. Proxy implementation
extension SomeClass: IDOEpoManagerDelegate{
func getAppGpsInfo() -> protocol_channel.IDOOtaGpsInfo? {
// !!!: The longitude and latitude here are pseudocodes. The actual scene needs to use the coordinates located by the mobile phone
return IDOOtaGpsInfo(longitude: 114.0579, latitude: 22.5431, altitude: 10)
}
}
// 3. Execute epo upgrade(This method does not need to be called if only automatic upgrade is required)
IDOEpoManager.shared.willStartInstall(isForce: true, retryCount: 0)
Kotlin
// 1. Initialize, configure and set listener (global listener once)
IDOEpoManager.shared.enableAutoUpgrade = true // Enable automatic upgrade (optional)
IDOEpoManager.shared.delegateGetGps = EpoListen()
IDOEpoManager.shared.listenEpoUpgrade(
{ status ->
println("epo---- status: $status")
},
{ progress ->
println("epo---- down progress: $progress")
},
{ progress ->
println("epo---- send progress: $progress")
},
{ errCode ->
println("epo---- complete: $errCode")
}
)
// 2. Proxy implementation
inner class EpoListen : IDOEpoManagerDelegate {
override fun getAppGpsInfo(): IDOOtaGpsInfo {
// !!!: The longitude and latitude here are pseudocodes. The actual scene needs to use the coordinates located by the mobile phone
return IDOOtaGpsInfo(114.0579f, 22.5431f, 10.0f)
}
}
// 3. Manually perform epo upgrade (do not call this method if only automatic upgrade is required)
IDOEpoManager.shared.willStartInstall(isForce: true, retryCount: 0)