STMicroelectronics / BlueSTSDK_Android

Bluetooth low energy Sensors Technology Software Development Kit (Android version)
https://www.st.com/en/embedded-software/bluest-sdk.html
BSD 3-Clause "New" or "Revised" License
92 stars 46 forks source link

Random disconnects #19

Open AviyaSmila opened 5 years ago

AviyaSmila commented 5 years ago

Hi, I`ve managed to connect to a custom device with the SDK but I have random disconnects that occur without any type pattern. What can be the reason for this kind of problem?

GiovanniVisentiniST commented 5 years ago

Hi,

what are you doing before the disconnection? could be that you are sending/receiving too much data? witch context do you use to connect, if the context die also your connection will die.. do you have any message from the log cat? (search for gatt and or bluetooth in the message tag, did not limit it to your application output)

Best Regards Giovanni

AviyaSmila commented 5 years ago

D/BluetoothGatt: onClientConnectionState() - status=8 clientIf=8 device=02:80:E1:00:00:AA D/Bluetooth name: is not null D/com.st.BlueSTSDK.Node: Node: PG_1234567890 Status: 8 newState: 0 boundState:10 D/BluetoothGatt: close() D/BluetoothGatt: unregisterApp() - mClientIf=8 D/Bluetooth name: is not null E/com.st.BlueSTSDK.Node: Error connecting to the node:PG_1234567890 D/Bluetooth name: is not null D/NodeStateListener: PG_1234567890 Connected->Dead D/Connection Status: Dead D/InputTransport: Input channel constructed: fd=69

This is the part where it disconnectss

GiovanniVisentiniST commented 5 years ago

the status 8 should be a timeout error.. what did you do before the status change?

AviyaSmila commented 5 years ago

sometimes it happens after sending data, sometimes after receiving data, sometimes it happens after doing nothing

AviyaSmila commented 5 years ago

??

AviyaSmila commented 5 years ago

@GiovanniVisentini ?

GiovanniVisentiniST commented 5 years ago

try to add some breakpoint/ Log.d here: https://github.com/STMicroelectronics/BlueSTSDK_Android/blob/40fdcbf46955a025191589c6cff0e189bb17a2c9/BlueSTSDK/src/main/java/com/st/BlueSTSDK/Node.java#L1853

and here: https://github.com/STMicroelectronics/BlueSTSDK_Android/blob/40fdcbf46955a025191589c6cff0e189bb17a2c9/BlueSTSDK/src/main/java/com/st/BlueSTSDK/Node.java#L1598

to see if you have some write/enable notification pending that goes on timeout

another test could be to use another app that just connect to the node and see if the disconnection happen anyway, to see if it is a fw problem

Best Regards Giovanni

AviyaSmila commented 5 years ago

I`ts not FW problem as other apps are keeping steady connection to the device