com.dalsemi.comm
Class SerialPort

java.lang.Object
  |
  +--com.dalsemi.comm.CommPort
        |
        +--com.dalsemi.comm.SerialPort

public class SerialPort
extends CommPort

Serial Port implements a RS-232 serial communications port. SerialPort describes the low-level interface to the serial communications port. To change the serial port baud rate do the following at the beginning of your program.
....
public static void main(String[] args)
{
SerialPort sp = new SerialPort(SerialPort.SERIAL0, SerialPort.STDOUT);
sp.setBaudRate(SerialPort.SPEED_300);

}
NOTE: Changing the speed on any of the streams (stdin, stdout, stderr) causes all streams to change to the speed.
....


Field Summary
static int COMMAND
          Deprecated.  
static int GENERIC
          Deprecated.  
static int SERIAL0
          Deprecated. Serial port 0
static int SERIAL1
          Deprecated. Serial port 1
static int SERIAL2
          Deprecated. Serial port 0
static int SERIAL3
          Deprecated. Serial port 1
static int SERIALDEFAULTREADTIMEOUT
          Deprecated. Default serial port read timeout (not currently used)
static int SPEED_115200
          Deprecated. Baud Rate 115200 bps
static int SPEED_1200
          Deprecated. Baud Rate 1200 bps
static int SPEED_19200
          Deprecated. Baud Rate 19200 bps
static int SPEED_2400
          Deprecated. Baud Rate 2400 bps
static int SPEED_300
          Deprecated. Baud Rate 300 bps
static int SPEED_38400
          Deprecated. Baud Rate 38400 bps
static int SPEED_4800
          Deprecated. Baud Rate 4800 bps
static int SPEED_57600
          Deprecated. Baud Rate 57600 bps
static int SPEED_600
          Deprecated. Baud Rate 600 bps
static int SPEED_9600
          Deprecated. Baud Rate 9600 bps
static int STDERR
          Deprecated. Standard error
static int STDIN
          Deprecated. Standard in
static int STDOUT
          Deprecated. Standard out
 
Constructor Summary
SerialPort(int portnum, int stream)
          Deprecated. Constructs a new serial port object.
 
Method Summary
 int available()
          Deprecated. Returns the number of bytes available on the port.
 void close()
          Deprecated. Close the serial port.
 void disableReceiveTimeout()
          Deprecated. disables the receive timeout.
 void enableReceiveTimeout()
          Deprecated. enables the receive timeout - currently not implemented.
 int getBaudRate()
          Deprecated.  
 int getInputBufferSize()
          Deprecated. Gets the size of the input buffer.
 java.io.InputStream getInputStream()
          Deprecated. Gets the serial port input stream
 int getOutputBufferSize()
          Deprecated. Gets the size of the output buffer.
 java.io.OutputStream getOutputStream()
          Deprecated. Gets the serial port output stream
 boolean isReceiveTimeoutEnabled()
          Deprecated. Returns true if the receive timeout is enabled.
 void open()
          Deprecated. Opens the serial port.
 int read()
          Deprecated. Reads an integer from the serial port.
 int read(byte[] arr, int offset, int len)
          Deprecated. Reads len bytes of array arr from offset to the serial port.
 void sendBreak(int timeMS)
          Deprecated. Sends a break on the serial port.
 void setBaudRate(int speed)
          Deprecated. Sets the baud rate for the port.
 void setInputBufferSize(int size)
          Deprecated. Sets the size of the input buffer.
 void setOutputBufferSize(int size)
          Deprecated. Sets the size of the output buffer.
 void setReceiveTimeout(int timeout)
          Deprecated. sets the receive timeout to the given value.
 void write(byte[] arr)
          Deprecated. Writes the entire byte array arr to the serial port.
 void write(byte[] arr, int offset, int len)
          Deprecated. Writes len bytes of array arr from offset to the serial port.
 void write(int value)
          Deprecated. Writes the integer value to the serial port.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERIAL0

public static final int SERIAL0
Deprecated. 
Serial port 0

SERIAL1

public static final int SERIAL1
Deprecated. 
Serial port 1

SERIAL2

public static final int SERIAL2
Deprecated. 
Serial port 0

SERIAL3

public static final int SERIAL3
Deprecated. 
Serial port 1

COMMAND

public static final int COMMAND
Deprecated.  
Command stream

STDIN

public static final int STDIN
Deprecated. 
Standard in

STDOUT

public static final int STDOUT
Deprecated. 
Standard out

STDERR

public static final int STDERR
Deprecated. 
Standard error

GENERIC

public static final int GENERIC
Deprecated.  
Generic stream

SPEED_300

public static final int SPEED_300
Deprecated. 
Baud Rate 300 bps

SPEED_600

public static final int SPEED_600
Deprecated. 
Baud Rate 600 bps

SPEED_1200

public static final int SPEED_1200
Deprecated. 
Baud Rate 1200 bps

SPEED_2400

public static final int SPEED_2400
Deprecated. 
Baud Rate 2400 bps

SPEED_4800

public static final int SPEED_4800
Deprecated. 
Baud Rate 4800 bps

SPEED_9600

public static final int SPEED_9600
Deprecated. 
Baud Rate 9600 bps

SPEED_19200

public static final int SPEED_19200
Deprecated. 
Baud Rate 19200 bps

SPEED_38400

public static final int SPEED_38400
Deprecated. 
Baud Rate 38400 bps

SPEED_57600

public static final int SPEED_57600
Deprecated. 
Baud Rate 57600 bps

SPEED_115200

