public static final class SerialDefs.Helper extends Object
SerialDefs
.Modifier and Type | Method and Description |
---|---|
static int |
asParity(CharSequence parityString)
Interpret a character sequence as parity specification.
|
static int |
baudRate(int baudIndex)
Determine the baud rate from an baud index.
|
static String |
eventAsString(int eventType)
Event type as String.
|
static StringBuilder |
flowControlAsText(StringBuilder bastel,
int flowControlMode)
Data flow control mode as String.
|
static SerialDefs |
newInstance(CharSequence implClass,
CharSequence portName)
Fetch an object on an implementing class, optionally open the port.
|
static String |
parityAsString(int parity)
Parity as String.
|
static StringBuilder |
stateAsString(StringBuilder sb,
SerialDefs port)
Text representation of the interface's state.
|
public static String parityAsString(int parity)
SerialDefs
) "--" is returned.public static String eventAsString(int eventType)
PE
, FE
,
OE
and so on human readable texts like
"parity error", "output buffer empty" and so on are
returned. For no match to SerialDefs
's event type constants
"none" is returned.public static StringBuilder flowControlAsText(StringBuilder bastel, int flowControlMode)
flowControlMode
will be interpreted according to
SerialDefs
's flow control constants and appended as character
sequence to bastel
.bastel
- StringBuilder to append to; if null bastel
is made
with an initial capacity of 20flowControlMode
- see SerialDefs
public static StringBuilder stateAsString(StringBuilder sb, SerialDefs port)
sb
as three line
text.sb
- StringBuilder to append to; if null sb
is made with
initial capacity of 180port
- the implementation, the state of which shall be reportedpublic static int asParity(CharSequence parityString)
SerialDefs
parity constant and its value returned.public static int baudRate(int baudIndex)
baudIndex
in the range 0 to 12 will be
interpreted as the number / index of one of the usual (standard) baud
rates:baudIndex
) values >= 60 will be returned unchanged
as they may be special baut rates.baudIndex
- Index 0..12 or itself a rate (if >= 60)public static SerialDefs newInstance(CharSequence implClass, CharSequence portName)
SerialDefs
making it by its parameterless Constructor. If the
parameter implClass
does not denominate a fitting class
"de.frame4j.io.SerNimpl" will be taken.getClass
.getName()
.SerialDefs
object fails, null is
returned.portName
is not empty it will be tried to
connect the SerialDefs
object just made by
openSerial(portName)
. The
parameter portName
may also be a list (according to the rules of
the method prepParams(portName, null, false)
) of port names. that will be tried
one by one until success or end of list.open
/ to connect can be
checked by isReady()
of the object returned.
In the case of a supplied port name list
getPortName()
will return the single
port name used / connected to in the end.implClass
- the implementing classes name; default is
de.frame4j.io.SerNimplportName
- operation system / platform name or names of the serial
port to optionally connect; e.g
"COM2" or a list like
"COM2 serialB"; null or empty means no opening
connecting to be tried by using
SerialDefs
.openSerial(portName)
SerialDefs
objectTextHelper.prepParams(CharSequence, String, boolean)