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);