public static final int SPEED_115200
Deprecated. 
Baud Rate 115200 bps

SERIALDEFAULTREADTIMEOUT

public static final int SERIALDEFAULTREADTIMEOUT
Deprecated. 
Default serial port read timeout (not currently used)
Constructor Detail

SerialPort

public SerialPort(int portnum,
                  int stream)
           throws java.io.IOException
Deprecated. 
Constructs a new serial port object.
Parameters:
portnum - - the serial port number that this should be associated with.
stream - - the stream to open.
Throws:
java.io.IOException -  
See Also:
Method Detail

open

public void open()
Deprecated. 
Opens the serial port. This should not be called directly. In the future, you will be able to use this method, but for now it is broken. The port is opened by the input/otuput stream classes.
Overrides:
open in class CommPort

close

public void close()
           throws java.io.IOException
Deprecated. 
Close the serial port. This should not be called directly. In the future, you will be able to use this method, but for now it is broken. The port is closed by the input/otuput stream classes.
Throws:
java.io.IOException -  
Overrides:
close in class CommPort

write

public void write(byte[] arr)
           throws java.io.IOException
Deprecated. 
Writes the entire byte array arr to the serial port.
Parameters:
arr - the array to be written to the serial port.
Throws:
java.io.IOException -  

write

public void write(byte[] arr,
                  int offset,
                  int len)
           throws java.io.IOException
Deprecated. 
Writes len bytes of array arr from offset to the serial port.
Parameters:
arr - the array to be written.
offset - the offset in the array to begin sending.
len - the number of bytes to send.
Throws:
java.io.IOException -  

write

public void write(int value)
           throws java.io.IOException
Deprecated. 
Writes the integer value to the serial port.
Parameters:
value - the integer to be written.
Throws:
java.io.IOException -  

read

public int read(byte[] arr,
                int offset,
                int len)
         throws java.io.IOException
Deprecated. 
Reads len bytes of array arr from offset to the serial port.
Parameters:
arr - the array for the data read to be placed in.
offset - the offset to begin saving data.
len - the number of bytes to read.
Throws:
java.io.IOException -  

read

public int read()
         throws java.io.IOException
Deprecated. 
Reads an integer from the serial port.
Returns:
the byte read.
Throws:
java.io.IOException -  

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Deprecated. 
Gets the serial port input stream
Returns:
InputStream
Throws:
throws - IOException
Overrides:
getInputStream in class CommPort

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Deprecated. 
Gets the serial port output stream
Returns:
OutputStream
Throws:
throws - IOException
Overrides:
getOutputStream in class CommPort

enableReceiveTimeout

public void enableReceiveTimeout()
                          throws UnsupportedCommOperationException
Deprecated. 
enables the receive timeout - currently not implemented.
Throws:
UnsupportedCommOperationException -  
Overrides:
enableReceiveTimeout in class CommPort

disableReceiveTimeout

public void disableReceiveTimeout()
                           throws UnsupportedCommOperationException
Deprecated. 
disables the receive timeout. - currently not implemented. Receive timeout is alway on.
Throws:
UnsupportedCommOperationException -  
Overrides:
disableReceiveTimeout in class CommPort

setReceiveTimeout

public void setReceiveTimeout(int timeout)
                       throws UnsupportedCommOperationException
Deprecated. 
sets the receive timeout to the given value.
Parameters:
timeout - the value to delay before timeing out.
Throws:
UnsupportedCommOperationException -  
Overrides:
setReceiveTimeout in class CommPort

isReceiveTimeoutEnabled

public boolean isReceiveTimeoutEnabled()
Deprecated. 
Returns true if the receive timeout is enabled. currently always returns true.
Returns:
boolean true if receive timeout is enabled
Overrides:
isReceiveTimeoutEnabled in class CommPort

getInputBufferSize

public int getInputBufferSize()
Deprecated. 
Gets the size of the input buffer. This method currently returns 1 which is not necessarily the correct size.
Returns:
the size of the input buffer.
Overrides:
getInputBufferSize in class CommPort

getOutputBufferSize

public int getOutputBufferSize()
Deprecated. 
Gets the size of the output buffer. This method currently returns 1 which is not necessarily the correct size.
Returns:
the size of the output buffer.
Overrides:
getOutputBufferSize in class CommPort

setInputBufferSize

public void setInputBufferSize(int size)
                        throws UnsupportedCommOperationException
Deprecated. 
Sets the size of the input buffer.
Parameters:
size - the size of the input buffer.
Throws:
UnsupportedCommOperationException - thrown if the buffer cannot be resized.
Overrides:
setInputBufferSize in class CommPort

setOutputBufferSize

public void setOutputBufferSize(int size)
                         throws UnsupportedCommOperationException
Deprecated. 
Sets the size of the output buffer.
Parameters:
size - the size of the output buffer.
Throws:
UnsupportedCommOperationException - thrown if the output buffer cannot be resized.
Overrides:
setOutputBufferSize in class CommPort

setBaudRate

public void setBaudRate(int speed)
                 throws UnsupportedCommOperationException
Deprecated. 
Sets the baud rate for the port.
Parameters:
speed - use the static final ints
Throws:
UnsupportedCommOperationException -  
See Also:

getBaudRate

public int getBaudRate()
Deprecated. 

sendBreak

public void sendBreak(int timeMS)
Deprecated. 
Sends a break on the serial port.
Parameters:
timeMS - the duration of the break.
See Also:

available

public int available()
Deprecated. 
Returns the number of bytes available on the port.
Returns:
the number of bytes available.
See Also: