Class TtyPort

  • All Implemented Interfaces:
    Flushable, AutoCloseable, org.refcodes.component.Closable, org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.ClosedAccessor, org.refcodes.component.ConnectableComponent, org.refcodes.component.ConnectableComponent.ConnectableAutomaton, org.refcodes.component.ConnectionComponent<TtyPortMetrics>, org.refcodes.component.ConnectionComponent.ConnectionAutomaton<TtyPortMetrics>, org.refcodes.component.ConnectionOpenable<TtyPortMetrics>, org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<TtyPortMetrics>, org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<TtyPortMetrics,​org.refcodes.serial.Port<TtyPortMetrics>>, org.refcodes.component.ConnectionStatusAccessor, org.refcodes.component.Flushable, org.refcodes.component.LinkComponent, org.refcodes.component.LinkComponent.LinkAutomaton, org.refcodes.component.Openable, org.refcodes.component.Openable.OpenAutomaton, org.refcodes.component.Openable.OpenBuilder<org.refcodes.serial.Port<TtyPortMetrics>>, org.refcodes.component.OpenedAccessor, org.refcodes.io.Availability, org.refcodes.io.ByteDestination, org.refcodes.io.ByteReceiver, org.refcodes.io.BytesDestination, org.refcodes.io.ByteSource, org.refcodes.io.BytesReceiver, org.refcodes.io.BytesSource, org.refcodes.io.BytesTransceiver, org.refcodes.io.BytesTransmitter, org.refcodes.io.ByteTransceiver, org.refcodes.io.ByteTransmitter, org.refcodes.io.Receivable, org.refcodes.io.Skippable, org.refcodes.io.TimeoutInputStreamAccessor, org.refcodes.io.Transmittable, org.refcodes.mixin.AliasAccessor, org.refcodes.mixin.DescriptionAccessor, org.refcodes.mixin.InputStreamAccessor, org.refcodes.mixin.NameAccessor, org.refcodes.mixin.OutputStreamAccessor, org.refcodes.serial.Port<TtyPortMetrics>, org.refcodes.serial.PortMetricsAccessor<TtyPortMetrics>, org.refcodes.serial.SegmentDestination, org.refcodes.serial.SegmentReceiver, org.refcodes.serial.SegmentSource, org.refcodes.serial.SegmentTransceiver, org.refcodes.serial.SegmentTransmitter, org.refcodes.serial.SerialReceiver, org.refcodes.serial.SerialTransceiver, org.refcodes.serial.SerialTransmitter

    public class TtyPort
    extends org.refcodes.serial.AbstractPort<TtyPortMetrics>
    implements org.refcodes.serial.Port<TtyPortMetrics>, org.refcodes.component.ConnectionComponent.ConnectionAutomaton<TtyPortMetrics>, org.refcodes.mixin.NameAccessor, org.refcodes.mixin.DescriptionAccessor, AutoCloseable
    A Port is a Port implementation
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.refcodes.mixin.AliasAccessor

        org.refcodes.mixin.AliasAccessor.AliasBuilder<B extends org.refcodes.mixin.AliasAccessor.AliasBuilder<B>>, org.refcodes.mixin.AliasAccessor.AliasMutator, org.refcodes.mixin.AliasAccessor.AliasProperty
      • Nested classes/interfaces inherited from interface org.refcodes.io.BytesReceiver

        org.refcodes.io.BytesReceiver.ReceiverInputStream
      • Nested classes/interfaces inherited from interface org.refcodes.io.BytesTransmitter

        org.refcodes.io.BytesTransmitter.TransmitterOutputStream
      • Nested classes/interfaces inherited from interface org.refcodes.component.Closable

        org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.Closable.CloseBuilder<B extends org.refcodes.component.Closable.CloseBuilder<B>>
      • Nested classes/interfaces inherited from interface org.refcodes.component.ClosedAccessor

        org.refcodes.component.ClosedAccessor.ClosedMutator, org.refcodes.component.ClosedAccessor.ClosedProperty
      • Nested classes/interfaces inherited from interface org.refcodes.component.ConnectableComponent

        org.refcodes.component.ConnectableComponent.ConnectableAutomaton
      • Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionComponent

        org.refcodes.component.ConnectionComponent.ConnectionAutomaton<CON extends Object>, org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<CON extends Object,​B extends org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<CON,​B>>
      • Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionOpenable

        org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<CON extends Object>, org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<CON extends Object,​B extends org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<CON,​B>>
      • Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionStatusAccessor

        org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusMutator, org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusProperty
      • Nested classes/interfaces inherited from interface org.refcodes.mixin.DescriptionAccessor

        org.refcodes.mixin.DescriptionAccessor.DescriptionBuilder<B extends org.refcodes.mixin.DescriptionAccessor.DescriptionBuilder<B>>, org.refcodes.mixin.DescriptionAccessor.DescriptionMutator, org.refcodes.mixin.DescriptionAccessor.DescriptionProperty
      • Nested classes/interfaces inherited from interface org.refcodes.component.Flushable

        org.refcodes.component.Flushable.FlushBuilder<B extends org.refcodes.component.Flushable.FlushBuilder<B>>
      • Nested classes/interfaces inherited from interface org.refcodes.mixin.InputStreamAccessor

        org.refcodes.mixin.InputStreamAccessor.InputStreamBuilder<B extends org.refcodes.mixin.InputStreamAccessor.InputStreamBuilder<?>>, org.refcodes.mixin.InputStreamAccessor.InputStreamMutator, org.refcodes.mixin.InputStreamAccessor.InputStreamProperty
      • Nested classes/interfaces inherited from interface org.refcodes.component.LinkComponent

        org.refcodes.component.LinkComponent.LinkAutomaton, org.refcodes.component.LinkComponent.LinkComponentBuilder<B extends org.refcodes.component.LinkComponent.LinkComponentBuilder<B>>
      • Nested classes/interfaces inherited from interface org.refcodes.mixin.NameAccessor

        org.refcodes.mixin.NameAccessor.NameBuilder<B extends org.refcodes.mixin.NameAccessor.NameBuilder<B>>, org.refcodes.mixin.NameAccessor.NameMutator, org.refcodes.mixin.NameAccessor.NameProperty
      • Nested classes/interfaces inherited from interface org.refcodes.component.Openable

        org.refcodes.component.Openable.OpenAutomaton, org.refcodes.component.Openable.OpenBuilder<B extends org.refcodes.component.Openable.OpenBuilder<B>>
      • Nested classes/interfaces inherited from interface org.refcodes.component.OpenedAccessor

        org.refcodes.component.OpenedAccessor.OpenedMutator, org.refcodes.component.OpenedAccessor.OpenedProperty
      • Nested classes/interfaces inherited from interface org.refcodes.mixin.OutputStreamAccessor

        org.refcodes.mixin.OutputStreamAccessor.OutputStreamBuilder<B extends org.refcodes.mixin.OutputStreamAccessor.OutputStreamBuilder<?>>, org.refcodes.mixin.OutputStreamAccessor.OutputStreamMutator, org.refcodes.mixin.OutputStreamAccessor.OutputStreamProperty
      • Nested classes/interfaces inherited from interface org.refcodes.serial.PortMetricsAccessor

        org.refcodes.serial.PortMetricsAccessor.PortMetricsBuilder<PM extends org.refcodes.serial.PortMetrics,​B extends org.refcodes.serial.PortMetricsAccessor.PortMetricsBuilder<PM,​B>>, org.refcodes.serial.PortMetricsAccessor.PortMetricsMutator<PM extends org.refcodes.serial.PortMetrics>, org.refcodes.serial.PortMetricsAccessor.PortMetricsProperty<PM extends org.refcodes.serial.PortMetrics>
      • Nested classes/interfaces inherited from interface org.refcodes.io.TimeoutInputStreamAccessor

        org.refcodes.io.TimeoutInputStreamAccessor.TimeoutInputStreamBuilder<B extends org.refcodes.io.TimeoutInputStreamAccessor.TimeoutInputStreamBuilder<?>>, org.refcodes.io.TimeoutInputStreamAccessor.TimeoutInputStreamMutator, org.refcodes.io.TimeoutInputStreamAccessor.TimeoutInputStreamProperty
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Parity DEFAULT_PARITY  
      static StopBits DEFAULT_STOP_BITS  
      • Fields inherited from class org.refcodes.serial.AbstractPort

        _alias, _executorService, _portMetrics
      • Fields inherited from class org.refcodes.component.ConnectionAutomatonImpl

        _connectionComponent
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected TtyPort​(String aAlias, TtyPortMetrics aPortMetrics, String aName, String aDescription, com.fazecast.jSerialComm.SerialPort aSerialPort)
      Constructs a Port with the given properties.
      protected TtyPort​(String aAlias, TtyPortMetrics aPortMetrics, String aName, String aDescription, com.fazecast.jSerialComm.SerialPort aSerialPort, ExecutorService aExecutorService)
      Constructs a Port with the given properties and the given ExecutorService to be used by asynchronous functionality.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()
      void close()
      String getAlias()
      Returns the unambiguous technical name of the TTY-/COM-Port.
      String getDescription()
      InputStream getInputStream()
      org.refcodes.io.TimeoutInputStream getInputStream​(long aTimeoutInMs)
      String getName()
      Returns the a more (not necessarily technical or unambiguous) name of the TTY-/COM-Port.
      OutputStream getOutputStream()
      TtyPortMetrics getPortMetrics()
      int getReadBufferSize()
      Determines the size of the read buffer for this TtyPort.
      int getWriteBufferSize()
      Determines the size of the write buffer for this TtyPort.
      boolean isOpenable()
      boolean isOpened()
      void open()
      void open​(int aBaudRate)
      Opens the TtyPort instance.
      void open​(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity)
      Opens the TtyPort instance.
      void open​(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake)
      Opens the TtyPort instance.
      void open​(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake, int aReadTimeout, int aWriteTimeout)
      Opens the TtyPort instance.
      void open​(BaudRate aBaudRate)
      Opens the TtyPort instance.
      void open​(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity)
      Opens the TtyPort instance.
      void open​(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake)
      Opens the TtyPort instance.
      void open​(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake, int aReadTimeout, int aWriteTimeout)
      Opens the TtyPort instance.
      void open​(TtyPortMetrics aConnection)
      void receiveBytes​(byte[] aBuffer, int aOffset, int aLength)
      String toString()
      void transmitSequence​(org.refcodes.serial.Sequence aSequence)
      TtyPort withOpen()
      TtyPort withOpen​(int aBaudRate)
      Builder method for opening a TtyPort instance.
      TtyPort withOpen​(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity)
      Builder method for opening a TtyPort instance.
      TtyPort withOpen​(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake)
      Builder method for opening a TtyPort instance.
      TtyPort withOpen​(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake, int aReadTimeout, int aWriteTimeout)
      Builder method for opening a TtyPort instance.
      TtyPort withOpen​(BaudRate aBaudRate)
      Builder method for opening a TtyPort instance.
      TtyPort withOpen​(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity)
      Builder method for opening a TtyPort instance.
      TtyPort withOpen​(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake)
      Builder method for opening a TtyPort instance.
      TtyPort withOpen​(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake, int aReadTimeout, int aWriteTimeout)
      Builder method for opening a TtyPort instance.
      TtyPort withOpen​(TtyPortMetrics aConnection)
      TtyPort withOpenUnchecked()
      TtyPort withOpenUnchecked​(TtyPortMetrics aPortMetrics)
      • Methods inherited from class org.refcodes.serial.AbstractPort

        doTransmitSegment, doTransmitSegment, onReceiveSegment, onReceiveSegment, receiveSegment
      • Methods inherited from class org.refcodes.component.ConnectionAutomatonImpl

        getConnectionStatus, isClosable, isClosed, isOpenable
      • Methods inherited from interface org.refcodes.io.Availability

        hasAvailable
      • Methods inherited from interface org.refcodes.io.BytesReceiver

        receiveAllBytes, receiveBytesWithin, receiveBytesWithin, receiveByteWithin, skip
      • Methods inherited from interface org.refcodes.io.BytesSource

        transmitByte
      • Methods inherited from interface org.refcodes.component.Closable

        closeIn, closeQuietly, closeUnchecked
      • Methods inherited from interface org.refcodes.component.Closable.CloseAutomaton

        isClosable
      • Methods inherited from interface org.refcodes.component.ClosedAccessor

        isClosed
      • Methods inherited from interface org.refcodes.component.ConnectionOpenable

        openUnchecked
      • Methods inherited from interface org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton

        isOpenable
      • Methods inherited from interface org.refcodes.component.ConnectionStatusAccessor

        getConnectionStatus
      • Methods inherited from interface org.refcodes.component.Flushable

        flushUnchecked, isFlushable
      • Methods inherited from interface org.refcodes.component.Openable

        openUnchecked
      • Methods inherited from interface org.refcodes.serial.SegmentReceiver

        onReceiveSegment, onReceiveSegment
      • Methods inherited from interface org.refcodes.serial.SegmentTransmitter

        doTransmitSegment, doTransmitSegment, flush
      • Methods inherited from interface org.refcodes.serial.SerialReceiver

        receiveByte, receiveBytes, receiveSegmentWithin, receiveSequence, receiveSequenceWithin
      • Methods inherited from interface org.refcodes.serial.SerialTransceiver

        receiveSegment, transmitSegment
      • Methods inherited from interface org.refcodes.serial.SerialTransmitter

        flush, transmitAllBytes, transmitBytes, transmitSequence
      • Methods inherited from interface org.refcodes.io.Skippable

        skipAvailable, skipAvailableExcept, skipAvailableTill, skipAvailableTillSilenceFor, skipAvailableTillSilenceFor, skipAvailableWithin, skipAvailableWithin
    • Field Detail

      • DEFAULT_PARITY

        public static final Parity DEFAULT_PARITY
      • DEFAULT_STOP_BITS

        public static final StopBits DEFAULT_STOP_BITS
    • Constructor Detail

      • TtyPort

        protected TtyPort​(String aAlias,
                          TtyPortMetrics aPortMetrics,
                          String aName,
                          String aDescription,
                          com.fazecast.jSerialComm.SerialPort aSerialPort)
        Constructs a Port with the given properties. The alias corresponds to the underlying TTY-/COM-Port's name.
        Parameters:
        aAlias - The unambiguous technical name for this Port.
        aPortMetrics - The metrics of the Port.
        aName - The human readable (not necessarily technical or unambiguous) name for this Port.
        aDescription - The human readable description about the port.
        aSerialPort - The underlying SerialPort being used for this implementation.
      • TtyPort

        protected TtyPort​(String aAlias,
                          TtyPortMetrics aPortMetrics,
                          String aName,
                          String aDescription,
                          com.fazecast.jSerialComm.SerialPort aSerialPort,
                          ExecutorService aExecutorService)
        Constructs a Port with the given properties and the given ExecutorService to be used by asynchronous functionality. The alias corresponds to the underlying TTY-/COM-Port's name.
        Parameters:
        aAlias - The unambiguous technical name for this Port.
        aPortMetrics - The metrics of the Port.
        aName - The human readable (not necessarily technical or unambiguous) name for this Port.
        aDescription - The human readable description about the port.
        aSerialPort - The underlying SerialPort being used for this implementation.
        aExecutorService - The ExecutorService to be used when invoking asynchronously working methods.
    • Method Detail

      • getAlias

        public String getAlias()
        Returns the unambiguous technical name of the TTY-/COM-Port.
        Specified by:
        getAlias in interface org.refcodes.mixin.AliasAccessor
        Overrides:
        getAlias in class org.refcodes.serial.AbstractPort<TtyPortMetrics>
        Returns:
        The port's name.
      • getName

        public String getName()
        Returns the a more (not necessarily technical or unambiguous) name of the TTY-/COM-Port.
        Specified by:
        getName in interface org.refcodes.mixin.NameAccessor
        Returns:
        The port's verbose name.
      • getDescription

        public String getDescription()
        Specified by:
        getDescription in interface org.refcodes.mixin.DescriptionAccessor
      • getReadBufferSize

        public int getReadBufferSize()
        Determines the size of the read buffer for this TtyPort. Depending on the underlying TtyPort implementation, when not reading continuously from this port, buffered data may be overwritten (lost) by succeedingly received data.
        Returns:
        The according buffer size.
      • getWriteBufferSize

        public int getWriteBufferSize()
        Determines the size of the write buffer for this TtyPort.
        Returns:
        The according buffer size.
      • isOpenable

        public boolean isOpenable()
        Specified by:
        isOpenable in interface org.refcodes.component.Openable.OpenAutomaton
        Overrides:
        isOpenable in class org.refcodes.serial.AbstractPort<TtyPortMetrics>
      • open

        public void open()
                  throws IOException
        Specified by:
        open in interface org.refcodes.component.Openable
        Specified by:
        open in interface org.refcodes.serial.SerialReceiver
        Overrides:
        open in class org.refcodes.serial.AbstractPort<TtyPortMetrics>
        Throws:
        IOException
      • open

        public void open​(int aBaudRate,
                         int aDataBits,
                         StopBits aStopBits,
                         Parity aParity,
                         Handshake aHandshake,
                         int aReadTimeout,
                         int aWriteTimeout)
                  throws IOException
        Opens the TtyPort instance.
        Parameters:
        aBaudRate - The baud rate to be set.
        aDataBits - The data bits to be set.
        aStopBits - The StopBits to be set.
        aParity - The Parity be set.
        aHandshake - The Handshake be set.
        aReadTimeout - The read timeout to be set.
        aWriteTimeout - The write timeout to be set.
        Throws:
        IOException - Thrown in case opening or accessing the Port caused problems.
      • open

        public void open​(BaudRate aBaudRate,
                         int aDataBits,
                         StopBits aStopBits,
                         Parity aParity,
                         Handshake aHandshake,
                         int aReadTimeout,
                         int aWriteTimeout)
                  throws IOException
        Opens the TtyPort instance.
        Parameters:
        aBaudRate - The BaudRate to be set.
        aDataBits - The data bits to be set.
        aStopBits - The StopBits to be set.
        aParity - The Parity be set.
        aHandshake - The Handshake be set.
        aReadTimeout - The read timeout to be set.
        aWriteTimeout - The write timeout to be set.
        Throws:
        IOException - Thrown in case opening or accessing the Port caused problems.
      • open

        public void open​(int aBaudRate,
                         int aDataBits,
                         StopBits aStopBits,
                         Parity aParity,
                         Handshake aHandshake)
                  throws IOException
        Opens the TtyPort instance. Timeouts are disabled.
        Parameters:
        aBaudRate - The baud rate to be set.
        aDataBits - The data bits to be set.
        aStopBits - The StopBits to be set.
        aParity - The Parity be set.
        aHandshake - The Handshake be set.
        Throws:
        IOException - Thrown in case opening or accessing the Port caused problems.
      • open

        public void open​(BaudRate aBaudRate,
                         int aDataBits,
                         StopBits aStopBits,
                         Parity aParity,
                         Handshake aHandshake)
                  throws IOException
        Opens the TtyPort instance. Timeouts are disabled.
        Parameters:
        aBaudRate - The BaudRate to be set.
        aDataBits - The data bits to be set.
        aStopBits - The StopBits to be set.
        aParity - The Parity be set.
        aHandshake - The Handshake be set.
        Throws:
        IOException - Thrown in case opening or accessing the Port caused problems.
      • open

        public void open​(int aBaudRate,
                         int aDataBits,
                         StopBits aStopBits,
                         Parity aParity)
                  throws IOException
        Opens the TtyPort instance. Timeouts are disabled. The underlying system's implementation or other implementation specific handshaking is used (Handshake.AUTO).
        Parameters:
        aBaudRate - The baud rate to be set.
        aDataBits - The data bits to be set.
        aStopBits - The StopBits to be set.
        aParity - The Parity be set.
        Throws:
        IOException - Thrown in case opening or accessing the Port caused problems.
      • open

        public void open​(BaudRate aBaudRate,
                         int aDataBits,
                         StopBits aStopBits,
                         Parity aParity)
                  throws IOException
        Opens the TtyPort instance. Timeouts are disabled. The underlying system's implementation or other implementation specific handshaking is used (Handshake.AUTO).
        Parameters:
        aBaudRate - The BaudRate to be set.
        aDataBits - The data bits to be set.
        aStopBits - The StopBits to be set.
        aParity - The Parity be set.
        Throws:
        IOException - Thrown in case opening or accessing the Port caused problems.
      • open

        public void open​(int aBaudRate)
                  throws IOException
        Opens the TtyPort instance. Timeouts are disabled. The underlying system's implementation or other implementation specific handshaking, stop bits and parity are used (Handshake.AUTO).
        Parameters:
        aBaudRate - The baud rate to be set.
        Throws:
        IOException - Thrown in case opening or accessing the Port caused problems.
      • open

        public void open​(BaudRate aBaudRate)
                  throws IOException
        Opens the TtyPort instance. Timeouts are disabled. The underlying system's implementation or other implementation specific handshaking, stop bits and parity are used (Handshake.AUTO).
        Parameters:
        aBaudRate - The BaudRate to be set.
        Throws:
        IOException - Thrown in case opening or accessing the Port caused problems.
      • transmitSequence

        public void transmitSequence​(org.refcodes.serial.Sequence aSequence)
                              throws IOException
        Specified by:
        transmitSequence in interface org.refcodes.serial.SerialTransmitter
        Throws:
        IOException
      • receiveBytes

        public void receiveBytes​(byte[] aBuffer,
                                 int aOffset,
                                 int aLength)
                          throws IOException
        Specified by:
        receiveBytes in interface org.refcodes.io.BytesDestination
        Throws:
        IOException
      • available

        public int available()
        Specified by:
        available in interface org.refcodes.io.Availability
        Specified by:
        available in interface org.refcodes.serial.SerialReceiver
        Specified by:
        available in interface org.refcodes.io.Skippable
      • withOpen

        public TtyPort withOpen​(int aBaudRate,
                                int aDataBits,
                                StopBits aStopBits,
                                Parity aParity,
                                Handshake aHandshake,
                                int aReadTimeout,
                                int aWriteTimeout)
                         throws IOException
        Builder method for opening a TtyPort instance.
        Parameters:
        aBaudRate - The baud rate to be set.
        aDataBits - The data bits to be set.
        aStopBits - The StopBits to be set.
        aParity - The Parity be set.
        aHandshake - The Handshake be set.
        aReadTimeout - The read timeout to be set.
        aWriteTimeout - The write timeout to be set.
        Returns:
        This instance as of the builder pattern.
        Throws:
        IOException - Thrown in case opening or accessing the Port caused problems.
      • withOpen

        public TtyPort withOpen​(BaudRate aBaudRate,
                                int aDataBits,
                                StopBits aStopBits,
                                Parity aParity,
                                Handshake aHandshake,
                                int aReadTimeout,
                                int aWriteTimeout)
                         throws IOException
        Builder method for opening a TtyPort instance.
        Parameters:
        aBaudRate - The BaudRate to be set.
        aDataBits - The data bits to be set.
        aStopBits - The StopBits to be set.
        aParity - The Parity be set.
        aHandshake - The Handshake be set.
        aReadTimeout - The read timeout to be set.
        aWriteTimeout - The write timeout to be set.
        Returns:
        This instance as of the builder pattern.
        Throws:
        IOException - Thrown in case opening or accessing the Port caused problems.
      • withOpen

        public TtyPort withOpen​(int aBaudRate,
                                int aDataBits,
                                StopBits aStopBits,
                                Parity aParity,
                                Handshake aHandshake)
                         throws IOException
        Builder method for opening a TtyPort instance. Timeouts are disabled.
        Parameters:
        aBaudRate - The baud rate to be set.
        aDataBits - The data bits to be set.
        aStopBits - The StopBits to be set.
        aParity - The Parity be set.
        aHandshake - The Handshake be set.
        Returns:
        This instance as of the builder pattern.
        Throws:
        IOException - Thrown in case opening or accessing the Port caused problems.
      • withOpen

        public TtyPort withOpen​(BaudRate aBaudRate,
                                int aDataBits,
                                StopBits aStopBits,
                                Parity aParity,
                                Handshake aHandshake)
                         throws IOException
        Builder method for opening a TtyPort instance. Timeouts are disabled.
        Parameters:
        aBaudRate - The BaudRate to be set.
        aDataBits - The data bits to be set.
        aStopBits - The StopBits to be set.
        aParity - The Parity be set.
        aHandshake - The Handshake be set.
        Returns:
        This instance as of the builder pattern.
        Throws:
        IOException - Thrown in case opening or accessing the Port caused problems.
      • withOpen

        public TtyPort withOpen​(int aBaudRate,
                                int aDataBits,
                                StopBits aStopBits,
                                Parity aParity)
                         throws IOException
        Builder method for opening a TtyPort instance. Timeouts are disabled. The underlying system's implementation or other implementation specific handshaking is used (Handshake.AUTO).
        Parameters:
        aBaudRate - The baud rate to be set.
        aDataBits - The data bits to be set.
        aStopBits - The StopBits to be set.
        aParity - The Parity be set.
        Returns:
        This instance as of the builder pattern.
        Throws:
        IOException - Thrown in case opening or accessing the Port caused problems.
      • withOpen

        public TtyPort withOpen​(BaudRate aBaudRate,
                                int aDataBits,
                                StopBits aStopBits,
                                Parity aParity)
                         throws IOException
        Builder method for opening a TtyPort instance. Timeouts are disabled. The underlying system's implementation or other implementation specific handshaking is used (Handshake.AUTO).
        Parameters:
        aBaudRate - The BaudRate to be set.
        aDataBits - The data bits to be set.
        aStopBits - The StopBits to be set.
        aParity - The Parity be set.
        Returns:
        This instance as of the builder pattern.
        Throws:
        IOException - Thrown in case opening or accessing the Port caused problems.
      • withOpen

        public TtyPort withOpen​(int aBaudRate)
                         throws IOException
        Builder method for opening a TtyPort instance. Timeouts are disabled. The underlying system's implementation or other implementation specific handshaking, stop bits and parity are used (Handshake.AUTO).
        Parameters:
        aBaudRate - The baud rate to be set.
        Returns:
        This instance as of the builder pattern.
        Throws:
        IOException - Thrown in case opening or accessing the Port caused problems.
      • withOpen

        public TtyPort withOpen​(BaudRate aBaudRate)
                         throws IOException
        Builder method for opening a TtyPort instance. Timeouts are disabled. The underlying system's implementation or other implementation specific handshaking, stop bits and parity are used (Handshake.AUTO).
        Parameters:
        aBaudRate - The BaudRate to be set.
        Returns:
        This instance as of the builder pattern.
        Throws:
        IOException - Thrown in case opening or accessing the Port caused problems.
      • withOpenUnchecked

        public TtyPort withOpenUnchecked()
        Specified by:
        withOpenUnchecked in interface org.refcodes.component.Openable.OpenBuilder<org.refcodes.serial.Port<TtyPortMetrics>>
      • withOpenUnchecked

        public TtyPort withOpenUnchecked​(TtyPortMetrics aPortMetrics)
        Specified by:
        withOpenUnchecked in interface org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<TtyPortMetrics,​org.refcodes.serial.Port<TtyPortMetrics>>
      • getPortMetrics

        public TtyPortMetrics getPortMetrics()
        Specified by:
        getPortMetrics in interface org.refcodes.serial.PortMetricsAccessor<TtyPortMetrics>
      • isOpened

        public boolean isOpened()
        Specified by:
        isOpened in interface org.refcodes.component.ConnectionStatusAccessor
        Specified by:
        isOpened in interface org.refcodes.component.OpenedAccessor
        Overrides:
        isOpened in class org.refcodes.component.ConnectionAutomatonImpl<TtyPortMetrics>
      • close

        public void close()
                   throws IOException
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface org.refcodes.component.Closable
        Specified by:
        close in interface org.refcodes.serial.SerialReceiver
        Overrides:
        close in class org.refcodes.component.ConnectionAutomatonImpl<TtyPortMetrics>
        Throws:
        IOException
      • getInputStream

        public InputStream getInputStream()
        Specified by:
        getInputStream in interface org.refcodes.io.BytesReceiver
        Specified by:
        getInputStream in interface org.refcodes.mixin.InputStreamAccessor
      • getInputStream

        public org.refcodes.io.TimeoutInputStream getInputStream​(long aTimeoutInMs)
        Specified by:
        getInputStream in interface org.refcodes.io.BytesReceiver
        Specified by:
        getInputStream in interface org.refcodes.io.TimeoutInputStreamAccessor
      • getOutputStream

        public OutputStream getOutputStream()
        Specified by:
        getOutputStream in interface org.refcodes.io.BytesTransmitter
        Specified by:
        getOutputStream in interface org.refcodes.mixin.OutputStreamAccessor