Java
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
example-android
example-pc
gradle/wrapper
rxioio
.gitignore
LICENSE.txt
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
local.properties
settings.gradle

README.md

RxIoio

Reactive APIs for IOIO. Designed to work alongside the standard IOIOLooper paradigm.

Inspired by libraries such as RxBinding and Rx Preferences.

Usage

// ...
@Override
public IOIOLooper createIOIOLooper(String connectionType, Object extra) {
    return new IOIOLooper() {
        @Override
        public void setup(IOIO ioio) throws ConnectionLostException, InterruptedException {
            RxIoio rxIoio = RxIoio.create(ioio);
            // ...
        }

        @Override
        public void disconnected() {
            disposable.dispose();
        }

        // ...
    }
}
// ...

Input

// ...
RxIoio rxIoio = RxIoio.create(ioio);
disposable = rxIoio
    .digitalInput(BUTTON_INPUT_PIN)
    .subscribeWith(new DisposableSubscriber<Boolean>() {
        @Override
        public void onNext(Boolean aBoolean) {
            System.out.println("Button pressed: " + aBoolean);
        }
        // ...
    }
// ...

Output

// ...
RxIoio rxIoio = RxIoio.create(ioio);

disposable = rxFlowable // Whereas rxFlowable provides a stream of Boolean objects.
    .lift(rxIoio.digitalOutput(STAT_LED_PIN))
    .subscribeWith(new DisposableSubscriber<Boolean>() {
        @Override
        public void onNext(Boolean aBoolean) {
            System.out.println("Setting stat LED pin to: " + aBoolean);
        }
        // ...
    }
// ...

See Android example or Desktop example for more details.