characteristicValue -> { UserError.Log.d(TAG, "Wrote keep-alive request successfully"); speakSlowly(); // is this really needed here? parent.unBond(); parent.instantCreateBondIfAllowed(); speakSlowly(); connection.writeCharacteristic(Authentication, nn(new BondRequestTxMessage().byteSequence)) .subscribe( bondRequestValue -> { UserError.Log.d(TAG, "Wrote bond request value: " + JoH.bytesToHex(bondRequestValue)); speakSlowly(); connection.readCharacteristic(Authentication) .observeOn(Schedulers.io())
characteristicValue -> { UserError.Log.d(TAG, "Wrote keep-alive request successfully"); speakSlowly(); // is this really needed here? parent.unBond(); parent.instantCreateBondIfAllowed(); speakSlowly(); connection.writeCharacteristic(Authentication, nn(new BondRequestTxMessage().byteSequence)) .subscribe( bondRequestValue -> { UserError.Log.d(TAG, "Wrote bond request value: " + JoH.bytesToHex(bondRequestValue)); speakSlowly(); connection.readCharacteristic(Authentication) .observeOn(Schedulers.io())
characteristicValue -> { UserError.Log.d(TAG, "Wrote keep-alive request successfully"); speakSlowly(); // is this really needed here? parent.unBond(); parent.instantCreateBondIfAllowed(); speakSlowly(); connection.writeCharacteristic(Authentication, nn(new BondRequestTxMessage().byteSequence)) .subscribe( bondRequestValue -> { UserError.Log.d(TAG, "Wrote bond request value: " + JoH.bytesToHex(bondRequestValue)); speakSlowly(); connection.readCharacteristic(Authentication) .observeOn(Schedulers.io())
@SuppressLint("CheckResult") private static void disconnectNow(Ob1G5CollectionService parent, RxBleConnection connection) { // tell device to disconnect now UserError.Log.d(TAG, "Disconnect NOW: " + JoH.dateTimeText(JoH.tsl())); speakSlowly(); connection.writeCharacteristic(Control, nn(new DisconnectTxMessage().byteSequence)) .timeout(2, TimeUnit.SECONDS) // .observeOn(Schedulers.newThread()) // .subscribeOn(Schedulers.newThread()) .subscribe(disconnectValue -> { if (d) UserError.Log.d(TAG, "Wrote disconnect request"); parent.changeState(Ob1G5CollectionService.STATE.CLOSE); throw new OperationSuccess("Requested Disconnect"); }, throwable -> { if (!(throwable instanceof OperationSuccess)) { UserError.Log.d(TAG, "Disconnect NOW failure: " + JoH.dateTimeText(JoH.tsl())); if (throwable instanceof BleDisconnectedException) { UserError.Log.d(TAG, "Failed to write DisconnectTxMessage as already disconnected: " + throwable); } else { UserError.Log.e(TAG, "Failed to write DisconnectTxMessage: " + throwable); } parent.changeState(Ob1G5CollectionService.STATE.CLOSE); } }); UserError.Log.d(TAG, "Disconnect NOW exit: " + JoH.dateTimeText(JoH.tsl())); }
@SuppressLint("CheckResult") private static void disconnectNow(Ob1G5CollectionService parent, RxBleConnection connection) { // tell device to disconnect now UserError.Log.d(TAG, "Disconnect NOW: " + JoH.dateTimeText(JoH.tsl())); speakSlowly(); connection.writeCharacteristic(Control, nn(new DisconnectTxMessage().byteSequence)) .timeout(2, TimeUnit.SECONDS) // .observeOn(Schedulers.newThread()) // .subscribeOn(Schedulers.newThread()) .subscribe(disconnectValue -> { if (d) UserError.Log.d(TAG, "Wrote disconnect request"); parent.changeState(Ob1G5CollectionService.STATE.CLOSE); throw new OperationSuccess("Requested Disconnect"); }, throwable -> { if (!(throwable instanceof OperationSuccess)) { UserError.Log.d(TAG, "Disconnect NOW failure: " + JoH.dateTimeText(JoH.tsl())); if (throwable instanceof BleDisconnectedException) { UserError.Log.d(TAG, "Failed to write DisconnectTxMessage as already disconnected: " + throwable); } else { UserError.Log.e(TAG, "Failed to write DisconnectTxMessage: " + throwable); } parent.changeState(Ob1G5CollectionService.STATE.CLOSE); } }); UserError.Log.d(TAG, "Disconnect NOW exit: " + JoH.dateTimeText(JoH.tsl())); }
@SuppressLint("CheckResult") private static void disconnectNow(Ob1G5CollectionService parent, RxBleConnection connection) { // tell device to disconnect now UserError.Log.d(TAG, "Disconnect NOW: " + JoH.dateTimeText(JoH.tsl())); speakSlowly(); connection.writeCharacteristic(Control, nn(new DisconnectTxMessage().byteSequence)) .timeout(2, TimeUnit.SECONDS) // .observeOn(Schedulers.newThread()) // .subscribeOn(Schedulers.newThread()) .subscribe(disconnectValue -> { if (d) UserError.Log.d(TAG, "Wrote disconnect request"); parent.changeState(Ob1G5CollectionService.STATE.CLOSE); throw new OperationSuccess("Requested Disconnect"); }, throwable -> { if (!(throwable instanceof OperationSuccess)) { UserError.Log.d(TAG, "Disconnect NOW failure: " + JoH.dateTimeText(JoH.tsl())); if (throwable instanceof BleDisconnectedException) { UserError.Log.d(TAG, "Failed to write DisconnectTxMessage as already disconnected: " + throwable); } else { UserError.Log.e(TAG, "Failed to write DisconnectTxMessage: " + throwable); } parent.changeState(Ob1G5CollectionService.STATE.CLOSE); } }); UserError.Log.d(TAG, "Disconnect NOW exit: " + JoH.dateTimeText(JoH.tsl())); }
speakSlowly(); connection.readCharacteristic(Authentication).subscribe( readValue -> {
speakSlowly(); connection.readCharacteristic(Authentication).subscribe( readValue -> {
speakSlowly(); connection.readCharacteristic(Authentication).subscribe( readValue -> {
challenge_value -> { speakSlowly();
challenge_value -> { speakSlowly();
challenge_value -> { speakSlowly();