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 inherited from class org.refcodes.serial.AbstractPort
_alias, _executorService, _portMetrics
Fields inherited from class org.refcodes.component.ConnectionAutomatonImpl
_connectionComponent
-
Constructor Summary
ModifierConstructorDescriptionprotected
TtyPort
(String aAlias, TtyPortMetrics aPortMetrics, String aName, String aDescription, com.fazecast.jSerialComm.SerialPort aSerialPort) Constructs aPort
with the given properties.protected
TtyPort
(String aAlias, TtyPortMetrics aPortMetrics, String aName, String aDescription, com.fazecast.jSerialComm.SerialPort aSerialPort, ExecutorService aExecutorService) Constructs aPort
with the given properties and the givenExecutorService
to be used by asynchronous functionality. -
Method Summary
Modifier and TypeMethodDescriptionint
void
close()
getAlias()
Returns the unambiguous technical name of the TTY-/COM-Port.org.refcodes.io.TimeoutInputStream
getInputStream
(long aTimeoutMillis) getName()
Returns the a more (not necessarily technical or unambiguous) name of the TTY-/COM-Port.int
Determines the size of the read buffer for thisTtyPort
.int
Determines the size of the write buffer for thisTtyPort
.boolean
boolean
isOpened()
void
open()
void
open
(int aBaudRate) Opens theTtyPort
instance.void
Opens theTtyPort
instance.void
Opens theTtyPort
instance.void
open
(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake, int aReadTimeout, int aWriteTimeout) Opens theTtyPort
instance.void
Opens theTtyPort
instance.void
Opens theTtyPort
instance.void
Opens theTtyPort
instance.void
open
(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake, int aReadTimeout, int aWriteTimeout) Opens theTtyPort
instance.void
open
(TtyPortMetrics aConnection) void
receiveBytes
(byte[] aBuffer, int aOffset, int aLength) toString()
void
transmitSequence
(org.refcodes.serial.Sequence aSequence) withOpen()
withOpen
(int aBaudRate) Builder method for opening aTtyPort
instance.Builder method for opening aTtyPort
instance.Builder method for opening aTtyPort
instance.withOpen
(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake, int aReadTimeout, int aWriteTimeout) Builder method for opening aTtyPort
instance.Builder method for opening aTtyPort
instance.Builder method for opening aTtyPort
instance.withOpen
(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake) Builder method for opening aTtyPort
instance.withOpen
(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake, int aReadTimeout, int aWriteTimeout) Builder method for opening aTtyPort
instance.withOpen
(TtyPortMetrics aConnection) 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 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
-
DEFAULT_STOP_BITS
-
-
Constructor Details
-
TtyPort
protected TtyPort(String aAlias, TtyPortMetrics aPortMetrics, String aName, String aDescription, com.fazecast.jSerialComm.SerialPort aSerialPort) Constructs aPort
with the given properties. The alias corresponds to the underlying TTY-/COM-Port's name.- Parameters:
aAlias
- The unambiguous technical name for thisPort
.aPortMetrics
- The metrics of thePort
.aName
- The human readable (not necessarily technical or unambiguous) name for thisPort
.aDescription
- The human readable description about the port.aSerialPort
- The underlyingSerialPort
being used for this implementation.
-
TtyPort
protected TtyPort(String aAlias, TtyPortMetrics aPortMetrics, String aName, String aDescription, com.fazecast.jSerialComm.SerialPort aSerialPort, ExecutorService aExecutorService) Constructs aPort
with the given properties and the givenExecutorService
to be used by asynchronous functionality. The alias corresponds to the underlying TTY-/COM-Port's name.- Parameters:
aAlias
- The unambiguous technical name for thisPort
.aPortMetrics
- The metrics of thePort
.aName
- The human readable (not necessarily technical or unambiguous) name for thisPort
.aDescription
- The human readable description about the port.aSerialPort
- The underlyingSerialPort
being used for this implementation.aExecutorService
- TheExecutorService
to be used when invoking asynchronously working methods.
-
-
Method Details
-
getAlias
Returns the unambiguous technical name of the TTY-/COM-Port.- Specified by:
getAlias
in interfaceorg.refcodes.mixin.AliasAccessor
- Overrides:
getAlias
in classorg.refcodes.serial.AbstractPort<TtyPortMetrics>
- Returns:
- The port's name.
-
getName
Returns the a more (not necessarily technical or unambiguous) name of the TTY-/COM-Port.- Specified by:
getName
in interfaceorg.refcodes.mixin.NameAccessor
- Returns:
- The port's verbose name.
-
getDescription
- Specified by:
getDescription
in interfaceorg.refcodes.mixin.DescriptionAccessor
-
getReadBufferSize
public int getReadBufferSize()Determines the size of the read buffer for thisTtyPort
. Depending on the underlyingTtyPort
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 thisTtyPort
.- Returns:
- The according buffer size.
-
isOpenable
public boolean isOpenable()- Specified by:
isOpenable
in interfaceorg.refcodes.component.Openable.OpenAutomaton
- Overrides:
isOpenable
in classorg.refcodes.serial.AbstractPort<TtyPortMetrics>
-
open
- Specified by:
open
in interfaceorg.refcodes.component.Openable
- Specified by:
open
in interfaceorg.refcodes.serial.SerialReceiver
- Overrides:
open
in classorg.refcodes.serial.AbstractPort<TtyPortMetrics>
- Throws:
IOException
-
open
- Specified by:
open
in interfaceorg.refcodes.component.ConnectionOpenable<TtyPortMetrics>
- Overrides:
open
in classorg.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 theTtyPort
instance.- Parameters:
aBaudRate
- The baud rate to be set.aDataBits
- The data bits to be set.aStopBits
- TheStopBits
to be set.aParity
- TheParity
be set.aHandshake
- TheHandshake
be set.aReadTimeout
- The read timeout to be set.aWriteTimeout
- The write timeout to be set.- Throws:
IOException
- Thrown in case opening or accessing thePort
caused problems.
-
open
public void open(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake, int aReadTimeout, int aWriteTimeout) throws IOException Opens theTtyPort
instance.- Parameters:
aBaudRate
- TheBaudRate
to be set.aDataBits
- The data bits to be set.aStopBits
- TheStopBits
to be set.aParity
- TheParity
be set.aHandshake
- TheHandshake
be set.aReadTimeout
- The read timeout to be set.aWriteTimeout
- The write timeout to be set.- Throws:
IOException
- Thrown in case opening or accessing thePort
caused problems.
-
open
public void open(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake) throws IOException Opens theTtyPort
instance. Timeouts are disabled.- Parameters:
aBaudRate
- The baud rate to be set.aDataBits
- The data bits to be set.aStopBits
- TheStopBits
to be set.aParity
- TheParity
be set.aHandshake
- TheHandshake
be set.- Throws:
IOException
- Thrown in case opening or accessing thePort
caused problems.
-
open
public void open(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake) throws IOException Opens theTtyPort
instance. Timeouts are disabled.- Parameters:
aBaudRate
- TheBaudRate
to be set.aDataBits
- The data bits to be set.aStopBits
- TheStopBits
to be set.aParity
- TheParity
be set.aHandshake
- TheHandshake
be set.- Throws:
IOException
- Thrown in case opening or accessing thePort
caused problems.
-
open
public void open(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity) throws IOException Opens theTtyPort
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
- TheStopBits
to be set.aParity
- TheParity
be set.- Throws:
IOException
- Thrown in case opening or accessing thePort
caused problems.
-
open
public void open(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity) throws IOException Opens theTtyPort
instance. Timeouts are disabled. The underlying system's implementation or other implementation specific handshaking is used (Handshake.AUTO
).- Parameters:
aBaudRate
- TheBaudRate
to be set.aDataBits
- The data bits to be set.aStopBits
- TheStopBits
to be set.aParity
- TheParity
be set.- Throws:
IOException
- Thrown in case opening or accessing thePort
caused problems.
-
open
Opens theTtyPort
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 thePort
caused problems.
-
open
Opens theTtyPort
instance. Timeouts are disabled. The underlying system's implementation or other implementation specific handshaking, stop bits and parity are used (Handshake.AUTO
).- Parameters:
aBaudRate
- TheBaudRate
to be set.- Throws:
IOException
- Thrown in case opening or accessing thePort
caused problems.
-
transmitSequence
- Specified by:
transmitSequence
in interfaceorg.refcodes.serial.SerialTransmitter
- Throws:
IOException
-
receiveBytes
- Specified by:
receiveBytes
in interfaceorg.refcodes.io.BytesDestination
- Throws:
IOException
-
available
public int available()- Specified by:
available
in interfaceorg.refcodes.io.Availability
- Specified by:
available
in interfaceorg.refcodes.serial.SerialReceiver
- Specified by:
available
in interfaceorg.refcodes.io.Skippable
-
withOpen
- Specified by:
withOpen
in interfaceorg.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<TtyPortMetrics,
org.refcodes.serial.Port<TtyPortMetrics>> - Throws:
IOException
-
withOpen
- Specified by:
withOpen
in interfaceorg.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 aTtyPort
instance.- Parameters:
aBaudRate
- The baud rate to be set.aDataBits
- The data bits to be set.aStopBits
- TheStopBits
to be set.aParity
- TheParity
be set.aHandshake
- TheHandshake
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 thePort
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 aTtyPort
instance.- Parameters:
aBaudRate
- TheBaudRate
to be set.aDataBits
- The data bits to be set.aStopBits
- TheStopBits
to be set.aParity
- TheParity
be set.aHandshake
- TheHandshake
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 thePort
caused problems.
-
withOpen
public TtyPort withOpen(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake) throws IOException Builder method for opening aTtyPort
instance. Timeouts are disabled.- Parameters:
aBaudRate
- The baud rate to be set.aDataBits
- The data bits to be set.aStopBits
- TheStopBits
to be set.aParity
- TheParity
be set.aHandshake
- TheHandshake
be set.- Returns:
- This instance as of the builder pattern.
- Throws:
IOException
- Thrown in case opening or accessing thePort
caused problems.
-
withOpen
public TtyPort withOpen(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake) throws IOException Builder method for opening aTtyPort
instance. Timeouts are disabled.- Parameters:
aBaudRate
- TheBaudRate
to be set.aDataBits
- The data bits to be set.aStopBits
- TheStopBits
to be set.aParity
- TheParity
be set.aHandshake
- TheHandshake
be set.- Returns:
- This instance as of the builder pattern.
- Throws:
IOException
- Thrown in case opening or accessing thePort
caused problems.
-
withOpen
public TtyPort withOpen(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity) throws IOException Builder method for opening aTtyPort
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
- TheStopBits
to be set.aParity
- TheParity
be set.- Returns:
- This instance as of the builder pattern.
- Throws:
IOException
- Thrown in case opening or accessing thePort
caused problems.
-
withOpen
public TtyPort withOpen(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity) throws IOException Builder method for opening aTtyPort
instance. Timeouts are disabled. The underlying system's implementation or other implementation specific handshaking is used (Handshake.AUTO
).- Parameters:
aBaudRate
- TheBaudRate
to be set.aDataBits
- The data bits to be set.aStopBits
- TheStopBits
to be set.aParity
- TheParity
be set.- Returns:
- This instance as of the builder pattern.
- Throws:
IOException
- Thrown in case opening or accessing thePort
caused problems.
-
withOpen
Builder method for opening aTtyPort
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 thePort
caused problems.
-
withOpen
Builder method for opening aTtyPort
instance. Timeouts are disabled. The underlying system's implementation or other implementation specific handshaking, stop bits and parity are used (Handshake.AUTO
).- Parameters:
aBaudRate
- TheBaudRate
to be set.- Returns:
- This instance as of the builder pattern.
- Throws:
IOException
- Thrown in case opening or accessing thePort
caused problems.
-
withOpenUnchecked
- Specified by:
withOpenUnchecked
in interfaceorg.refcodes.component.Openable.OpenBuilder<org.refcodes.serial.Port<TtyPortMetrics>>
-
withOpenUnchecked
- Specified by:
withOpenUnchecked
in interfaceorg.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<TtyPortMetrics,
org.refcodes.serial.Port<TtyPortMetrics>>
-
getPortMetrics
- Specified by:
getPortMetrics
in interfaceorg.refcodes.serial.PortMetricsAccessor<TtyPortMetrics>
-
isOpened
public boolean isOpened()- Specified by:
isOpened
in interfaceorg.refcodes.component.ConnectionStatusAccessor
- Specified by:
isOpened
in interfaceorg.refcodes.component.OpenedAccessor
- Overrides:
isOpened
in classorg.refcodes.component.ConnectionAutomatonImpl<TtyPortMetrics>
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceorg.refcodes.component.Closable
- Specified by:
close
in interfaceorg.refcodes.serial.SerialReceiver
- Overrides:
close
in classorg.refcodes.serial.AbstractPort<TtyPortMetrics>
- Throws:
IOException
-
getInputStream
- Specified by:
getInputStream
in interfaceorg.refcodes.io.BytesReceiver
- Specified by:
getInputStream
in interfaceorg.refcodes.mixin.InputStreamAccessor
-
getInputStream
public org.refcodes.io.TimeoutInputStream getInputStream(long aTimeoutMillis) - Specified by:
getInputStream
in interfaceorg.refcodes.io.BytesReceiver
- Specified by:
getInputStream
in interfaceorg.refcodes.io.TimeoutInputStreamAccessor
-
getOutputStream
- Specified by:
getOutputStream
in interfaceorg.refcodes.io.BytesTransmitter
- Specified by:
getOutputStream
in interfaceorg.refcodes.mixin.OutputStreamAccessor
-
toString
-