reactive-serial

Reactive Streams API for Serial Communication

Reactive Streams for Serial Communication

Reactive Streams wrapper for jSerialComm.

Available at OSS Sonatype for 2.11:

libraryDependencies += "com.github.jarlakxen" %% "reactive-serial" % "1.3"

Example usage

import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import akka.stream.scaladsl.{Sink, Source}
import com.github.jarlakxen.reactive.serial.ReactiveSerial

implicit val actorSystem = ActorSystem("ReactiveSerial")
implicit val materializer = ActorMaterializer()

val serialPort = ReactiveSerial.port("/dev/ttyUSB0")

val serial = ReactiveSerial(port = serialPort, baudRate = 57600)

val publisher: Publisher[ByteString] = serial.publisher(bufferSize=100)
val subscriber: Subscriber[ByteString] = serial.subscriber(requestStrategyProvider=ZeroRequestStrategy)

Source.fromPublisher(publisher).map(_.message().toUpperCase).to(Sink.fromSubscriber(subscriber)).run()

Related Repositories

akka-serial

akka-serial

Reactive serial communication library for Akka and Scala. ...

flow

flow

Reactive serial communication library for Akka and Scala. ...

reactive-serial

reactive-serial

Reactive Streams API for Serial Communication ...


Top Contributors

Jarlakxen

Releases

-   v1.4 zip tar
-   v1.3 zip tar
-   v1.2 zip tar
-   v1.1 zip tar
-   v1.0 zip tar