File tree Expand file tree Collapse file tree
ActiveLookSDK/src/main/java/com/activelook/activelooksdk/core/ble Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,13 +88,21 @@ void reconnect(final BluetoothDevice device) {
8888 this .gatt = this .gattDelegate ;
8989 }
9090
91- private void optimizeMtu (final int optimalMtu ) {
92- if (optimalMtu > this .mtu ) {
93- if (!this .gatt .requestMtu (optimalMtu )) {
94- this .optimizeMtu (optimalMtu - 1 );
91+ private void optimizeMtu (int optimalMtu ) {
92+ while (optimalMtu > this .mtu ) {
93+ if (this .gatt .requestMtu (optimalMtu )) {
94+ return ;
95+ }
96+ optimalMtu = optimalMtu - 1 ;
97+ }
98+ int errorCount = 0 ;
99+ while (!this .gatt .discoverServices ()) {
100+ errorCount = errorCount + 1 ;
101+ if (errorCount > 10 ) {
102+ this .unlockConnection ();
103+ this .disconnect ();
104+ return ;
95105 }
96- } else if (!this .gatt .discoverServices ()) {
97- this .optimizeMtu (optimalMtu );
98106 }
99107 }
100108
Original file line number Diff line number Diff line change 11# CHANGELOG
22
3+ ## Version 4.4.1
4+
5+ ### Fixes
6+ - Remove recursive call to avoid stackoverflow
7+
38## Version 4.4.0
49
510### Breaking changes
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ You can add the dependency in your application by modifying the application `bui
6565and add:
6666```
6767dependencies {
68- implementation 'com.github.activelook:android-sdk:v4.4.0 '
68+ implementation 'com.github.activelook:android-sdk:v4.4.1 '
6969}
7070```
7171
Original file line number Diff line number Diff line change 11// Top-level build file where you can add configuration options common to all sub-projects/modules.
22buildscript {
33 ext. sdkGroupId = " com.activelook"
4- ext. sdkVersionCode = 440
5- ext. sdkVersionName = ' 4.4.0 '
4+ ext. sdkVersionCode = 441
5+ ext. sdkVersionName = ' 4.4.1 '
66 ext. kotlin_version = ' 1.6.21'
77 repositories {
88 google()
You can’t perform that action at this time.
0 commit comments