Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.

Releases

No releases published

Packages

No packages published

Languages