【问题标题】:Getting Type_Gatt_Error with status 133 while connecting to AND UA651BLE连接到 AND UA651BLE 时出现状态为 133 的 Type_Gatt_Error
【发布时间】:2018-09-11 04:06:11
【问题描述】:

我正在尝试连接到 AnD UA-651BLE 血压计并在 Android 应用程序中获取值。该应用程序能够找到该设备,但我在“onConnectionStateChange”中收到 Type_Gatt_Error。

这适用于三星 Galaxy S5、Moto G4 等某些设备,但不适用于 Redmi 3s Prime 等某些手机。

这很好用,我可以读取数据,当我取消配对设备并每次重新配对时。我无法理解任何东西,因为我是 android-ble 集成的新手。我尝试将目标 SDK 版本更改为 21 和 23,因为我主要使用 android 5.0.1 及更高版本的设备。但没有运气

我发现门户网站中许多人提出了类似的问题,但没有找到任何适合我的解决方案。

谁能让我理解为什么会发生这种情况以及可能的解决方案是什么?

以下是我在 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

【问题讨论】:

    标签: android android-studio bluetooth-lowenergy android-ble bluetooth-gatt


    【解决方案1】:

    gatt 133 错误没有单一的答案。但在过去,我收到过它们的原因如下:

    • 另一个设备已连接到我尝试连接的 BLE 设备。

    • 环境噪音太大。如果您在使用大量 2.4 ghz wifi 路由器和其他 BLE 设备广告的地方工作,它们将影响您与您尝试与之通信的 BLE 设备的距离。我的办公室有数百台设备,所以如果我距离所连接的设备超过约 3 英尺,我会得到很多 133。

    • 有时手机的 BLE 芯片似乎无法正常工作,重新启动它会解决问题。

    • 这是 很久 以前的事了,有点模糊,但有一段时间 iOS 设备可以连接到我们的 BLE 设备,但 Android 无法连接,并且在我们尝试时会收到 133 错误连接。我认为这是因为 BLE 设备的广告标志不是 LE General Discoverable Mode。

    为了调试,我喜欢使用两个应用程序:

    我认为这个应用正在使用 Android 平台的 BLE 库。因此,如果我的应用程序无法连接,我会仔细检查他们的应用程序是否也无法连接。如果可以,那么很可能是我的代码有问题。

    我认为这个应用程序在比 Android BLE 库更低的级别上使用 BLE。有时我的应用程序和 LightBlue 会得到 133,但 nRF Connect 可以成功连接。但是,如果它在大多数情况下确实以 133 失败,那是因为另一个设备已经连接到 BLE 设备,或者它已经损坏并且需要重置。在上述第四条的情况下,此应用还能够连接到我们的 BLE 设备。

    【讨论】:

      猜你喜欢
      • 2011-06-24
      • 1970-01-01
      • 1970-01-01
      • 2015-05-07
      • 1970-01-01
      • 1970-01-01
      • 2015-07-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多