Getting Type_Gatt_Error with status 133 while connecting to AND UA651BLE

╄→尐↘猪︶ㄣ 提交于 2020-01-03 19:30:50

问题


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. I tried to change the target SDK versions to 21 and 23 since i am mostly using android 5.0.1 and above devices. but no luck

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

回答1:


There is no single answer for gatt 133 errors. But in the past I have received them for the following:

  • Another device is connected to the BLE device I'm trying to connect to.

  • Too much noise in the environment. If you're working somewhere with a lot of 2.4 ghz wifi routers and other BLE devices advertising they will affect the distance you can be from the BLE device you're trying to communicate with. My office has hundreds of devices so if I'm more than ~3 feet from what I'm connected to I will get lots of 133's.

  • Then there are times when the phones BLE chip just doesn't seem to work and restarting it will fix it.

  • This was a long time ago and a bit fuzzy but there was a time iOS devices could connect to our BLE devices but Android couldn't and would get the 133 error when we tried to connect. I think it was because the BLE device's advertising flags weren't LE General Discoverable Mode.

To debug I like to use two apps:

  • LightBlue - https://play.google.com/store/apps/details?id=com.punchthrough.lightblueexplorer&hl=en_US

I think this app is using the Android platform's BLE library. So if my app can't connect I double check that theirs also can't. If it can then it's most likely something wrong with my code.

  • nRF Connect - https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp

I think this app is working with BLE on a lower level than the Android BLE library. There are times where my app and LightBlue get 133's but nRF Connect can successfully connect. But if it does fail with a 133 most of the time its because another device is connected to the BLE device already or it's crapped out and needs to be reset. This app was also able to connect to our BLE devices in the case of the fourth bullet above.



来源:https://stackoverflow.com/questions/52268499/getting-type-gatt-error-with-status-133-while-connecting-to-and-ua651ble

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!