This file contains hidden or 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
println("Start") |
This file contains hidden or 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
restConfiguration().component("netty4-http").host("0.0.0.0").port(8081).bindingMode(RestBindingMode.json); | |
rest("/api/devices").get().route().to("bluetooth://scan?serviceDiscovery=true"); |
This file contains hidden or 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
private static class ScannerRoute extends RouteBuilder { | |
@Override | |
public void configure() throws Exception { | |
from("bluetooth://scan?consumer.delay=1000") | |
.to("pi4j-gpio://1?mode=DIGITAL_OUTPUT&state=LOW&action=BLINK") | |
.choice() | |
.when(deviceWithName(DEVICE_NAME)) | |
.process(p -> p.getIn().setHeader(DEVICE_FOUND, true)) | |
.otherwise() |
This file contains hidden or 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
def executor = new ThreadPoolExecutor( | |
cores, cores, | |
0L, TimeUnit.MILLISECONDS, | |
new LinkedBlockingQueue<Runnable>(1000)) | |
DefaultFiberNode addFiber(OperationDefinition fiberDefinition) { | |
RxHelper.toObservable(vertx.eventBus().consumer(fiberDefinition.address())) | |
.flatMap({ data -> | |
Observable.just(data) | |
.subscribeOn(Schedulers.from(executor)) |
This file contains hidden or 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
import static org.hamcrest.core.Every.everyItem; | |
import static org.hamcrest.core.Is.is; | |
import static org.hamcrest.core.IsNot.not; | |
import static org.junit.Assert.assertThat; | |
import java.util.Arrays; | |
import java.util.Collection; | |
import org.junit.Test; |