6

BleGattException - 在第一次读写操作期间发生,有时它可以正确读写,但在重新连接 ble 设备后会出现此异常...

 if (bleManager.getMacAddress() != null && checkIsSameMac(peripheralModel.address) && bleManager.getConnectionSubscription() != null) {
        bleManager.getConnectionSubscription().flatMap(RxBleConnection::discoverServices)
                .observeOn(AndroidSchedulers.mainThread())
                .first() // Disconnect automatically after discovery
                .subscribe(swapScanResult -> {
                    Log.e("write and read", "discover success");
                    firstWriteCharacteristic(peripheralModel);
                }, this::onConnectionFailure);
4

0 回答 0