java.lang.Object
org.refcodes.component.ConnectionAutomatonImpl<PM>
org.refcodes.serial.AbstractPort<TtyPortMetrics>
org.refcodes.serial.alt.tty.TtyPort
All Implemented Interfaces:
Flushable, AutoCloseable, Comparable<org.refcodes.serial.Port<?>>, 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 TtyPort is a Port implementation harnessing the serial (COM) port.
  • 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 final Parity
     
    static final StopBits
     

    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

    Modifier and Type
    Method
    Description
    int
    void
    Returns the unambiguous technical name of the TTY-/COM-Port.
    org.refcodes.io.TimeoutInputStream
    getInputStream(long aTimeoutMillis)
    Returns the a more (not necessarily technical or unambiguous) name of the TTY-/COM-Port.
    int
    Determines the size of the read buffer for this TtyPort.
    int
    Determines the size of the write buffer for this TtyPort.
    boolean
    boolean
    void
    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)
    void
    transmitSequence(org.refcodes.serial.Sequence aSequence)
    withOpen(int aBaudRate)
    Builder method for opening a TtyPort instance.
    withOpen(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity)
    Builder method for opening a TtyPort instance.
    withOpen(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake)
    Builder method for opening a TtyPort instance.
    withOpen(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake, int aReadTimeout, int aWriteTimeout)
    Builder method for opening a TtyPort instance.
    withOpen(BaudRate aBaudRate)
    Builder method for opening a TtyPort instance.
    withOpen(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity)
    Builder method for opening a TtyPort instance.
    withOpen(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake)
    Builder method for opening a TtyPort instance.
    withOpen(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake, int aReadTimeout, int aWriteTimeout)
    Builder method for opening a TtyPort instance.
    withOpen(TtyPortMetrics aConnection)

    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 class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    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.Port

    compareTo

    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, skipAvailableWithin
  • Field Details

    • DEFAULT_PARITY

      public static final Parity DEFAULT_PARITY
    • DEFAULT_STOP_BITS

      public static final StopBits DEFAULT_STOP_BITS
  • Constructor Details

    • 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 Details

    • 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(TtyPortMetrics aConnection) throws IOException
      Specified by:
      open in interface org.refcodes.component.ConnectionOpenable<TtyPortMetrics>
      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(TtyPortMetrics aConnection) throws IOException
      Specified by:
      withOpen in interface org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<TtyPortMetrics,org.refcodes.serial.Port<TtyPortMetrics>>
      Throws:
      IOException
    • withOpen

      public TtyPort withOpen() throws IOException
      Specified by:
      withOpen in interface org.refcodes.component.Openable.OpenBuilder<org.refcodes.serial.Port<TtyPortMetrics>>
      Throws:
      IOException
    • 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.serial.AbstractPort<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 aTimeoutMillis)
      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
    • toString

      public String toString()
      Overrides:
      toString in class Object