DFU SDK
Is DFU needed
CorsanoDfu.getInstance().needDfu(
currentDevice.deviceInfo.hardwareId!!.value,
currentDevice.deviceInfo.firmwareVersion!!
)
Get latest FW version available
val fw = CorsanoDfu.getInstance().getLatestFirmwareVersion(
currentDevice?.deviceInfo?.hardwareId!!.value
)
Start DFU
Use the following command
CorsanoDfu.getInstance().startDfu(address, hardwareId)
Hardware ID:
B1: 51
B2: 54
Hardware ID enum:
enum class HardwareId(val value: Int) {
WATCH_287N(50),
BRACELET_287N(51),
BRACELET_287N_2B(54),
WATCH_284N(38),
UNKNOWN(-1);
Listen to DFU events
`override fun onStart() {
super.onStart()
CorsanoDfu.getInstance().addDfuListener(this)
}
override fun onStop() {
CorsanoDfu.getInstance().removeDfuStatusListener(this)
super.onStop()
}`
DFU recovery
When a DFU fails after starting the process, the device is in what we call a recovery mode.To recover the bracelet, it needs a DFU.Recovery bracelet can be detected during the scan with the type BRACELET_1B_NEED_RECOVERY or BRACELET_2B_NEED_RECOVERY