|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.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[])| Field Summary |
| 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 |
onDeath()
onDeath - this function is called when the appliation is killed or dies allowing for clean-up |
void |
removeEventListener()
Removes an event listener. |
void |
sendBreak(int millis)
Sends a break on the serial port. |
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 opened
java.lang.IllegalArgumentException - if the specified port name is not
supported on TINI. Valid port names include serial0
through serial3
javax.comm.PortInUseException - if opening Serial1 and it is not enabled, ie.
still configured as one wire master| Method Detail |
public void onDeath()
onDeath in interface ProcessDeathListenerpublic 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 parity
java.lang.IllegalStateException - if the port is not open
javax.comm.UnsupportedCommOperationExceptionpublic void sendBreak(int millis)
millis - desired duration of the break in milliseconds
java.lang.IllegalStateException - if the port is not open
public 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
flowC -
java.lang.IllegalStateException - if the port is not open
javax.comm.UnsupportedCommOperationExceptionpublic 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 parity
javax.comm.UnsupportedCommOperationException - never
java.lang.IllegalStateException - if the port is not openpublic void setDTR(boolean dtr)
dtr - set to true to enable DTR
java.lang.IllegalStateException - if the port is not open
javax_comm_UnsupportedCommOperationException - - if this is called on a serial port that does not have flow control enabledpublic boolean isDTR()
javax.comm.SerialPort.
java.lang.IllegalStateException - if the port is not opengetDTR()public boolean getDTR()
java.lang.IllegalStateException - if the port is not openpublic void setRTS(boolean rts)
rts - set to true to enable RTS
java.lang.IllegalStateException - if the port is not openpublic boolean isRTS()
javax.comm.SerialPort.
java.lang.IllegalStateException - if the port is not opengetRTS()public boolean getRTS()
java.lang.IllegalStateException - if the port is not openpublic boolean isCTS()
javax.comm.SerialPort.
java.lang.IllegalStateException - if the port is not opengetCTS()public boolean getCTS()
java.lang.IllegalStateException - if the port is not openpublic boolean isDSR()
javax.comm.SerialPort.
java.lang.IllegalStateException - if the port is not opengetDSR()public boolean getDSR()
java.lang.IllegalStateException - if the port is not openpublic boolean isRI()
javax.comm.SerialPort.
java.lang.IllegalStateException - if the port is not opengetRI()public boolean getRI()
java.lang.IllegalStateException - if the port is not openpublic boolean isCD()
javax.comm.SerialPort.
java.lang.IllegalStateException - if the port is not opengetCD()public boolean getCD()
java.lang.IllegalStateException - if the port is not open
public void addEventListener(javax.comm.SerialPortEventListener eventListener)
throws java.util.TooManyListenersException
eventListener - listener class to be installed
java.lang.IllegalStateException - if the port is not open
java.util.TooManyListenersException - if the maximum number of listeners has
been 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 enable
public java.io.InputStream getInputStream()
throws java.io.IOException
java.io.IOException - if the stream is not available
java.lang.IllegalStateException - if the port is not open
public java.io.OutputStream getOutputStream()
throws java.io.IOException
java.io.IOException - if the stream is not available
java.lang.IllegalStateException - if the port is not open
public void enableReceiveThreshold(int thresh)
throws javax.comm.UnsupportedCommOperationException
thresh - - Desired read threshold
javax.comm.UnsupportedCommOperationException - if thresh < 0
java.lang.IllegalStateException - if the InputStream is not accessablepublic void disableReceiveThreshold()
public boolean isReceiveThresholdEnabled()
javax.comm.SerialPort.
public int getReceiveThreshold()
public void enableReceiveTimeout(int rcvTimeout)
throws javax.comm.UnsupportedCommOperationException
rcvTimeout - timeout in milliseconds
javax.comm.UnsupportedCommOperationException - if rcvTimeout < 0
java.lang.IllegalStateException - if the port is closedpublic void disableReceiveTimeout()
java.lang.IllegalStateException - if the port is closedpublic boolean isReceiveTimeoutEnabled()
public int getReceiveTimeout()
public void enableReceiveFraming(int framingByte)
throws javax.comm.UnsupportedCommOperationException
framingByte -
javax.comm.UnsupportedCommOperationException - alwayspublic 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 buffer
public int getInputHandle()
throws java.io.IOException
PPPDevice
getInputHandle in interface PPPDevicejava.io.IOException
public int getOutputHandle()
throws java.io.IOException
PPPDevice
getOutputHandle in interface PPPDevicejava.io.IOException
public int getDeviceNumber()
throws java.io.IOException
PPPDevice
getDeviceNumber in interface PPPDevicejava.io.IOExceptionpublic int getOutputBufferSize()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||