- java.lang.Object
-
- org.refcodes.component.ConnectionAutomatonImpl<PM>
-
- org.refcodes.serial.AbstractPort<TtyPortMetrics>
-
- org.refcodes.serial.alt.tty.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
APort
is aPort
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
-
Constructor Summary
Constructors Modifier Constructor Description protected
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
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 thisTtyPort
.int
getWriteBufferSize()
Determines the size of the write buffer for thisTtyPort
.boolean
isOpenable()
boolean
isOpened()
void
open()
void
open(int aBaudRate)
Opens theTtyPort
instance.void
open(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity)
Opens theTtyPort
instance.void
open(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake)
Opens theTtyPort
instance.void
open(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake, int aReadTimeout, int aWriteTimeout)
Opens theTtyPort
instance.void
open(BaudRate aBaudRate)
Opens theTtyPort
instance.void
open(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity)
Opens theTtyPort
instance.void
open(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake)
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)
String
toString()
void
transmitSequence(org.refcodes.serial.Sequence aSequence)
TtyPort
withOpen()
TtyPort
withOpen(int aBaudRate)
Builder method for opening aTtyPort
instance.TtyPort
withOpen(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity)
Builder method for opening aTtyPort
instance.TtyPort
withOpen(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake)
Builder method for opening aTtyPort
instance.TtyPort
withOpen(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake, int aReadTimeout, int aWriteTimeout)
Builder method for opening aTtyPort
instance.TtyPort
withOpen(BaudRate aBaudRate)
Builder method for opening aTtyPort
instance.TtyPort
withOpen(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity)
Builder method for opening aTtyPort
instance.TtyPort
withOpen(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake)
Builder method for opening aTtyPort
instance.TtyPort
withOpen(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake, int aReadTimeout, int aWriteTimeout)
Builder method for opening aTtyPort
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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.refcodes.io.BytesReceiver
receiveAllBytes, receiveBytesWithin, receiveBytesWithin, receiveByteWithin, skip
-
Methods inherited from interface org.refcodes.component.Closable
closeIn, closeQuietly, closeUnchecked
-
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.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
-
-
-
-
Constructor Detail
-
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 Detail
-
getAlias
public String 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
public String 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
public String 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
public void open() throws IOException
- 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
public void open(TtyPortMetrics aConnection) throws IOException
- 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
public void open(int aBaudRate) throws IOException
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
public void open(BaudRate aBaudRate) throws IOException
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
public void transmitSequence(org.refcodes.serial.Sequence aSequence) throws IOException
- Specified by:
transmitSequence
in interfaceorg.refcodes.serial.SerialTransmitter
- Throws:
IOException
-
receiveBytes
public void receiveBytes(byte[] aBuffer, int aOffset, int aLength) throws IOException
- 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
public TtyPort withOpen(TtyPortMetrics aConnection) throws IOException
- Specified by:
withOpen
in interfaceorg.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<TtyPortMetrics,org.refcodes.serial.Port<TtyPortMetrics>>
- Throws:
IOException
-
withOpen
public TtyPort withOpen() throws IOException
- 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
public TtyPort withOpen(int aBaudRate) throws IOException
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
public TtyPort withOpen(BaudRate aBaudRate) throws IOException
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
public TtyPort withOpenUnchecked()
- Specified by:
withOpenUnchecked
in interfaceorg.refcodes.component.Openable.OpenBuilder<org.refcodes.serial.Port<TtyPortMetrics>>
-
withOpenUnchecked
public TtyPort withOpenUnchecked(TtyPortMetrics aPortMetrics)
- Specified by:
withOpenUnchecked
in interfaceorg.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<TtyPortMetrics,org.refcodes.serial.Port<TtyPortMetrics>>
-
getPortMetrics
public 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
public void close() throws IOException
- 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.component.ConnectionAutomatonImpl<TtyPortMetrics>
- Throws:
IOException
-
getInputStream
public InputStream 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 aTimeoutInMs)
- Specified by:
getInputStream
in interfaceorg.refcodes.io.BytesReceiver
- Specified by:
getInputStream
in interfaceorg.refcodes.io.TimeoutInputStreamAccessor
-
getOutputStream
public OutputStream getOutputStream()
- Specified by:
getOutputStream
in interfaceorg.refcodes.io.BytesTransmitter
- Specified by:
getOutputStream
in interfaceorg.refcodes.mixin.OutputStreamAccessor
-
-