Created
August 10, 2020 16:56
-
-
Save shiehnpin/5a89722a42a129b2861f73a138ca681a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val conn = device.establishConnection(false) | |
conn | |
.flatMap(rxBleConnection -> rxBleConnection.setupNotification(battTxCharUuid)) | |
.doOnNext(notificationObservable -> { | |
conn.writeCharacteristic(battRxCharUuid,cmd).subscribe(); | |
}) | |
.flatMap(notificationObservable -> notificationObservable) // <-- Notification has been set up, now observe value changes. | |
.subscribe( | |
bytes -> { | |
// Given characteristic has been changes, here is the value. | |
}, | |
throwable -> { | |
// Handle an error here. | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment