-
- All Superinterfaces:
AutoCloseable,Describable,Identity,IO<Serial,SerialConfig,SerialProvider>,IODataReader,IODataWriter,Lifecycle,Readable
- All Known Implementing Classes:
SerialBase
public interface Serial extends IO<Serial,SerialConfig,SerialProvider>, AutoCloseable, IODataWriter, IODataReader
Serial interface.
- Version:
- $Id: $Id
- Author:
- Robert Savage (http://www.savagehomeautomation.com)
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_BAUDConstantDEFAULT_BAUD=9600static DataBitsDEFAULT_DATA_BITSConstantDEFAULT_DATA_BITSstatic FlowControlDEFAULT_FLOW_CONTROLConstantDEFAULT_FLOW_CONTROLstatic ParityDEFAULT_PARITYConstantDEFAULT_PARITYstatic StopBitsDEFAULT_STOP_BITSConstantDEFAULT_STOP_BITS
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description intavailable()Get the number of data bytes available in the serial receive buffervoidclose()close.default intdrain()This function will drain the current serial receive buffer of any lingering bytes.booleanisOpen()Serial Device Communication State is OPENstatic SerialConfigBuildernewConfigBuilder(Context context)newConfigBuilder.voidopen()open.-
Methods inherited from interface com.pi4j.common.Identity
describe, description, getDescription, getId, getMetadata, getName, id, metadata, name
-
Methods inherited from interface com.pi4j.io.IODataReader
getInputStream, in, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, readByte, readByteBuffer, readByteBuffer, readCharArray, readCharArray, readCharArray, readCharArray, readCharBuffer, readCharBuffer, readCharBuffer, readCharBuffer, readNBytes, readNBytes, readString, readString, readString, readString
-
Methods inherited from interface com.pi4j.io.IODataWriter
getOutputStream, out, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write
-
Methods inherited from interface com.pi4j.common.Lifecycle
initialize, shutdown
-
-
-
-
Field Detail
-
DEFAULT_BAUD
static final int DEFAULT_BAUD
ConstantDEFAULT_BAUD=9600- See Also:
- Constant Field Values
-
DEFAULT_DATA_BITS
static final DataBits DEFAULT_DATA_BITS
ConstantDEFAULT_DATA_BITS
-
DEFAULT_PARITY
static final Parity DEFAULT_PARITY
ConstantDEFAULT_PARITY
-
DEFAULT_STOP_BITS
static final StopBits DEFAULT_STOP_BITS
ConstantDEFAULT_STOP_BITS
-
DEFAULT_FLOW_CONTROL
static final FlowControl DEFAULT_FLOW_CONTROL
ConstantDEFAULT_FLOW_CONTROL
-
-
Method Detail
-
newConfigBuilder
static SerialConfigBuilder newConfigBuilder(Context context)
newConfigBuilder.
- Parameters:
context-Context- Returns:
- a
SerialConfigBuilderobject.
-
isOpen
boolean isOpen()
Serial Device Communication State is OPEN- Returns:
- The Serial device communication state
-
available
int available()
Get the number of data bytes available in the serial receive buffer- Returns:
- a int.
-
drain
default int drain()
This function will drain the current serial receive buffer of any lingering bytes.- Returns:
- Returns the number of bytes of data drained (>=0) if OK, otherwise a negative error code.
-
open
void open()
open.
-
close
void close()
close.
- Specified by:
closein interfaceAutoCloseable
-
-