andengineering / AndroidSampleCode

Sample Android code to show connectivity with A&D devices
10 stars 7 forks source link

Getting Type_Gatt_Error with status 133 while connecting to AND UA651BLE #2

Open RoohiZuwairiyah opened 6 years ago

RoohiZuwairiyah commented 6 years ago

I am trying to connect to AnD UA-651BLE blood pressure monitor and get the values in an android app. The app is able to find the device but I am getting Type_Gatt_Error in 'onConnectionStateChange'.

This is working fine for certain devices like samsung galaxy S5, Moto G4 etc. but not for certain phones like redmi 3s prime, etc.

This works well and i am able to read data, when i unpair the device and re pair it everytime. I am not able to understand anything as i am new to android-ble integration.

Is this something related to target SDK versions? I found similar issues has been raised by many in the portal, but didnt find any resolution working for me.

Can anyone please make me understand why this is happening and what is the possible resolution?

Below are the Logs i get in Android studio:

D/MYTAG: DashBoard UnBonded Device false true D/MYTAG: Found device - =*****A&D_UA-651BLE_459701 D/SN: RESU connectDevice device 6C:EC:EB:45:97:01 D/BluetoothManager: getConnectionState() D/BluetoothManager: getConnectedDevices W/SN: RESU Attempt to connect in state: 0 D/BluetoothGatt: connect() - device: 6C:EC:EB:45:97:01, auto: false D/BluetoothGatt: registerApp() D/BluetoothGatt: registerApp() - UUID=e7ed0993-f27a-4e2a-bc08-93b76d55a4d5 D/SN: RESU bluetoothGatt android.bluetooth.BluetoothGatt@47015f2 D/MYTAG: CAlling connectDevice from Dashboard REPLY= true D/BluetoothAdapter: stopLeScan() D/BluetoothGatt: onClientRegistered() - status=0 clientIf=10 D/BluetoothAdapter: STATE_ON D/MYTAG: DashBoard UnBonded Device true true D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=10 device=6C:EC:EB:45:97:01 D/SN: RESU Inside bluetoothGattCallback : onConnectionStateChange D/SN: MYTAG DashBoard onReceive TYPE_GATT_ERROR D/SN: RESU onConnectionStateChange()6C:EC:EB:45:97:01, A&D_UA-651BLE_459701, status=133 newState=0 D/SN: MYTAG Disconnect Device D/SN: MYTAG DashBoard onReceive TYPE_GATT_DISCONNECTED D/BluetoothGatt: close() D/BluetoothGatt: unregisterApp() - mClientIf=10 D/BluetoothGatt: cancelOpen() - device: 6C:EC:EB:45:97:01 D/MYTAG: * CAlling startLeScan D/BluetoothAdapter: startLeScan(): null D/BluetoothAdapter: STATE_ON D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=9 I/Choreographer: Skipped 60 frames! The application may be doing too much work on its main thread. D/MYTAG: Found device - =*****A&D_UA-651BLE_459701 D/SN: RESU connectDevice device 6C:EC:EB:45:97:01 D/BluetoothManager: getConnectionState() D/BluetoothManager: getConnectedDevices W/SN: RESU Attempt to connect in state: 0 D/BluetoothGatt: connect() - device: 6C:EC:EB:45:97:01, auto: false D/BluetoothGatt: registerApp() D/BluetoothGatt: registerApp() - UUID=c9f450d6-a78e-4190-8c8c-89ce7c5bcb17 D/SN: RESU bluetoothGatt android.bluetooth.BluetoothGatt@a2caac0 D/MYTAG: CAlling connectDevice from Dashboard REPLY= true D/BluetoothAdapter: stopLeScan() D/BluetoothGatt: onClientRegistered() - status=0 clientIf=10 D/BluetoothAdapter: STATE_ON D/MYTAG: DashBoard UnBonded Device true true D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=10 device=6C:EC:EB:45:97:01 D/SN: RESU Inside bluetoothGattCallback : onConnectionStateChange D/SN: MYTAG DashBoard onReceive TYPE_GATT_ERROR D/SN: RESU onConnectionStateChange()6C:EC:EB:45:97:01, A&D_UA-651BLE_459701, status=133 newState=0 D/SN: MYTAG Disconnect Device D/SN: MYTAG DashBoard onReceive TYPE_GATT_DISCONNECTED D/BluetoothGatt: close() D/BluetoothGatt: unregisterApp() - mClientIf=10 D/BluetoothGatt: cancelOpen() - device: 6C:EC:EB:45:97:01 D/MYTAG: * CAlling startLeScan D/BluetoothAdapter: startLeScan(): null D/BluetoothAdapter: STATE_ON D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=9 I/Choreographer: Skipped 60 frames! The application may be doing too much work on its main thread. D/MYTAG: Found device - =*****A&D_UA-651BLE_459701 D/SN: RESU connectDevice device 6C:EC:EB:45:97:01 D/BluetoothManager: getConnectionState() D/BluetoothManager: getConnectedDevices W/SN: RESU Attempt to connect in state: 0 D/BluetoothGatt: connect() - device: 6C:EC:EB:45:97:01, auto: false D/BluetoothGatt: registerApp() D/BluetoothGatt: registerApp() - UUID=04b0cc2e-ee24-4515-b41b-d93d1fb54aa3 D/SN: RESU bluetoothGatt android.bluetooth.BluetoothGatt@c659f3e D/MYTAG: CAlling connectDevice from Dashboard REPLY= true D/BluetoothAdapter: stopLeScan() D/BluetoothGatt: onClientRegistered() - status=0 clientIf=10 D/BluetoothAdapter: STATE_ON D/MYTAG: DashBoard UnBonded Device true true D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=10 device=6C:EC:EB:45:97:01 D/SN: RESU Inside bluetoothGattCallback : onConnectionStateChange D/SN: MYTAG DashBoard onReceive TYPE_GATT_ERROR D/SN: RESU onConnectionStateChange()6C:EC:EB:45:97:01, A&D_UA-651BLE_459701, status=133 newState=0 D/SN: MYTAG Disconnect Device D/SN: MYTAG DashBoard onReceive TYPE_GATT_DISCONNECTED D/BluetoothGatt: close() D/BluetoothGatt: unregisterApp() - mClientIf=10 D/BluetoothGatt: cancelOpen() - device: 6C:EC:EB:45:97:01 D/MYTAG: * CAlling startLeScan D/BluetoothAdapter: startLeScan(): null D/BluetoothAdapter: STATE_ON D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=9 I/Choreographer: Skipped 60 frames! The application may be doing too much work on its main thread. D/MYTAG: Found device - =Mi Band HRX D/MYTAG: DashBoard UnBonded Device false true D/MYTAG: Found device - =null

@sim0512 can you please suggest me on this?

megatechitsystem commented 3 years ago

Hi same error . can you help . Below are the logs

2021-07-23 12:57:53.832 31479-31479/jp.co.aandd.cdltestapp D/SN: connectDevice device name A&D_UA-651BLE_3ABF8B 2021-07-23 12:57:54.281 31479-31499/jp.co.aandd.cdltestapp D/A&D: GATT connection not successful 2021-07-23 12:57:54.282 31479-31499/jp.co.aandd.cdltestapp D/A&D: onConnectionStateChange()C8:FD:19:3A:BF:8B, A&D_UA-651BLE_3ABF8B, status=133 newState=0

ajayld commented 1 year ago

Facing the same issue with compileSDK and targetSDK set to 33 and I get a status 133 in onConnectionStateChange(). It works when both are set to 23. Any clue?