|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.comm.CommPort | +--javax.comm.SerialPort | +--com.dalsemi.comm.TINISerialPort
This class is the actual serial port implementation used by
javax.comm.SerialPort
and should not be used directly.
In previous versions, this class had methods not defined in
javax.comm.SerialPort
specific to supporting serial I/O
on TINI. The functionality of these "extra" methods has been moved into the
TINIOS.setSerial
method.
The serial port is opened
automatically when a TINISerialPort
object is constructed.
serial0
, by default, is owned by the shell's SerialServer.
The shell command "downserver -s" must be called if an application, running
from the shell, wishes to take ownership of the port. serial1
,
by default, is owned by the external 1-Wire adapter. The DS2480 chip must be
removed and level shifters must be added to make this an RS-232 compatible
port. com.dalsemi.system.TINIOS.enableSerialPort1
must be called
to enable this port after the system is booted. serial2
and
serial3
require external hardware support (16552 Dual UART)
on a socket board to make use of these ports.
National Semiconductor PC16552 data sheet
TINIOS
,
TINIOS.setSerial(int,int,byte[])
Fields inherited from class javax.comm.SerialPort |
DATABITS_5,
DATABITS_6,
DATABITS_7,
DATABITS_8,
FLOWCONTROL_NONE,
FLOWCONTROL_RTSCTS_IN,
FLOWCONTROL_RTSCTS_OUT,
FLOWCONTROL_XONXOFF_IN,
FLOWCONTROL_XONXOFF_OUT,
PARITY_EVEN,
PARITY_MARK,
PARITY_NONE,
PARITY_ODD,
PARITY_SPACE,
STOPBITS_1,
STOPBITS_1_5,
STOPBITS_2 |
Fields inherited from class javax.comm.CommPort |
name |
Constructor Summary | |
TINISerialPort(java.lang.String name)
Constructor - Attempts to open the requested serial port specified by the parameter name . |
Method Summary | |
void |
addEventListener(javax.comm.SerialPortEventListener eventListener)
Adds an event listener for the port. |
void |
close()
Closes the serial port and associated streams. |
void |
disableReceiveFraming()
Disables the port's receive framing. |
void |
disableReceiveThreshold()
Disables the port's receive threshold. |
void |
disableReceiveTimeout()
Disables the port's receive timeout. |
void |
enableReceiveFraming(int framingByte)
Enables the port's receive framing. |
void |
enableReceiveThreshold(int thresh)
Enables the port's receive threshold. |
void |
enableReceiveTimeout(int rcvTimeout)
Enables the port's receive timeout. |
int |
getBaudRate()
Returns the port's current baud rate in bits per second. |
boolean |
getCD()
Returns the current state of CD at the exact time it was sampled by the native driver. |
boolean |
getCTS()
Returns the current state of CTS at the exact time it was sampled by the native driver. |
int |
getDataBits()
Returns the port's current the data bit (word size) setting. |
int |
getDeviceNumber()
Returns the IO driver number |
boolean |
getDSR()
Returns the current state of DSR at the exact time it was sampled by the native driver. |
boolean |
getDTR()
Returns the current state of DTR at the exact time it was sampled by the native driver. |
int |
getFlowControlMode()
Returns the port's current flow control mode. |
int |
getInputBufferSize()
Returns the port's input buffer size. |
int |
getInputHandle()
Returns the handle to the IO input stream. |
java.io.InputStream |
getInputStream()
Returns the InputStream associated with this port. |
int |
getOutputBufferSize()
Returns the port's current output buffer size. |
int |
getOutputHandle()
Returns the handle to the IO output stream |
java.io.OutputStream |
getOutputStream()
Returns the OutputStream associated with this port. |
int |
getParity()
Returns the port's current parity setting. |
int |
getReceiveFramingByte()
Returns the port's receive framing byte. |
int |
getReceiveThreshold()
Returns the port's threshold enable state. |
int |
getReceiveTimeout()
Returns the port's current receive timeout. |
boolean |
getRI()
Returns the current state of RI at the exact time it was sampled by the native driver. |
boolean |
getRTS()
Returns the current state of RTS at the exact time it was sampled by the native driver. |
int |
getStopBits()
Returns the port's current stop bits setting. |
boolean |
isCD()
Returns the current state of CD at the exact time it was sampled by the native driver. |
boolean |
isCTS()
Returns the current state of CTS at the exact time it was sampled by the native driver. |
boolean |
isDSR()
Returns the current state of DSR at the exact time it was sampled by the native driver. |
boolean |
isDTR()
Returns the current state of DTR at the exact time it was sampled by the native driver. |
boolean |
isReceiveFramingEnabled()
Returns the port's receive framing enable state. |
boolean |
isReceiveThresholdEnabled()
Returns the port's threshold enable state. |
boolean |
isReceiveTimeoutEnabled()
Returns the port's receive timeout enable state. |
boolean |
isRI()
Returns the current state of RI at the exact time it was sampled by the native driver. |
boolean |
isRTS()
Returns the current state of RTS at the exact time it was sampled by the native driver. |
void |
notifyOnBreakInterrupt(boolean enable)
Requests notification when break interrupt occurs. |
void |
notifyOnCarrierDetect(boolean enable)
Requests notification when carrier detect changes state. |
void |
notifyOnCTS(boolean enable)
Requests notification when CTS changes state. |
void |
notifyOnDataAvailable(boolean enable)
Requests notification when data is available to read. |
void |
notifyOnDSR(boolean enable)
Requests notification when DSR changes state. |
void |
notifyOnFramingError(boolean enable)
Requests notification when framing error occurs. |
void |
notifyOnOutputEmpty(boolean enable)
Requests notification when output buffer is empty. |
void |
notifyOnOverrunError(boolean enable)
Requests notification when overrun error occurs. |
void |
notifyOnParityError(boolean enable)
Requests notification when parity error occurs. |
void |
notifyOnRingIndicator(boolean enable)
Requests notification when ring indicator changes state. |
void |
removeEventListener()
Removes an event listener. |
void |
sendBreak(int millis)
Sends a break on the serial port. |
void |
setBaudRate(int baudRate)
Sets the port's baud rate assuming the default crystal frequency. |
void |
setBitParameters(int dataBits,
int stopBits,
int parity)
Sets the serial port's word size, stop bits and parity parameters. |
void |
setDTR(boolean dtr)
Sets the state of DTR. |
void |
setFlowControlMode(int flowC)
Sets the port's flow control mode. |
void |
setInputBufferSize(int size)
Sets the port's input buffer size. |
void |
setOutputBufferSize(int size)
Sets the port's output buffer size. |
void |
setRcvFifoTrigger(int trigger)
Sets the receive FIFO trigger level for the external serial ports. |
void |
setRTS(boolean rts)
Sets the state of RTS. |
void |
setSerialPortParams(int baudRate,
int dataBits,
int stopBits,
int parity)
Sets serial port parameters including baud rate, data bits, stop bits and parity. |
Methods inherited from class javax.comm.CommPort |
getName,
toString |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public TINISerialPort(java.lang.String name)
name
.name
- the name of the serial port that is to be openedserial0
through serial3
Method Detail |
public void setRcvFifoTrigger(int trigger)
trigger
- number of bytes in the receive FIFO that will cause a
receive interruptpublic void close()
public int getBaudRate()
public int getDataBits()
public int getStopBits()
public int getParity()
public void setBitParameters(int dataBits, int stopBits, int parity) throws javax.comm.UnsupportedCommOperationException
dataBits
- desired word sizestopBits
- desired stop bitsparity
- desired paritypublic void sendBreak(int millis)
millis
- desired duration of the break in millisecondspublic void setFlowControlMode(int flowC) throws javax.comm.UnsupportedCommOperationException
javax.comm.SerialPort
values FLOWCONTROL_NONE
,
FLOWCONTROL_RTSCTS_IN
, FLOWCONTROL_RTSCTS_OUT
,
FLOWCONTROL_XONXOFF_IN
and FLOWCONTROL_XONXOFF_OUT
public int getFlowControlMode()
setFlowControlMode(int flowc)
public void setSerialPortParams(int baudRate, int dataBits, int stopBits, int parity) throws javax.comm.UnsupportedCommOperationException
baudRate
- the desired baud ratedataBits
- the desired word sizestopBits
- the desired stop bitsparity
- the desired paritypublic void setBaudRate(int baudRate)
desired
- baud rate in bits per secondpublic void setDTR(boolean dtr)
dtr
- set to true to enable DTRpublic boolean isDTR()
javax.comm.SerialPort
.getDTR()
public boolean getDTR()
public void setRTS(boolean rts)
desired
- set to true to enable RTSpublic boolean isRTS()
javax.comm.SerialPort
.getRTS()
public boolean getRTS()
public boolean isCTS()
javax.comm.SerialPort
.getCTS()
public boolean getCTS()
public boolean isDSR()
javax.comm.SerialPort
.getDSR()
public boolean getDSR()
public boolean isRI()
javax.comm.SerialPort
.getRI()
public boolean getRI()
public boolean isCD()
javax.comm.SerialPort
.getCD()
public boolean getCD()
public void addEventListener(javax.comm.SerialPortEventListener eventListener) throws java.util.TooManyListenersException
eventListener
- listener class to be installedpublic void removeEventListener()
public void notifyOnDataAvailable(boolean enable)
enable
- set to true to enablepublic void notifyOnOutputEmpty(boolean enable)
enable
- set to true to enablepublic void notifyOnCTS(boolean enable)
enable
- set to true to enablepublic void notifyOnDSR(boolean enable)
enable
- set to true to enablepublic void notifyOnRingIndicator(boolean enable)
enable
- set to true to enablepublic void notifyOnCarrierDetect(boolean enable)
enable
- set to true to enablepublic void notifyOnOverrunError(boolean enable)
enable
- set to true to enablepublic void notifyOnParityError(boolean enable)
enable
- set to true to enablepublic void notifyOnFramingError(boolean enable)
enable
- set to true to enablepublic void notifyOnBreakInterrupt(boolean enable)
enable
- set to true to enablepublic java.io.InputStream getInputStream() throws java.io.IOException
public java.io.OutputStream getOutputStream() throws java.io.IOException
public void enableReceiveThreshold(int thresh) throws javax.comm.UnsupportedCommOperationException
thresh
- threshold in millisecondspublic void disableReceiveThreshold()
public boolean isReceiveThresholdEnabled()
javax.comm.SerialPort
.public int getReceiveThreshold()
public void enableReceiveTimeout(int rcvTimeout) throws javax.comm.UnsupportedCommOperationException
rcvTimeout
- timeout in millisecondspublic void disableReceiveTimeout()
public boolean isReceiveTimeoutEnabled()
public int getReceiveTimeout()
public void enableReceiveFraming(int framingByte) throws javax.comm.UnsupportedCommOperationException
public void disableReceiveFraming()
public boolean isReceiveFramingEnabled()
public int getReceiveFramingByte()
public void setInputBufferSize(int size)
size
- number of bytes to use for the input receive bufferpublic int getInputBufferSize()
public void setOutputBufferSize(int size)
size
- number of bytes to use for the output transmit bufferpublic int getInputHandle() throws java.io.IOException
public int getOutputHandle() throws java.io.IOException
public int getDeviceNumber() throws java.io.IOException
public int getOutputBufferSize()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |