wheresmycookie
wheresmycookie

Reputation: 763

RxAndroidBle on Android - requesting MTU and then reading from connection

In RxAndroidBle, I want to set the MTU and then read a characteristic from the connection.

device
    .establishConnection(false)
    .flatMapSingle(conn -> conn.requestMtu(64))
    .flatMapSingle(mtu -> <?>);

I'd like to then do a conn.readCharacteristic, but I don't have a reference to conn after raising the MTU.

I'm fairly new to RxJava2 so maybe I'm missing something at a conceptual level. Could anybody provide any insight here?

Upvotes: 0

Views: 172

Answers (1)

ConstOrVar
ConstOrVar

Reputation: 2085

You can do it like that

device
    .establishConnection(false)
    .flatMapSingle(conn -> conn.requestMtu(64)
        .flatMap(mtu -> conn.readCharacteristic()))

Upvotes: 1

Related Questions