blob: 5d9ed5455074a793654618bfe4824d0e348ba292 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package vfd.uav
import scala.collection.mutable.ArrayBuffer
import akka.actor.Actor
import akka.actor.ActorRef
object Connection {
trait Event
trait Command
case object Register extends Command
case class Received(bytes: Array[Byte]) extends Event
}
trait Connection { that: Actor =>
private val _clients = new ArrayBuffer[ActorRef]
def clients = _clients.toSeq
def register(client: ActorRef) = {
_clients += client;
that.context.watch(client)
}
def unregister(client: ActorRef) = _clients -= client
}
|