public interface CommConnectionControlLines extends CommConnection
Implementations of the CommConnectionControlLines interface are able to get the current state of DTR (Data Terminal Ready) signal and to receive its state changes. To receive the new states of the signal an implementation class for the CommConnectionControlLinesListener is necessary.
The state of the signals RING, DCD (Data Carrier Detect) and DSR (Data Set Ready) can be set calling the corresponding setting methods defined in this interface.
To access the control lines through a serial port there are two possibilities.
One is to open a connection with an object of CommConnectionControlLines, for example like:
CommConnectionControlLines cc = (CommConnectionControlLines) Connector.open("comm:com0;baudrate=19200");
But you can use as well a CommConnection object and cast it to a CommConnectionControlLines
one as in the following example:
CommConnection cc = (CommConnection) Connector.open("comm:com0;baudrate=19200");
CommConnectionControlLines ccControlLines = (CommConnectionControlLines)cc;
CommControlLinesListener
Modifier and Type | Method and Description |
---|---|
void |
addListener(CommConnectionControlLinesListener listener)
Registers listeners to receive state changes of COM control lines (DTR).
|
boolean |
getDTR()
Get the state of the DTR (Data Terminal Ready) signal of the connected COM port.
|
void |
setDCD(boolean signalState)
Set the state of the DCD (Data Carrier Detect) signal of the connected COM port
channel.
|
void |
setDSR(boolean signalState)
Set the state of the DSR (Data Set Ready) signal of the connected COM port
channel.
|
void |
setRING(boolean signalState)
Set the state of the RING signal of the connected COM port
channel.
|
getBaudRate, setBaudRate
openDataInputStream, openInputStream
openDataOutputStream, openOutputStream
close
void addListener(CommConnectionControlLinesListener listener)
listener
- of CommControlLines object to be registeredconnected
- COM portATCommandListener
,
#removeListener
boolean getDTR() throws IOException
connected
- COM portIOException
- if reading signal fails
because of some internal reasons.CommControlLinesListener
void setRING(boolean signalState) throws IOException
SignalState
- The new state of the signal.connected
- COM portIOException
- if setting signal failed
because of some internal reasons.void setDCD(boolean signalState) throws IOException
SignalState
- The new state of the signal.connected
- COM portIOException
- if setting signal failed
because of some internal reasons.void setDSR(boolean signalState) throws IOException
SignalState
- The new state of the signal.connected
- COM portIOException
- if setting signal failed
because of some internal reasons.Copyright (c) 1990, 2012, Oracle and/or its affiliates. All rights reserved.