public final class COMChannel extends java.lang.Object implements IChannel
Modifier and Type | Field and Description |
---|---|
static int |
DATABITS_7 |
static int |
DATABITS_8 |
static int |
PARITY_EVEN |
static int |
PARITY_NONE |
static int |
PARITY_ODD |
static int |
STOPBITS_1 |
static int |
STOPBITS_1_5 |
static int |
STOPBITS_2 |
Constructor and Description |
---|
COMChannel(java.lang.String portName)
Creates a new instance of COMChannel creating a serial port for the specified portName.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the communication channel.
|
void |
configure(int baudRate,
int dataBits,
int stopBits,
int parity)
Configure.
|
java.lang.String |
getID()
Returns the communication channel ID.
|
java.io.InputStream |
getInputStream() |
java.io.OutputStream |
getOutputStream() |
boolean |
isOpen()
Returns the open status of the communication channel.
|
void |
open(int timeout)
Opens the communication channel.
|
public static final int DATABITS_7
public static final int DATABITS_8
public static final int PARITY_NONE
public static final int PARITY_ODD
public static final int PARITY_EVEN
public static final int STOPBITS_1
public static final int STOPBITS_2
public static final int STOPBITS_1_5
public COMChannel(java.lang.String portName) throws ChannelException
portName
- The name of the port to create.ChannelException
- Thrown for any detected error.public java.io.InputStream getInputStream() throws java.io.IOException
getInputStream
in interface IChannel
java.io.IOException
public java.io.OutputStream getOutputStream() throws java.io.IOException
getOutputStream
in interface IChannel
java.io.IOException
public void open(int timeout) throws ChannelException
IChannel
open
in interface IChannel
timeout
- Default Timeout (in ms) to be used for all
read actions.ChannelException
- Thrown for any detected error.public void close()
IChannel
public void configure(int baudRate, int dataBits, int stopBits, int parity) throws ChannelException
baudRate
- dataBits
- stopBits
- parity
- ChannelException
public java.lang.String getID()
IChannel