- 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
FieldsModifier and TypeFieldDescriptionstatic final intConstantDEFAULT_BAUD=9600static final DataBitsConstantDEFAULT_DATA_BITSstatic final FlowControlConstantDEFAULT_FLOW_CONTROLstatic final ParityConstantDEFAULT_PARITYstatic final StopBitsConstantDEFAULT_STOP_BITS -
Method Summary
Modifier and TypeMethodDescriptionintGet 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, nameMethods 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, readStringMethods 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, writeMethods inherited from interface com.pi4j.common.Lifecycle
initialize, shutdown
-
Field Details
-
DEFAULT_BAUD
static final int DEFAULT_BAUDConstantDEFAULT_BAUD=9600- See Also:
-
DEFAULT_DATA_BITS
ConstantDEFAULT_DATA_BITS -
DEFAULT_PARITY
ConstantDEFAULT_PARITY -
DEFAULT_STOP_BITS
ConstantDEFAULT_STOP_BITS -
DEFAULT_FLOW_CONTROL
ConstantDEFAULT_FLOW_CONTROL
-
-
Method Details
-
newConfigBuilder
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
-