aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2015-12-12 11:44:39 -0800
committerJakob Odersky <jodersky@gmail.com>2015-12-16 21:55:45 -0800
commit7453888b0188a2aeff06b8e9893118b889f8d828 (patch)
tree8e6ef2498ff2aaeac7241f3df71200c422f0f1cb /README.md
parenteab2e148c7605ca0fd836bbe9230734895cce7d0 (diff)
downloadakka-serial-7453888b0188a2aeff06b8e9893118b889f8d828.tar.gz
akka-serial-7453888b0188a2aeff06b8e9893118b889f8d828.tar.bz2
akka-serial-7453888b0188a2aeff06b8e9893118b889f8d828.zip
create website
Diffstat (limited to 'README.md')
-rw-r--r--README.md81
1 files changed, 8 insertions, 73 deletions
diff --git a/README.md b/README.md
index c8a1f89..4cb6c63 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
[![Join the chat at https://gitter.im/jodersky/flow](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jodersky/flow?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
# flow
-Serial communication library for Scala, designed to be reactive, lightweight and easily integrable with Akka applications.
+Serial communication library for Scala, designed to be reactive, lightweight and easily integrable with Akka applications. See the [website]("https://jodersky.github.io/flow") for a guide.
## Highlights
- Reactive: only does work when required (no constant polling of ports or blocking IO)
@@ -10,89 +10,24 @@ Serial communication library for Scala, designed to be reactive, lightweight and
- Portable to POSIX systems
- Watchable ports: react to connection of new devices
-## Usage
-See [Documentation](Documentation/README.md) for a guide on flow.
-
-For the impatient, here is a quick example.
-
-```scala
-import akka.actor.{Actor, ActorLogging, ActorRef, Props, Terminated}
-import akka.io.IO
-import akka.util.ByteString
-import com.github.jodersky.flow.{Serial, SerialSettings}
-
-/**
- * Sample actor representing a simple terminal.
- */
-class Terminal(port: String, settings: SerialSettings) extends Actor with ActorLogging {
- import context._
-
- override def preStart() = {
- log.info(s"Requesting manager to open port: ${port}, baud: ${settings.baud}")
- IO(Serial) ! Serial.Open(port, settings)
- }
-
- def receive: Receive = {
-
- case Serial.CommandFailed(cmd, reason) =>
- log.error(s"Connection failed, stopping terminal. Reason: ${reason}")
- context stop self
-
- case Serial.Opened(port) =>
- log.info(s"Port ${port} is now open.")
- context become opened(sender)
- context watch sender // get notified in the event the operator crashes
-
- }
-
- def opened(operator: ActorRef): Receive = {
-
- case Serial.Received(data) =>
- log.info(s"Received data: " + data)
-
- case Serial.Closed =>
- log.info("Operator closed normally, exiting terminal.")
- context stop self
-
- case Terminated(`operator`) =>
- log.error("Operator crashed unexpectedly, exiting terminal.")
- context stop self
-
- case ":q" =>
- operator ! Serial.Close
-
- case str: String =>
- operator ! Serial.Write(ByteString(str))
-
- }
-
-}
-
-object Terminal {
- def apply(port: String, settings: SerialSettings) =
- Props(classOf[Terminal], port, settings)
-}
-```
-
-More examples on flow's usage are located in the `flow-samples` directory. The examples may be run with sbt: `flow-samples-<sample_name>/run`.
-
-Since flow integrates into the Akka-IO framework, a good resource on its general design is the framework's [documentation](http://doc.akka.io/docs/akka/2.4.1/scala/io.html).
-
## Native side
Since hardware is involved in serial communication, a Scala-only solution is not possible. Nevertherless, the native code is kept simple and minimalistic with the burden of dealing with threads left to Scala. The code aims to be POSIX compliant and therefore easily portable.
## Directory Structure
```
flow/
-├── Documentation Documentation files.
├── flow-main Main scala source files.
-├── flow-native C sources used to back serial communication.
+├── flow-native C sources used to implement serial communication.
├── flow-samples Runnable example projects.
-└── project SBT configuration.
+├── notes Release notes.
+├── project SBT configuration.
+└── site Website sources, including documentation.
```
## Build
-See detailed documentation in [Documentation/building.md](Documentation/building.md) on how to build and install flow.
+Detailed documentation on building flow is available on the website.
+
+Since flow integrates into the Akka-IO framework, a good resource on its general design is the framework's [documentation](http://doc.akka.io/docs/akka/2.4.1/scala/io.html).
## Copying
flow is released under the terms of the 3-clause BSD license. See LICENSE for details.