Two issues about DFU library.
See original GitHub issueWe find two issues in the DFU library and also find the solution. Maybe Nordic can review and join them if they are actually useful.
- During our testing, we find out dfu library will be hanged up if the mobile phone turn off Bluetooth during OTA. After the mobile phone turn on Bluetooth, dfu library still can’t back to normal status. dfu will keep hanging up status unless app restarts.
After our testing, we find if we add “mLock.notifyAll()” code in the mBluetoothStateBroadcastReceiver below. This question will be solved.
private final BroadcastReceiver mBluetoothStateBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(final Context context, final Intent intent) {
final int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.STATE_OFF);
final int previousState = intent.getIntExtra(BluetoothAdapter.EXTRA_PREVIOUS_STATE, BluetoothAdapter.STATE_ON);
logw("Action received: android.bluetooth.adapter.action.STATE_CHANGED [state: " + state + ", previous state: " + previousState + "]");
if (previousState == BluetoothAdapter.STATE_ON
&& (state == BluetoothAdapter.STATE_TURNING_OFF || state == BluetoothAdapter.STATE_OFF)) {
sendLogBroadcast(LOG_LEVEL_WARNING, "Bluetooth adapter disabled");
mConnectionState = STATE_DISCONNECTED;
if (mDfuServiceImpl != null)
mDfuServiceImpl.getGattCallback().onDisconnected();
// Notify waiting thread
synchronized (mLock) {
mLock.notifyAll();
}
}
}
};
- In the Nordic BLE library, connectGatt command have different parameters in different android version, like below (I remove some log information):
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
final int preferredPhy = connectRequest.getPreferredPhy();
bluetoothGatt = device.connectGatt(context, false, gattCallback,
BluetoothDevice.TRANSPORT_LE, preferredPhy/*, handler*/);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
bluetoothGatt = device.connectGatt(context, false, gattCallback,
BluetoothDevice.TRANSPORT_LE);
} else {
bluetoothGatt = device.connectGatt(context, false, gattCallback);
}
But in the DFU library, connectGatt command only use one method.
final BluetoothGatt gatt = device.connectGatt(this, false, mGattCallback);
During out testing, some Android mobile sometimes can’t connect successfully if we only use the DFU connectGatt command. (Like HTC U11). Maybe you can review it and consider to alert these parts.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Issues · NordicSemiconductor/Android-DFU-Library - GitHub
Issues list ; Nordic Uart services integration in Android DFU Library Source Code: #368 opened on Oct 12 ; Unable to write Op...
Read more >Android DFU library not working for Samsung phones on ...
Recently we found that Samsung phones running on Android 10 have a problem with DFU both on our app and when using the...
Read more >NordicDFU - Swift Package Index
OTA DFU Library for Mac and iOS, compatible with nRF5x SoCs ... There are 10 open issues and 2 open pull requests. The...
Read more >Bluetooth in DFU mode: connection always fails for some ...
So, here is my description on the github issue : I've been struggling with this the last two days and I can't find...
Read more >USB device firmware update (DFU) for Kinetis MCUs - NXP
The USB DFU bootloader is able to enumerate in two ways: ... If using CW10.x, build each library individually (bsp_m52259evb, psp_m52259evb, etc) as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Released.
Thank you for your contribution! I’ll fix the issues soon.