diff options
author | Peter Rustler <peter.rustler@basyskom.com> | 2015-05-06 10:34:27 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-05-11 13:42:15 +0000 |
commit | 68e8dbcecbac24fbc42c2d50251b5dc410eb106f (patch) | |
tree | 6e19d9538398b14d4efbf5a2193af33a09648635 | |
parent | e686b22a119c53f8ea4abc1a96f0fb15e37277fe (diff) |
Bugfix: Bluetooth Le for Android need to close BluetoothGatt
Android can only handle a defined count of simultaneously connections to bluetooth le
devices. Every Android device have a different defined amount of possible simultaneously connections.
If we do not close the connection and reconnect to the device or another device,
the count of used connections get up. If we exceed the maximum connection count we can not connect
to bluetooth le devices anymore.
The only way to recover is to restart the application to reset the open connection count.
This patch closes the connection after it has been disconnected.
Change-Id: Id96a69ef07eb973216495a0ba8e46fd639338165
Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
-rw-r--r-- | src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java b/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java index f6c41e31..e5711426 100644 --- a/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java +++ b/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java @@ -133,6 +133,8 @@ public class QtBluetoothLE { resetData(); // reset mBluetoothGatt, reusing same object is not very reliable // sometimes it reconnects and sometimes it does not. + if (mBluetoothGatt != null) + mBluetoothGatt.close(); mBluetoothGatt = null; break; case BluetoothProfile.STATE_CONNECTED: |