Class Rs232RemoteConnector
java.lang.Object
com.thecoderscorner.menu.remote.StreamRemoteConnector
com.thecoderscorner.menu.remote.rs232.Rs232RemoteConnector
- All Implemented Interfaces:
RemoteConnector,RemoteConnectorContext
This is the R232 connector that can talk to a tcMenu library application running
on an embedded Arduino. Normally one uses the Rs232ControllerBuilder to construct
the whole remote stack instead of creating this directly.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.thecoderscorner.menu.remote.StreamRemoteConnector
StreamRemoteConnector.ReadMode -
Field Summary
Fields inherited from class com.thecoderscorner.menu.remote.StreamRemoteConnector
clock, executor, logger, stateMachineMappings -
Constructor Summary
ConstructorsConstructorDescriptionRs232RemoteConnector(LocalIdentifier localId, String portName, int baud, MenuCommandProtocol protocol, ScheduledExecutorService executor, Clock clock, ConnectMode connectMode) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidgetAtLeastBytes(ByteBuffer inputBuffer, int len, StreamRemoteConnector.ReadMode mode)Reads at least the number of bytes requested waiting if need be for more data.Gets the name of this connector locallybooleanIndicates if the underlying device is actually connected.voidprotected voidsendInternal(ByteBuffer outputBuffer)performs a send of all bytes in the output buffer until the output buffer is emptyvoidstart()Starts the communication channel, so it will attempt to connect with the configured devicevoidstop()Stops the library and attempts to also stop any threads and other resources associated.Methods inherited from class com.thecoderscorner.menu.remote.StreamRemoteConnector
changeState, changeState, close, doesBufferHaveEOM, getAuthenticationStatus, getClock, getRemoteParty, getScheduledExecutor, handleCoreConnectionStates, logByteBuffer, notifyConnection, notifyListeners, readCommandFromStream, readCompleteMessage, registerConnectionChangeListener, registerConnectorListener, sendAcknowledgement, sendHeartbeat, sendJoin, sendMenuCommand, sendPairing, setRemoteParty
-
Constructor Details
-
Method Details
-
start
public void start()Description copied from interface:RemoteConnectorStarts the communication channel, so it will attempt to connect with the configured device -
stop
public void stop()Description copied from interface:RemoteConnectorStops the library and attempts to also stop any threads and other resources associated. -
getConnectionName
Description copied from interface:RemoteConnectorGets the name of this connector locally -
isDeviceConnected
public boolean isDeviceConnected()Description copied from interface:RemoteConnectorIndicates if the underlying device is actually connected.- Returns:
- true if the underlying device is connected
-
performConnection
- Throws:
IOException
-
sendInternal
Description copied from class:StreamRemoteConnectorperforms a send of all bytes in the output buffer until the output buffer is empty- Specified by:
sendInternalin classStreamRemoteConnector- Parameters:
outputBuffer- the buffer data to be sent- Throws:
IOException- if there are problems writing
-