Classes | |
enum | ReadMode |
Public Member Functions | |
boolean | canSendMessageNow (MenuCommand cmd) |
void | close () |
void | registerConnectorListener (RemoteConnectorListener listener) |
void | registerConnectionChangeListener (ConnectionChangeListener listener) |
void | notifyListeners (MenuCommand mc) |
void | changeState (AuthStatus desiredState) |
void | changeState (RemoteConnectorState newState) |
RemoteInformation | getRemoteParty () |
void | setRemoteParty (RemoteInformation remote) |
AuthStatus | getAuthenticationStatus () |
void | sendHeartbeat (int frequency, MenuHeartbeatCommand.HeartbeatMode mode) |
void | sendJoin () throws IOException |
void | sendAcknowledgement (AckStatus ackStatus) throws IOException |
void | sendPairing () throws IOException |
ScheduledExecutorService | getScheduledExecutor () |
Clock | getClock () |
String | getUserName () |
Public Member Functions inherited from com.thecoderscorner.menu.remote.SharedStreamConnection | |
MenuCommand | readCommandFromStream () throws IOException |
void | sendMenuCommand (MenuCommand msg) throws IOException |
abstract boolean | isDeviceConnected () |
abstract String | getConnectionName () |
Public Member Functions inherited from com.thecoderscorner.menu.remote.RemoteConnector | |
void | start () |
void | stop () |
void | sendMenuCommand (MenuCommand msg) throws IOException |
String | getConnectionName () |
boolean | isDeviceConnected () |
Public Member Functions inherited from com.thecoderscorner.menu.remote.states.RemoteConnectorContext | |
MenuCommand | readCommandFromStream () throws IOException |
boolean | isDeviceConnected () |
void | performConnection () throws IOException |
String | getConnectionName () |
Protected Member Functions | |
StreamRemoteConnector (LocalIdentifier ourLocalId, MenuCommandProtocol protocol, ScheduledExecutorService executor, Clock clock) | |
void | stopThreadProc () |
void | startThreadProc () |
void | handleCoreConnectionStates (ConnectMode connectMode) |
abstract void | sendInternal (ByteBuffer outputBuffer) throws IOException |
void | notifyConnection () |
void | connectionLog (System.Logger.Level l, String s, Throwable e) |
Protected Member Functions inherited from com.thecoderscorner.menu.remote.SharedStreamConnection | |
SharedStreamConnection (MenuCommandProtocol protocol) | |
void | readCompleteMessage (ByteBuffer inputBuffer) throws IOException |
abstract void | getAtLeastBytes (ByteBuffer inputBuffer, int len, StreamRemoteConnector.ReadMode mode) throws IOException |
void | logByteBuffer (String msg, ByteBuffer inBuffer) |
void | connectionLog (System.Logger.Level l, String s) |
Protected Attributes | |
final ScheduledExecutorService | executor |
final Clock | clock |
final Map< AuthStatus, Class<? extends RemoteConnectorState > > | stateMachineMappings = new HashMap<>() |
Protected Attributes inherited from com.thecoderscorner.menu.remote.SharedStreamConnection | |
final System.Logger | logger = System.getLogger(getClass().getSimpleName()) |
final MenuCommandProtocol | protocol |
final ByteBuffer | inputBuffer = ByteBuffer.allocate(MAX_MSG_EXPECTED).order(ByteOrder.BIG_ENDIAN) |
final ByteBuffer | cmdBuffer = ByteBuffer.allocate(MAX_MSG_EXPECTED).order(ByteOrder.BIG_ENDIAN) |
Additional Inherited Members | |
Static Public Member Functions inherited from com.thecoderscorner.menu.remote.SharedStreamConnection | |
static boolean | doesBufferHaveEOM (ByteBuffer inputBuffer) |
Static Protected Attributes inherited from com.thecoderscorner.menu.remote.SharedStreamConnection | |
static final int | MAX_MSG_EXPECTED = 1024 |
Stream remote connector is the base class for all stream implementations, such as Socket and RS232. Any remote with stream like semantics can use this as the base for building out an adapter.
enum com::thecoderscorner::menu::remote::StreamRemoteConnector::ReadMode |
Enumerator | ONLY_WHEN_EMPTY | READ_MORE |
---|
void com.thecoderscorner.menu.remote.StreamRemoteConnector.close | ( | ) |
Force close a connection when its known to be bad, the connector will try and establish a new connection.
Implements com.thecoderscorner.menu.remote.RemoteConnector.
Reimplemented in com.thecoderscorner.menu.remote.socket.SocketBasedConnector.
AuthStatus com.thecoderscorner.menu.remote.StreamRemoteConnector.getAuthenticationStatus | ( | ) |
Implements com.thecoderscorner.menu.remote.RemoteConnector.
RemoteInformation com.thecoderscorner.menu.remote.StreamRemoteConnector.getRemoteParty | ( | ) |
Implements com.thecoderscorner.menu.remote.RemoteConnector.
|
protected |
Helper method that notifies all connection listeners of a change in connectivity
void com.thecoderscorner.menu.remote.StreamRemoteConnector.notifyListeners | ( | MenuCommand | mc | ) |
Helper method that notifies all listeners of a new command message
mc | the message to notify |
Implements com.thecoderscorner.menu.remote.states.RemoteConnectorContext.
void com.thecoderscorner.menu.remote.StreamRemoteConnector.registerConnectionChangeListener | ( | ConnectionChangeListener | listener | ) |
Register for connection change events, when there is a change in connectivity status on the underlying transport.
listener | the listener |
Implements com.thecoderscorner.menu.remote.RemoteConnector.
void com.thecoderscorner.menu.remote.StreamRemoteConnector.registerConnectorListener | ( | RemoteConnectorListener | listener | ) |
Register for connector messages, when new messages are received from this stream.
listener | the listener to be registered |
Implements com.thecoderscorner.menu.remote.RemoteConnector.
|
abstractprotected |
performs a send of all bytes in the output buffer until the output buffer is empty
outputBuffer | the buffer data to be sent |
IOException | if there are problems writing |
Reimplemented from com.thecoderscorner.menu.remote.SharedStreamConnection.
Reimplemented in com.thecoderscorner.menu.remote.socket.SocketBasedConnector.