BleGattCoroutines: Receive channel's poll fails when dicoverServices is called and keeps app stuck

When we call our device’s deviceConnection.discoverServices() it calls the method written at line 317 of com/beepiz/bluetooth/gattcoroutines/GattConnectionImpl.kt, gattRequest. This method receives a channel (ch: ReceiveChannel<GattResponse<E>>) for the request purpose and after a few instructions calls ch.reveice() on this channel. That’s when the problem occours.

The channel throws an error internally the polls fails (as the following print shows) and the exceution goes all the levels up, like when an exception is thrown, but this time without any clue of an error being thrown: image

These are the last captured logs:

D/BluetoothAdapter: STATE_ON
D/BluetoothGatt: connect() - device: 00:15:90:91:CE:C2, auto: false
D/BluetoothAdapter: isSecureModeEnabled
D/BluetoothGatt: registerApp()
D/BluetoothGatt: registerApp() - UUID=5ab39c56-c260-4491-9cac-58843c486207
D/BluetoothGatt: onClientRegistered() - status=0 clientIf=8
D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=8 device=00:15:90:91:CE:C2
D/BluetoothGatt: onConnectionUpdated() - Device=00:15:90:91:CE:C2 interval=16 latency=0 timeout=800 status=0
D/BluetoothGatt: onConnectionUpdated() - Device=00:15:90:91:CE:C2 interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt: onConnectionUpdated() - Device=00:15:90:91:CE:C2 interval=16 latency=0 timeout=800 status=0
D/BluetoothGatt: discoverServices() - device: 00:15:90:91:CE:C2
D/BluetoothGatt: onSearchComplete() = Device=00:15:90:91:CE:C2 Status=0

I tried to capture any thrown exception around the discoverServices() call, but the cursor never comes back to my code after that ch.receive() call.

About this issue

Most upvoted comments

My bad, it’s defined in buildSrc/build.gradle.kts

On Wed, Jan 22, 2020, 12:53 Luiz Machado notifications@github.com wrote:

You sure? I see no gradle version in there.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Beepiz/BleGattCoroutines/issues/57?email_source=notifications&email_token=ABVG6BMVALLJRIAFVRVRCELQ7AXSTA5CNFSM4KIMUEWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJTI3QQ#issuecomment-577146306, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVG6BLSNKH54CYYXMM6XUTQ7AXSTANCNFSM4KIMUEWA .