chipweinberger / flutter_blue_plus

Flutter plugin for connecting and communicationg with Bluetooth Low Energy devices, on Android, iOS, macOS
Other
791 stars 479 forks source link

[Help]: Repeated connect and disconnected results in erratic behavior #816

Closed Marika-Fukazawa closed 8 months ago

Marika-Fukazawa commented 8 months ago

Requirements

Have you checked this problem on the example app?

No

FlutterBluePlus Version

1.31.16

Flutter Version

3.19.3

What OS?

Android

OS Version

Android 13

Bluetooth Module

Mobile integrated

What is your problem?

My app uses AutoConnect to repeatedly connect and disconnect from peripherals. When using FlutterBluePlus 1.31.16, as it repeatedly connects and disconnects, the connection relationship logs increase and the same indicate is processed multiple times. We have confirmed that this does not occur in versions prior to 1.31.15.

I will paste a simple sample code to connect with AutoConnect when disconnected and the logs from running it. (The code for the scanning part is omitted) After the initial connection, I disconnected from the peripheral, then sent advertisements from the peripheral, waited for the connection, and disconnected from the peripheral, repeating 5 times.

            try {
              await peripheral.connect(timeout: const Duration(seconds: 5), autoConnect: false, mtu: 512);
              print("1st connect!!!!!!!");
            } catch (e) {
              print(e);
              return;
            }

            _connectionStateSubscription ??= peripheral.connectionState.listen((BluetoothConnectionState state) async {
              if (state == BluetoothConnectionState.disconnected) {
                print("disconnected: ${peripheral.disconnectReason.toString()}");
                _isConnecting = false;
                if (!_isAutoConnected) {
                  try {
                    await peripheral.connect(autoConnect: true, mtu: null);
                    print("2nd connect!!!!!!!!");
                    _isAutoConnected = true;
                  } catch (e) {
                    print(e);
                    return;
                  }
                }
              }
            });

Logs

