- java.lang.Object
-
- org.refcodes.serial.alt.tty.TtyPortMetrics
-
- org.refcodes.serial.alt.tty.TtyPortMetricsBuilder
-
- All Implemented Interfaces:
org.refcodes.mixin.ReadTimeoutInMsAccessor
,org.refcodes.mixin.WriteTimeoutInMsAccessor
,org.refcodes.serial.PortMetrics
public class TtyPortMetricsBuilder extends TtyPortMetrics
TheTtyPortMetricsBuilder
enriches theTtyPortMetrics
with builder functionality.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.ReadTimeoutInMsAccessor
org.refcodes.mixin.ReadTimeoutInMsAccessor.ReadTimeoutInMsBuilder<B extends org.refcodes.mixin.ReadTimeoutInMsAccessor.ReadTimeoutInMsBuilder<B>>, org.refcodes.mixin.ReadTimeoutInMsAccessor.ReadTimeoutInMsMutator, org.refcodes.mixin.ReadTimeoutInMsAccessor.ReadTimeoutInMsProperty
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.WriteTimeoutInMsAccessor
org.refcodes.mixin.WriteTimeoutInMsAccessor.WriteTimeoutInMsBuilder<B extends org.refcodes.mixin.WriteTimeoutInMsAccessor.WriteTimeoutInMsBuilder<B>>, org.refcodes.mixin.WriteTimeoutInMsAccessor.WriteTimeoutInMsMutator, org.refcodes.mixin.WriteTimeoutInMsAccessor.WriteTimeoutInMsProperty
-
-
Field Summary
-
Fields inherited from class org.refcodes.serial.alt.tty.TtyPortMetrics
_baudRate, _dataBits, _handshake, _parity, _readTimeoutInMs, _stopBits, _writeTimeoutInMs, DEFAULT_DATA_BITS
-
-
Constructor Summary
Constructors Constructor Description TtyPortMetricsBuilder(int aBaudRate)
Constructs thePortMetricsAccessor.PortMetricsBuilder
instance.TtyPortMetricsBuilder(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity)
Constructs thePortMetricsAccessor.PortMetricsBuilder
instance.TtyPortMetricsBuilder(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake)
Constructs thePortMetricsAccessor.PortMetricsBuilder
instance.TtyPortMetricsBuilder(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake, int aReadTimeout, int aWriteTimeout)
Constructs thePortMetricsAccessor.PortMetricsBuilder
instance.TtyPortMetricsBuilder(BaudRate aBaudRate)
Constructs thePortMetricsAccessor.PortMetricsBuilder
instance.TtyPortMetricsBuilder(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity)
Constructs thePortMetricsAccessor.PortMetricsBuilder
instance.TtyPortMetricsBuilder(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake)
Constructs thePortMetricsAccessor.PortMetricsBuilder
instance.TtyPortMetricsBuilder(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake, int aReadTimeout, int aWriteTimeout)
Constructs thePortMetricsAccessor.PortMetricsBuilder
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
setBaudRate(int aBaudRate)
The baud rate of the port.void
setBaudRate(BaudRate aBaudRate)
TheBaudRate
of the port.void
setDataBits(int aDataBits)
The number of data bits used by the port.void
setHandshake(Handshake aHandshake)
The kind ofHandshake
used by the port.void
setParity(Parity aParity)
TheParity
of the port.void
setReadTimeoutMillis(int aReadTimeout)
The read timeout in milliseconds.void
setStopBits(StopBits aStopBits)
The number of stop bits used by the port.void
setWriteTimeoutMillis(int aWriteTimeout)
The write timeout in milliseconds.TtyPortMetricsBuilder
withBaudRate(int aBaudRate)
The baud rate of the port.TtyPortMetricsBuilder
withBaudRate(BaudRate aBaudRate)
TheBaudRate
of the port.TtyPortMetricsBuilder
withDataBits(int aDataBits)
The data bits used by the port.TtyPortMetricsBuilder
withHandshake(Handshake aHandshake)
TheHandshake
used by the port.TtyPortMetricsBuilder
withPartiry(Parity aParity)
TheParity
of the port.TtyPortMetricsBuilder
withReadTimeoutMillis(int aReadTimeout)
The read timeout used by the port.TtyPortMetricsBuilder
withStopBits(StopBits aStopBits)
TheStopBits
used by the port.TtyPortMetricsBuilder
withWriteTimeoutMillis(int aWriteTimeout)
The write timeout used by the port.-
Methods inherited from class org.refcodes.serial.alt.tty.TtyPortMetrics
getBaudRate, getDataBits, getHandshake, getParity, getReadTimeoutInMs, getStopBits, getWriteTimeoutInMs, toString
-
-
-
-
Constructor Detail
-
TtyPortMetricsBuilder
public TtyPortMetricsBuilder(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake, int aReadTimeout, int aWriteTimeout)
Constructs thePortMetricsAccessor.PortMetricsBuilder
instance.
-
TtyPortMetricsBuilder
public TtyPortMetricsBuilder(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake, int aReadTimeout, int aWriteTimeout)
Constructs thePortMetricsAccessor.PortMetricsBuilder
instance.
-
TtyPortMetricsBuilder
public TtyPortMetricsBuilder(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake)
Constructs thePortMetricsAccessor.PortMetricsBuilder
instance. Timeouts are disabled.
-
TtyPortMetricsBuilder
public TtyPortMetricsBuilder(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity, Handshake aHandshake)
Constructs thePortMetricsAccessor.PortMetricsBuilder
instance. Timeouts are disabled.
-
TtyPortMetricsBuilder
public TtyPortMetricsBuilder(int aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity)
Constructs thePortMetricsAccessor.PortMetricsBuilder
instance. Timeouts are disabled. The underlying system's implementation or other implementation specific handshaking is used (Handshake.AUTO
).
-
TtyPortMetricsBuilder
public TtyPortMetricsBuilder(BaudRate aBaudRate, int aDataBits, StopBits aStopBits, Parity aParity)
Constructs thePortMetricsAccessor.PortMetricsBuilder
instance. Timeouts are disabled. The underlying system's implementation or other implementation specific handshaking is used (Handshake.AUTO
).
-
TtyPortMetricsBuilder
public TtyPortMetricsBuilder(BaudRate aBaudRate)
Constructs thePortMetricsAccessor.PortMetricsBuilder
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.
-
TtyPortMetricsBuilder
public TtyPortMetricsBuilder(int aBaudRate)
Constructs thePortMetricsAccessor.PortMetricsBuilder
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.
-
-
Method Detail
-
setBaudRate
public void setBaudRate(int aBaudRate)
The baud rate of the port.- Parameters:
aBaudRate
- The port's baud rate.
-
withBaudRate
public TtyPortMetricsBuilder withBaudRate(int aBaudRate)
The baud rate of the port.- Parameters:
aBaudRate
- The port's baud rate.- Returns:
- This instance as of the builder pattern.
-
setBaudRate
public void setBaudRate(BaudRate aBaudRate)
TheBaudRate
of the port.- Parameters:
aBaudRate
- The port's baud rate.
-
withBaudRate
public TtyPortMetricsBuilder withBaudRate(BaudRate aBaudRate)
TheBaudRate
of the port.- Parameters:
aBaudRate
- The port's baud rate.- Returns:
- This instance as of the builder pattern.
-
setParity
public void setParity(Parity aParity)
TheParity
of the port.- Parameters:
aParity
- The port's parity.
-
withPartiry
public TtyPortMetricsBuilder withPartiry(Parity aParity)
TheParity
of the port.- Parameters:
aParity
- The port's parity.- Returns:
- This instance as of the builder pattern.
-
setDataBits
public void setDataBits(int aDataBits)
The number of data bits used by the port.- Parameters:
aDataBits
- The data bits used by the port.
-
withDataBits
public TtyPortMetricsBuilder withDataBits(int aDataBits)
The data bits used by the port.- Parameters:
aDataBits
- The port's data bits being used.- Returns:
- This instance as of the builder pattern.
-
setStopBits
public void setStopBits(StopBits aStopBits)
The number of stop bits used by the port.- Parameters:
aStopBits
- The stop bits used by the port.
-
withStopBits
public TtyPortMetricsBuilder withStopBits(StopBits aStopBits)
TheStopBits
used by the port.- Parameters:
aStopBits
- The port's stop bits being used.- Returns:
- This instance as of the builder pattern.
-
setHandshake
public void setHandshake(Handshake aHandshake)
The kind ofHandshake
used by the port.- Parameters:
aHandshake
- The port's handshake being used.
-
withHandshake
public TtyPortMetricsBuilder withHandshake(Handshake aHandshake)
TheHandshake
used by the port.- Parameters:
aHandshake
- The port's stop bits being used.- Returns:
- This instance as of the builder pattern.
-
setReadTimeoutMillis
public void setReadTimeoutMillis(int aReadTimeout)
The read timeout in milliseconds.- Parameters:
aReadTimeout
- The read timeout.
-
withReadTimeoutMillis
public TtyPortMetricsBuilder withReadTimeoutMillis(int aReadTimeout)
The read timeout used by the port.- Parameters:
aReadTimeout
- The port's read timeout being used.- Returns:
- This instance as of the builder pattern.
-
setWriteTimeoutMillis
public void setWriteTimeoutMillis(int aWriteTimeout)
The write timeout in milliseconds.- Parameters:
aWriteTimeout
- The write timeout.
-
withWriteTimeoutMillis
public TtyPortMetricsBuilder withWriteTimeoutMillis(int aWriteTimeout)
The write timeout used by the port.- Parameters:
aWriteTimeout
- The port's write timeout being used.- Returns:
- This instance as of the builder pattern.
-
-