E - the element typepublic abstract class AbstractSocketConnector<E extends java.lang.Enum<E>>
extends java.lang.Object
AbstractMultiConnectionSocket and receives
AbstractMultiConnectionEvent updates. Many instances of this class
running in separate processes can connect to the single instance of
AbstractMultiConnectionSocket, allowing separately running programs
to deal with Neurosky output simultaneously. | Modifier and Type | Field and Description |
|---|---|
static int |
BROADCASTER_PORT
The broadcaster port.
|
protected org.apache.mina.transport.socket.nio.NioSocketConnector |
connector
The connector.
|
static java.lang.String |
SOCKET_BROADCASTER_KEY
Set the system property 'socket.broadcaster.port' on startup to change the
broadcaster port from the default '12345' ie.
|
| Constructor and Description |
|---|
AbstractSocketConnector(java.lang.String socketBroadcasterHost)
Instantiate with the name of the host that the
AbstractMultiConnectionSocket is running on. |
| Modifier and Type | Method and Description |
|---|---|
void |
connect()
Connects to the
AbstractMultiConnectionSocket instance. |
void |
disconnect()
Disconnects from the
AbstractMultiConnectionSocket instance. |
boolean |
isConnected()
Returns true if connected to a
AbstractMultiConnectionSocket
instance. |
protected abstract void |
processEvent(AbstractMultiConnectionEvent<E> message)
Process event.
|
protected boolean |
subscribe(MultiConnectionSubscriptionRequest<?> request)
Subscribes to the specified event types, all registered listeners will
receive updates for these event types.
|
abstract boolean |
subscribeAll()
Subscribes to all
EventTypes, barring
EventType#signalProcessed. |
public static final java.lang.String SOCKET_BROADCASTER_KEY
public static int BROADCASTER_PORT
protected org.apache.mina.transport.socket.nio.NioSocketConnector connector
public AbstractSocketConnector(java.lang.String socketBroadcasterHost)
AbstractMultiConnectionSocket is running on.socketBroadcasterHost - the socket broadcaster hostpublic boolean isConnected()
AbstractMultiConnectionSocket
instance.public void connect()
throws MultiConnectionSocketException
AbstractMultiConnectionSocket instance. The
listeners will not be notified of events until
#subscribe(EventType...) or subscribeAll() has been
called.MultiConnectionSocketException - if unable to connect to a AbstractMultiConnectionSocketpublic void disconnect()
AbstractMultiConnectionSocket instance.protected boolean subscribe(MultiConnectionSubscriptionRequest<?> request)
request - the requestpublic abstract boolean subscribeAll()
EventTypes, barring
EventType#signalProcessed.protected abstract void processEvent(AbstractMultiConnectionEvent<E> message)
message - the message