D/[FBP-Android](22309): [FBP] onMethodCall: flutterHotRestart
D/[FBP-Android](22309): [FBP] initializing BluetoothAdapter
D/[FBP-Android](22309): [FBP] disconnectAllDevices(flutterHotRestart)
D/[FBP-Android](22309): [FBP] connectedPeripherals: 0
D/[FBP-Android](22309): [FBP] onMethodCall: getAdapterState
I/flutter (22309):    INFO: BleService - Adapter State: BluetoothAdapterState.on
D/[FBP-Android](22309): [FBP] onMethodCall: startScan
D/BluetoothAdapter(22309): isLeEnabled(): ON
D/BluetoothLeScanner(22309): onScannerRegistered() - status=0 scannerId=8 mScannerId=0
I/flutter (22309):   DEBUG: CognitoTokenTimer - CognitoTokenTimer _count=3340 expired=3360
D/[FBP-Android](22309): [FBP] onMethodCall: stopScan
D/BluetoothAdapter(22309): isLeEnabled(): ON
D/[FBP-Android](22309): [FBP] onMethodCall: startScan
D/BluetoothAdapter(22309): isLeEnabled(): ON
D/BluetoothLeScanner(22309): onScannerRegistered() - status=0 scannerId=8 mScannerId=0
I/flutter (22309):   DEBUG: BleService - CB112233
I/flutter (22309):   DEBUG: BleService - CB112233
D/[FBP-Android](22309): [FBP] onMethodCall: stopScan
D/BluetoothAdapter(22309): isLeEnabled(): ON
D/[FBP-Android](22309): [FBP] onMethodCall: connect
D/BluetoothGatt(22309): connect() - device: AA:AA:AA:AA:AA:AA, auto: false, eattSupport: false
D/BluetoothGatt(22309): registerApp()
D/BluetoothGatt(22309): registerApp() - UUID=5d33a690-1853-40b1-9d2a-c54ac0ef5c66
D/BluetoothGatt(22309): onClientRegistered() - status=0 clientIf=8
D/BluetoothGatt(22309): onClientConnectionState() - status=0 clientIf=8 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:connected
D/[FBP-Android](22309): [FBP]   status: SUCCESS
D/[FBP-Android](22309): [FBP] onMethodCall: requestMtu
D/BluetoothGatt(22309): configureMTU() - device: AA:AA:AA:AA:AA:AA mtu: 512
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConfigureMTU() - Device=AA:AA:AA:AA:AA:AA mtu=256 status=0
D/[FBP-Android](22309): [FBP] onMtuChanged:
D/[FBP-Android](22309): [FBP]   mtu: 256
D/[FBP-Android](22309): [FBP]   status: GATT_SUCCESS (0)
I/flutter (22309): 1st connect!!!!!!!
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=36 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onClientConnectionState() - status=19 clientIf=8 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:disconnected
D/[FBP-Android](22309): [FBP]   status: REMOTE_USER_TERMINATED_CONNECTION
D/BluetoothGatt(22309): close()
D/BluetoothGatt(22309): unregisterApp() - mClientIf=8
I/flutter (22309): disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 19, REMOTE_USER_TERMINATED_CONNECTION}
D/[FBP-Android](22309): [FBP] onMethodCall: connect
D/BluetoothGatt(22309): connect() - device: AA:AA:AA:AA:AA:AA, auto: true, eattSupport: false
D/BluetoothGatt(22309): registerApp()
D/BluetoothGatt(22309): registerApp() - UUID=28877738-bd2e-410f-be07-16519ddf3084
I/flutter (22309): 2nd connect!!!!!!!!
D/BluetoothGatt(22309): onClientRegistered() - status=0 clientIf=8
D/BluetoothGatt(22309): onClientConnectionState() - status=0 clientIf=8 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:connected
D/[FBP-Android](22309): [FBP]   status: SUCCESS
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=36 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onClientConnectionState() - status=19 clientIf=8 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:disconnected
D/[FBP-Android](22309): [FBP]   status: REMOTE_USER_TERMINATED_CONNECTION
D/[FBP-Android](22309): [FBP] autoconnect is true. skipping gatt.close()
I/flutter (22309): disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 19, REMOTE_USER_TERMINATED_CONNECTION}
D/[FBP-Android](22309): [FBP] onMethodCall: connect
D/BluetoothGatt(22309): connect() - device: AA:AA:AA:AA:AA:AA, auto: true, eattSupport: false
D/BluetoothGatt(22309): registerApp()
D/BluetoothGatt(22309): registerApp() - UUID=290d2536-ced4-4ce1-9751-7d0efc55c123
D/BluetoothGatt(22309): onClientRegistered() - status=0 clientIf=9
D/BluetoothGatt(22309): onClientConnectionState() - status=0 clientIf=8 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:connected
D/BluetoothGatt(22309): onClientConnectionState() - status=0 clientIf=9 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP]   status: SUCCESS
D/[FBP-Android](22309): [FBP] onConnectionStateChange:connected
D/[FBP-Android](22309): [FBP]   status: SUCCESS
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=36 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=36 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onClientConnectionState() - status=19 clientIf=8 device=AA:AA:AA:AA:AA:AA
D/BluetoothGatt(22309): onClientConnectionState() - status=19 clientIf=9 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:disconnected
D/[FBP-Android](22309): [FBP] onConnectionStateChange:disconnected
D/[FBP-Android](22309): [FBP]   status: REMOTE_USER_TERMINATED_CONNECTION
D/[FBP-Android](22309): [FBP]   status: REMOTE_USER_TERMINATED_CONNECTION
D/[FBP-Android](22309): [FBP] autoconnect is true. skipping gatt.close()
D/[FBP-Android](22309): [FBP] autoconnect is true. skipping gatt.close()
I/flutter (22309): disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 19, REMOTE_USER_TERMINATED_CONNECTION}
D/[FBP-Android](22309): [FBP] onMethodCall: connect
I/flutter (22309): disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 19, REMOTE_USER_TERMINATED_CONNECTION}
D/BluetoothGatt(22309): connect() - device: AA:AA:AA:AA:AA:AA, auto: true, eattSupport: false
D/BluetoothGatt(22309): registerApp()
D/BluetoothGatt(22309): registerApp() - UUID=e8f978ac-1f66-4fe3-9b86-5ff19343bf53
D/BluetoothGatt(22309): onClientRegistered() - status=0 clientIf=10
D/[FBP-Android](22309): [FBP] onMethodCall: connect
D/[FBP-Android](22309): [FBP] already connecting
D/BluetoothGatt(22309): onClientConnectionState() - status=0 clientIf=8 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:connected
D/BluetoothGatt(22309): onClientConnectionState() - status=0 clientIf=10 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP]   status: SUCCESS
D/[FBP-Android](22309): [FBP] onConnectionStateChange:connected
D/[FBP-Android](22309): [FBP]   status: SUCCESS
D/BluetoothGatt(22309): onClientConnectionState() - status=0 clientIf=9 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:connected
D/[FBP-Android](22309): [FBP]   status: SUCCESS
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=36 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=36 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=36 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onClientConnectionState() - status=19 clientIf=8 device=AA:AA:AA:AA:AA:AA
D/BluetoothGatt(22309): onClientConnectionState() - status=19 clientIf=9 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:disconnected
D/BluetoothGatt(22309): onClientConnectionState() - status=19 clientIf=10 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP]   status: REMOTE_USER_TERMINATED_CONNECTION
D/[FBP-Android](22309): [FBP] onConnectionStateChange:disconnected
D/[FBP-Android](22309): [FBP] onConnectionStateChange:disconnected
D/[FBP-Android](22309): [FBP]   status: REMOTE_USER_TERMINATED_CONNECTION
D/[FBP-Android](22309): [FBP] autoconnect is true. skipping gatt.close()
D/[FBP-Android](22309): [FBP]   status: REMOTE_USER_TERMINATED_CONNECTION
D/[FBP-Android](22309): [FBP] autoconnect is true. skipping gatt.close()
D/[FBP-Android](22309): [FBP] autoconnect is true. skipping gatt.close()
I/flutter (22309): disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 19, REMOTE_USER_TERMINATED_CONNECTION}
I/flutter (22309): disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 19, REMOTE_USER_TERMINATED_CONNECTION}
D/[FBP-Android](22309): [FBP] onMethodCall: connect
I/flutter (22309): disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 19, REMOTE_USER_TERMINATED_CONNECTION}
D/BluetoothGatt(22309): connect() - device: AA:AA:AA:AA:AA:AA, auto: true, eattSupport: false
D/BluetoothGatt(22309): registerApp()
D/BluetoothGatt(22309): registerApp() - UUID=444d3067-efe7-431d-a1ea-e9ca7ff21069
D/BluetoothGatt(22309): onClientRegistered() - status=0 clientIf=11
D/[FBP-Android](22309): [FBP] onMethodCall: connect
D/[FBP-Android](22309): [FBP] already connecting
D/[FBP-Android](22309): [FBP] onMethodCall: connect
D/[FBP-Android](22309): [FBP] already connecting
D/BluetoothGatt(22309): onClientConnectionState() - status=0 clientIf=8 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:connected
D/[FBP-Android](22309): [FBP]   status: SUCCESS
D/BluetoothGatt(22309): onClientConnectionState() - status=0 clientIf=11 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:connected
D/[FBP-Android](22309): [FBP]   status: SUCCESS
D/BluetoothGatt(22309): onClientConnectionState() - status=0 clientIf=9 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:connected
D/BluetoothGatt(22309): onClientConnectionState() - status=0 clientIf=10 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP]   status: SUCCESS
D/[FBP-Android](22309): [FBP] onConnectionStateChange:connected
D/[FBP-Android](22309): [FBP]   status: SUCCESS
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=36 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=36 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=36 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=36 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onClientConnectionState() - status=19 clientIf=8 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:disconnected
D/[FBP-Android](22309): [FBP]   status: REMOTE_USER_TERMINATED_CONNECTION
D/BluetoothGatt(22309): onClientConnectionState() - status=19 clientIf=10 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] autoconnect is true. skipping gatt.close()
D/BluetoothGatt(22309): onClientConnectionState() - status=19 clientIf=11 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:disconnected
D/[FBP-Android](22309): [FBP]   status: REMOTE_USER_TERMINATED_CONNECTION
D/[FBP-Android](22309): [FBP] autoconnect is true. skipping gatt.close()
D/BluetoothGatt(22309): onClientConnectionState() - status=19 clientIf=9 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:disconnected
D/[FBP-Android](22309): [FBP]   status: REMOTE_USER_TERMINATED_CONNECTION
D/[FBP-Android](22309): [FBP] autoconnect is true. skipping gatt.close()
D/[FBP-Android](22309): [FBP] onConnectionStateChange:disconnected
D/[FBP-Android](22309): [FBP]   status: REMOTE_USER_TERMINATED_CONNECTION
I/flutter (22309): disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 19, REMOTE_USER_TERMINATED_CONNECTION}
D/[FBP-Android](22309): [FBP] autoconnect is true. skipping gatt.close()
D/[FBP-Android](22309): [FBP] onMethodCall: connect
I/flutter (22309): disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 19, REMOTE_USER_TERMINATED_CONNECTION}
I/flutter (22309): disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 19, REMOTE_USER_TERMINATED_CONNECTION}
D/BluetoothGatt(22309): connect() - device: AA:AA:AA:AA:AA:AA, auto: true, eattSupport: false
D/BluetoothGatt(22309): registerApp()
D/BluetoothGatt(22309): registerApp() - UUID=b1386683-cc10-4670-b9e4-e005af8517bf
I/flutter (22309): disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 19, REMOTE_USER_TERMINATED_CONNECTION}
D/BluetoothGatt(22309): onClientRegistered() - status=0 clientIf=12
D/[FBP-Android](22309): [FBP] onMethodCall: connect
D/[FBP-Android](22309): [FBP] already connecting
D/[FBP-Android](22309): [FBP] onMethodCall: connect
D/[FBP-Android](22309): [FBP] already connecting
D/[FBP-Android](22309): [FBP] onMethodCall: connect
D/[FBP-Android](22309): [FBP] already connecting
D/BluetoothGatt(22309): onClientConnectionState() - status=0 clientIf=8 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:connected
D/[FBP-Android](22309): [FBP]   status: SUCCESS
D/BluetoothGatt(22309): onClientConnectionState() - status=0 clientIf=9 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:connected
D/BluetoothGatt(22309): onClientConnectionState() - status=0 clientIf=10 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:connected
D/BluetoothGatt(22309): onClientConnectionState() - status=0 clientIf=11 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP]   status: SUCCESS
D/[FBP-Android](22309): [FBP] onConnectionStateChange:connected
D/[FBP-Android](22309): [FBP]   status: SUCCESS
D/BluetoothGatt(22309): onClientConnectionState() - status=0 clientIf=12 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP]   status: SUCCESS
D/[FBP-Android](22309): [FBP] onConnectionStateChange:connected
D/[FBP-Android](22309): [FBP]   status: SUCCESS
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=36 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=36 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=36 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=36 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onConnectionUpdated() - Device=AA:AA:AA:AA:AA:AA interval=36 latency=0 timeout=500 status=0
D/BluetoothGatt(22309): onClientConnectionState() - status=19 clientIf=8 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:disconnected
D/BluetoothGatt(22309): onClientConnectionState() - status=19 clientIf=10 device=AA:AA:AA:AA:AA:AA
D/BluetoothGatt(22309): onClientConnectionState() - status=19 clientIf=11 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP]   status: REMOTE_USER_TERMINATED_CONNECTION
D/[FBP-Android](22309): [FBP] onConnectionStateChange:disconnected
D/[FBP-Android](22309): [FBP] onConnectionStateChange:disconnected
D/[FBP-Android](22309): [FBP] autoconnect is true. skipping gatt.close()
D/[FBP-Android](22309): [FBP]   status: REMOTE_USER_TERMINATED_CONNECTION
D/[FBP-Android](22309): [FBP]   status: REMOTE_USER_TERMINATED_CONNECTION
D/[FBP-Android](22309): [FBP] autoconnect is true. skipping gatt.close()
D/BluetoothGatt(22309): onClientConnectionState() - status=19 clientIf=12 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:disconnected
D/[FBP-Android](22309): [FBP]   status: REMOTE_USER_TERMINATED_CONNECTION
D/[FBP-Android](22309): [FBP] autoconnect is true. skipping gatt.close()
I/flutter (22309): disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 19, REMOTE_USER_TERMINATED_CONNECTION}
D/[FBP-Android](22309): [FBP] autoconnect is true. skipping gatt.close()
D/BluetoothGatt(22309): onClientConnectionState() - status=19 clientIf=9 device=AA:AA:AA:AA:AA:AA
D/[FBP-Android](22309): [FBP] onConnectionStateChange:disconnected
D/[FBP-Android](22309): [FBP]   status: REMOTE_USER_TERMINATED_CONNECTION
D/[FBP-Android](22309): [FBP] autoconnect is true. skipping gatt.close()
I/flutter (22309): disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 19, REMOTE_USER_TERMINATED_CONNECTION}
D/[FBP-Android](22309): [FBP] onMethodCall: connect
I/flutter (22309): disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 19, REMOTE_USER_TERMINATED_CONNECTION}
D/BluetoothGatt(22309): connect() - device: AA:AA:AA:AA:AA:AA, auto: true, eattSupport: false
D/BluetoothGatt(22309): registerApp()
D/BluetoothGatt(22309): registerApp() - UUID=eec68e48-4968-490d-9977-6b067278e282
I/flutter (22309): disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 19, REMOTE_USER_TERMINATED_CONNECTION}
I/flutter (22309): disconnected: DisconnectReason{platform: ErrorPlatform.android, code: 19, REMOTE_USER_TERMINATED_CONNECTION}
D/BluetoothGatt(22309): onClientRegistered() - status=0 clientIf=13
D/[FBP-Android](22309): [FBP] onMethodCall: connect
D/[FBP-Android](22309): [FBP] already connecting
D/[FBP-Android](22309): [FBP] onMethodCall: connect
D/[FBP-Android](22309): [FBP] already connecting
D/[FBP-Android](22309): [FBP] onMethodCall: connect
D/[FBP-Android](22309): [FBP] already connecting
D/[FBP-Android](22309): [FBP] onMethodCall: connect
D/[FBP-Android](22309): [FBP] already connecting
chipweinberger commented 8 months ago

could be due to this: https://github.com/boskokg/flutter_blue_plus/commit/0fa2610e9fdfc813d9580c3bd132b710861e11fe

perhaps it should be this (adding a check for Platform.isAndroid):

        if (_autoConnect.contains(r.remoteId)) {
          if (_adapterStateNow == BmAdapterStateEnum.on) {
            if (Platform.isAndroid == false) {
               var d = BluetoothDevice(remoteId: r.remoteId);
               d.connect(autoConnect: true, mtu: null);
             }
          }
        }
chipweinberger commented 8 months ago

should be fixed 1.31.17