Skip to main content

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)

Address: mac address of the bracelet

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

A Recovery process is necessary if the DFU has started but was broken in the middle (BLE off, app killed). It is rare but can happen. The bracelet will be off (lights off) even on the charger. To restore the bracelet, the DFU needs to be restarted on the app.

Scenarios when it could happen:

  • DFU interrupted, or app killed Promp a pop-up to restart the DFU

  • Patient “panicked” and uninstalled the app During the scanning phase, scan for device with recovery, and prompt a pop-up if detected, restart DFU.

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