Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jarlakxen/reactive-serial
Reactive Streams API for Serial Communication
https://github.com/jarlakxen/reactive-serial
akka reactive-streams scala serial
Last synced: 2 months ago
JSON representation
Reactive Streams API for Serial Communication
- Host: GitHub
- URL: https://github.com/jarlakxen/reactive-serial
- Owner: Jarlakxen
- License: apache-2.0
- Created: 2015-09-02T01:40:57.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-13T23:34:54.000Z (about 8 years ago)
- Last Synced: 2024-04-16T07:18:34.743Z (10 months ago)
- Topics: akka, reactive-streams, scala, serial
- Language: Scala
- Size: 23.4 KB
- Stars: 26
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Reactive Streams for Serial Communication
[Reactive Streams](http://www.reactive-streams.org) wrapper for [jSerialComm](http://fazecast.github.io/jSerialComm/).
Available for 2.11 and 2.12:
````scala
resolvers += Resolver.bintrayRepo("jarlakxen", "maven")
libraryDependencies += "com.github.jarlakxen" %% "reactive-serial" % "1.4"
````Example usage
----```Scala
import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import akka.stream.scaladsl.{Sink, Source}
import com.github.jarlakxen.reactive.serial.ReactiveSerialimplicit 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()
```