当我尝试打开通知后连接ble时,通常返回BleGattException status = 133,有时有时候不会。BleGattException状态返回133(onClientConnectionState() - status = 133)
这是我的代码:
mConnectingDevice.establishConnection(false)
.doOnNext(this::storeConnect)
.flatMap(rxBleConnection -> rxBleConnection.setupNotification(notifyUuid))
.observeOn(AndroidSchedulers.mainThread())
.flatMap(notificationObservable -> notificationObservable)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::onNotify, this::connectFail);
connectFail返回BleGattException状态= 133
这是打印日志//后面我的评论:
08-22 14:12:00.777 31399-31399/com.evan.yeeuusample D/BluetoothAdapter: STATE_ON
08-22 14:12:00.781 31399-31399/com.evan.yeeuusample D/BluetoothGatt: connect() - device: F0:65:A0:1A:20:16, auto: false
mConnectingDevice.establishConnection(假)
08-22 14:12:00.781 31399-31399/com.evan.yeeuusample D/BluetoothGatt: registerApp()
08-22 14:12:00.782 31399-31399/com.evan.yeeuusample D/BluetoothGatt: registerApp() - UUID=58cec16e-bb91-4603-bd28-11da0e5e17c0
08-22 14:12:00.785 31399-31410/com.evan.yeeuusample D/BluetoothGatt: onClientRegistered() - status=0 clientIf=5
08-22 14:12:02.965 31399-31410/com.evan.yeeuusample D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=5
device=F0:65:A0:1A:20:16
connectstatus 133
08-22 14:12:02.969 31399-31399/com.evan.yeeuusample D/BluetoothManager: getConnectionState()
08-22 14:12:02.970 31399-31399/com.evan.yeeuusample D/BluetoothManager: getConnectedDevices
08-22 14:12:02.997 31399-31399/com.evan.yeeuusample D/BluetoothGatt: close()
连接失败关贸总协定接近
08-22 14:12:02.997 31399-31399/com.evan.yeeuusample D/BluetoothGatt: unregisterApp() - mClientIf=5
继续尝试连接:
08-22 14:17:35.278 31399-31399/com.evan.yeeuusample D/BluetoothGatt: connect() - device: F0:65:A0:1A:20:16, auto: false
08-22 14:17:35.278 31399-31399/com.evan.yeeuusample D/BluetoothGatt: registerApp()
08-22 14:17:35.278 31399-31399/com.evan.yeeuusample D/BluetoothGatt: registerApp() - UUID=b8fa445c-aab2-46d1-b2c2-e67bb475caf9
08-22 14:17:35.280 31399-31411/com.evan.yeeuusample D/BluetoothGatt: onClientRegistered() - status=0 clientIf=5
08-22 14:17:43.666 31399-31441/com.evan.yeeuusample D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=5 device=F0:65:A0:1A:20:16
无法再次连接! 有没有解决方法?我不知道为什么连接状态是133,gatt已关闭!现在这个状态经常发生,帮助我谢谢你。
BleGattException status return 133
这似乎是一个较低级别的Android BLE堆栈问题。你检查过HCI snoop日志吗?你用什么手机?什么外设? –
智能设备蓝牙模块是北欧的,我用过华为和小米都是这样的一种现象,我现在在做doOnUububscribe()方法重新连接,问题肯定存在@DariuszSeweryn –