Public Member Functions | |
SocketServerConnection (Socket socket, MenuCommandProtocol protocol, Clock clock) | |
int | getHeartbeatFrequency () |
void | closeConnection () |
long | lastReceivedHeartbeat () |
long | lastTransmittedHeartbeat () |
void | sendCommand (MenuCommand command) |
void | registerConnectionListener (BiConsumer< ServerConnection, Boolean > connectionListener) |
void | registerMessageHandler (BiConsumer< ServerConnection, MenuCommand > messageHandler) |
void | setConnectionMode (ServerConnectionMode mode) |
ServerConnectionMode | getConnectionMode () |
String | getUserName () |
String | getConnectionName () |
boolean | isDeviceConnected () |
boolean | canSendMessageNow (MenuCommand cmd) |
String | toString () |
Public Member Functions inherited from com.thecoderscorner.menu.remote.SharedStreamConnection | |
MenuCommand | readCommandFromStream () throws IOException |
void | sendMenuCommand (MenuCommand msg) throws IOException |
Protected Member Functions | |
void | getAtLeastBytes (ByteBuffer inputBuffer, int len, StreamRemoteConnector.ReadMode mode) throws IOException |
void | sendInternal (ByteBuffer cmdBuffer) throws IOException |
Protected Member Functions inherited from com.thecoderscorner.menu.remote.SharedStreamConnection | |
SharedStreamConnection (MenuCommandProtocol protocol) | |
void | readCompleteMessage (ByteBuffer inputBuffer) throws IOException |
void | logByteBuffer (String msg, ByteBuffer inBuffer) |
void | connectionLog (System.Logger.Level l, String s) |
Additional Inherited Members | |
Static Public Member Functions inherited from com.thecoderscorner.menu.remote.SharedStreamConnection | |
static boolean | doesBufferHaveEOM (ByteBuffer inputBuffer) |
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) |
Static Protected Attributes inherited from com.thecoderscorner.menu.remote.SharedStreamConnection | |
static final int | MAX_MSG_EXPECTED = 1024 |
void com.thecoderscorner.menu.remote.mgrclient.SocketServerConnection.closeConnection | ( | ) |
close the current connection if it is open
Implements com.thecoderscorner.menu.mgr.ServerConnection.
|
protected |
Reads at least the number of bytes requested waiting if need be for more data.
inputBuffer | the buffer to read from |
len | the minimum number of bytes needed |
IOException | if there are problems reading. |
Reimplemented from com.thecoderscorner.menu.remote.SharedStreamConnection.
ServerConnectionMode com.thecoderscorner.menu.remote.mgrclient.SocketServerConnection.getConnectionMode | ( | ) |
Implements com.thecoderscorner.menu.mgr.ServerConnection.
int com.thecoderscorner.menu.remote.mgrclient.SocketServerConnection.getHeartbeatFrequency | ( | ) |
Implements com.thecoderscorner.menu.mgr.ServerConnection.
String com.thecoderscorner.menu.remote.mgrclient.SocketServerConnection.getUserName | ( | ) |
get the username of this connection
Implements com.thecoderscorner.menu.mgr.ServerConnection.
long com.thecoderscorner.menu.remote.mgrclient.SocketServerConnection.lastReceivedHeartbeat | ( | ) |
Implements com.thecoderscorner.menu.mgr.ServerConnection.
long com.thecoderscorner.menu.remote.mgrclient.SocketServerConnection.lastTransmittedHeartbeat | ( | ) |
Implements com.thecoderscorner.menu.mgr.ServerConnection.
void com.thecoderscorner.menu.remote.mgrclient.SocketServerConnection.registerConnectionListener | ( | BiConsumer< ServerConnection, Boolean > | connectionListener | ) |
Register the connection listener to this connection that will receive udpates on connection changes.
connectionListener | the connection state |
Implements com.thecoderscorner.menu.mgr.ServerConnection.
void com.thecoderscorner.menu.remote.mgrclient.SocketServerConnection.registerMessageHandler | ( | BiConsumer< ServerConnection, MenuCommand > | messageHandler | ) |
Register the message handler that will receive all messages from the connection
messageHandler | the message handler |
Implements com.thecoderscorner.menu.mgr.ServerConnection.
void com.thecoderscorner.menu.remote.mgrclient.SocketServerConnection.sendCommand | ( | MenuCommand | command | ) |
Send a command to the remote
command | the command to send |
Implements com.thecoderscorner.menu.mgr.ServerConnection.
void com.thecoderscorner.menu.remote.mgrclient.SocketServerConnection.setConnectionMode | ( | ServerConnectionMode | mode | ) |
Set the connection mode for this connection, usually called by the menu manager to indicate state
mode | the mode |
Implements com.thecoderscorner.menu.mgr.ServerConnection.