Class SocketBasedConnector

    • Constructor Detail

      • SocketBasedConnector

        public SocketBasedConnector​(LocalIdentifier localId,
                                    java.util.concurrent.ScheduledExecutorService executor,
                                    java.time.Clock clock,
                                    MenuCommandProtocol protocol,
                                    java.lang.String remoteHost,
                                    int remotePort,
                                    ConnectMode mode)
    • Method Detail

      • 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.
      • performConnection

        public void performConnection()
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • getAtLeastBytes

        protected void getAtLeastBytes​(java.nio.ByteBuffer inputBuffer,
                                       int len,
                                       StreamRemoteConnector.ReadMode mode)
                                throws java.io.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:
        java.io.IOException - if there are problems reading.
      • sendInternal

        protected void sendInternal​(java.nio.ByteBuffer outputBuffer)
                             throws java.io.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:
        java.io.IOException - if there are problems writing
      • 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
      • getConnectionName

        public java.lang.String getConnectionName()
        Description copied from interface: RemoteConnector
        Gets the name of this connector locally