Skip to main content

OTAUpgradeManger

class OTAUpgradeManger

Description: Upgrade Management

    class OTAUpgradeManger private constructor() : IOTAUpgradeManager {
/**
* checking response bean hashmap with key and value
*/
val mutableMap = ObservableMap<String, CheckResponseBean.Data>()

/**
* OTA app Map
*/
val mutableAppMap = ObservableMap<String, CheckResponseBean.Data>()
/**
* TFC card reponse bean storage
*/
var mTFCardMutableMap = ObservableMap<String, CheckResponseBean.Data>()
/**
* OTA version state
*/
val mutableNewOTAVersion = MutableLiveData<Boolean>()
/**
* new app version state
*/
val mutableNewAppVersion = MutableLiveData<Boolean>()
/**
* product info hashmap
*/
var productInfoMap: MutableMap<String, RegisterProductBean> = mutableMapOf()
/**
* Firmware dialog show state
*/
var isFirmwareDialogShowing = MutableLiveData<Boolean>()
/**
* app dialog show state
*/
var isAppDialogShowing = MutableLiveData<Boolean>()

/**
* incoming upgrades flag
*/
var isInUpgrade: Boolean = false

/**
* gnd upgrade manager
*/
var mGndUpgradeManger: UpgradeManger = UpgradeManger().init(UpgradeClientTypeEnum.CLIENT_TYPE_GND)

/**
* drone version holder live data
*/
private val mDroneVersionLiveData = MutableLiveData<String>()

/**
* app type
*/
var mAppType : String = "Enterprise"
/**
* drone type
*/
var mDroneType : String = "ModelX"

/**
* remote type
*/
var mRemoteType : String = "RC79"
}

method initProductType

    fun initProductType(appType : String, droneType : String, remoteType : String) 

Description: Init product type with all default values

Input parameters: appType: application type droneType: drone type remoteType: remote type

Output parameters: None。

Related parameters: None。

method getUpgradeManger

    fun getUpgradeManger(clientType: UpgradeClientTypeEnum): UpgradeManger 

Description: Get client type of upgrade OTA

Input parameters: clientType: passing client time upgrade type

Output parameters: Upgrade manager object with match of client

Related parameters: None。

method detectRemoteVersionInfo

    fun detectRemoteVersionInfo() 

Description: Detect remote info with first remote device state setting

Input parameters: None。

Output parameters: None。

Related parameters: None。

method updateDroneVersion

    fun updateDroneVersion(version: String) 

Description: Update drone version

Input parameters: version: drone version

Output parameters: None。

Related parameters: None。

method detectRemoteUpdateInfo

    fun detectRemoteUpdateInfo() 

Description: Detect app update info state setting

Input parameters: None。

Output parameters: None。

Related parameters: None。

method waitDroneVersion

    suspend fun waitDroneVersion(): String? 

Description: Drone version returning suspended function

Input parameters: None。

Output parameters: Drone version returning

Related parameters: None。

method observeDroneVersion

    private fun observeDroneVersion(observer: Observer<String>) 

Description: add observer

Input parameters: observer: drone version observation

Output parameters: None。

Related parameters: None。

method removeObserver

    private fun removeObserver(observer: Observer<String>) 

Description: remove observer

Input parameters: observer: drone version observation

Output parameters: None。

Related parameters: None。

method detectAppUpdateInfo

    fun detectAppUpdateInfo() 

Description: Delete app update information

Input parameters: None。

Output parameters: None。

Related parameters: None。

method checkProducts

    private fun checkProducts(pkg_ver: String, product_model: String, product_sn: String) 

Description: Check products with some data

Input parameters: pkg_ver: package version product_model: product model data product_sn: product sr number

Output parameters: None。

Related parameters: None。

method checkProducts

    fun checkProducts(checkProsRequestBean: CheckProsRequestBean) 

Description: Check product with request model

Input parameters: checkProsRequestBean: products request model

Output parameters: None。

Related parameters: None。

method notifyUpdateNotAvailable

    fun notifyUpdateNotAvailable() 

Description: Notify update not available

Input parameters: None。

Output parameters: None。

Related parameters: None。

method notifyUpdateAvailable

    fun notifyUpdateAvailable() 

Description: Notify update available

Input parameters: None。

Output parameters: None。

Related parameters: None。

method downloadFile

    fun downloadFile(url: String, fileName: String, downloadCallback: FileTransmitListener<File>): S3DownloadInterceptor 

Description: Downloading file from url

Input parameters: url: url of that particular file fileName: file name which would be download downloadCallback: download call back passing with object

Output parameters: Download exception returning

Related parameters: None。

method downloadAppFile

    fun downloadAppFile(url: String, fileName: String, downloadCallback: FileTransmitListener<File>): S3DownloadInterceptor 

Description: Downloading app file from url

Input parameters: url: url of that particular file fileName: file name which would be download downloadCallback: download call back passing with object

Output parameters: None。

Related parameters: None。

    /**
* OTA software detection listener
*/
interface OTASoftwareDetect {
/**
* new software detection method
* @param displayNewSoftware boolean data passes true/false
*/
fun onNewSoftwareDetected(displayNewSoftware: Boolean)
}