java.lang.Object
com.thecoderscorner.menu.remote.StreamRemoteConnector
com.thecoderscorner.menu.remote.rs232.Rs232RemoteConnector
All Implemented Interfaces:
RemoteConnector, RemoteConnectorContext

public class Rs232RemoteConnector extends StreamRemoteConnector
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.
  • Constructor Details

  • Method Details

    • start

      public void start()
      Description copied from interface: RemoteConnector
      Starts the communication channel, so it will attempt to connect with the configured device
    • stop

      public void stop()
      Description copied from interface: RemoteConnector
      Stops the library and attempts to also stop any threads and other resources associated.
    • getConnectionName

      public String getConnectionName()
      Description copied from interface: RemoteConnector
      Gets the name of this connector locally
    • isDeviceConnected

      public boolean isDeviceConnected()
      Description copied from interface: RemoteConnector
      Indicates if the underlying device is actually connected.
      Returns:
      true if the underlying device is connected
    • performConnection

      public void performConnection() throws IOException
      Throws:
      IOException
    • sendInternal

      protected void sendInternal(ByteBuffer outputBuffer) throws IOException
      Description copied from class: StreamRemoteConnector
      performs a send of all bytes in the output buffer until the output buffer is empty
      Specified by:
      sendInternal in class StreamRemoteConnector
      Parameters:
      outputBuffer - the buffer data to be sent
      Throws:
      IOException - if there are problems writing
    • getAtLeastBytes

      protected void getAtLeastBytes(ByteBuffer inputBuffer, int len, StreamRemoteConnector.ReadMode mode) throws IOException
      Description copied from class: StreamRemoteConnector
      Reads at least the number of bytes requested waiting if need be for more data.
      Specified by:
      getAtLeastBytes in class StreamRemoteConnector
      Parameters:
      inputBuffer - the buffer to read from
      len - the minimum number of bytes needed
      Throws:
      IOException - if there are problems reading.