bill-acceptor

rs-232 serial bill acceptor in scala and akka

git clone https://9o.is/git/bill-acceptor.git

commit f273a004d256972d3ed293cc39254e2771eb7879
parent b01af23e38ce0825cb52351ad592cf1879f7165a
Author: Jul <jul@9o.is>
Date:   Sun, 29 Mar 2015 08:03:06 -0400

Driver handles forced shutdown when disconnected.

FSM may send forced shutdown while in PowerUp or Connecting states. The driver is always disconnected during those states of the FSM.
Diffstat:
Mcore/src/main/scala/inc/pyc/bill/acceptor/driver/Driver.scala | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/core/src/main/scala/inc/pyc/bill/acceptor/driver/Driver.scala b/core/src/main/scala/inc/pyc/bill/acceptor/driver/Driver.scala @@ -62,6 +62,9 @@ private[acceptor] trait Driver { case Event(CommandFailed(cmd, reason), _) => throw new CommandFailedException(reason) + + case Event(Shutdown, _) => + stop(FSM.Failure("Terminated driver while disconnected")) case Event(Opened(port), _) => log debug ("Port {} is now open", port) @@ -137,4 +140,4 @@ private[acceptor] trait Driver { protected def formatData(data: ByteString) = data.map("0x" + Integer.toHexString(_)) mkString ("[", ",", "]") -} -\ No newline at end of file +}