com.dalsemi.comm
Class VendPort

java.lang.Object
  |
  +--com.dalsemi.comm.VendPort

public class VendPort
extends java.lang.Object


Field Summary
static int COMMAND
           
static int GENERIC
           
static int PARAM_COMMANDTABLE
           
static int SERIALDEFAULTREADTIMEOUT
           
static int SPEED_115200
           
static int SPEED_1200
           
static int SPEED_19200
           
static int SPEED_2400
           
static int SPEED_300
           
static int SPEED_38400
           
static int SPEED_4800
           
static int SPEED_57600
           
static int SPEED_600
           
static int SPEED_9600
           
static int STDERR
           
static int STDIN
           
static int STDOUT
           
static int VEND_PORT
           
 
Constructor Summary
VendPort(int portNum, int stream)
           
 
Method Summary
 int available()
          returns the number of bytes available on the port.
 void close()
          close the serial port.
 void disableReceiveTimeout()
          disables the receive timeout.
 void enableReceiveTimeout()
          enables the receive timeout - currently not implemented.
 int getInputBufferSize()
          gets the size of the input buffer.
 java.io.InputStream getInputStream()
          gets a serial port Input stream
 int getOutputBufferSize()
          gets the size of the output buffer.
 java.io.OutputStream getOutputStream()
          gets a serial port Output stream
 boolean isReceiveTimeoutEnabled()
          returns true if the receive timeout is enabled.
 void open()
          opens the serial port for communications.
 int read()
          read from the serial port.
 int read(byte[] arr, int offset, int len)
          read from the serial port.
 void sendBreak(int timeMS)
          Sends a break on the serial port.
 void setBaudRate(int speed)
          Sets the baud rate for the port.
 void setInputBufferSize(int size)
          sets the size of the input buffer.
 void setOutputBufferSize(int size)
          sets the size of the output buffer.
 void setReceiveTimeout(int timeout)
          sets the receive timeout to the given value.
static void setVendParams(int paramNum, byte[] params, int length)
           
 void write(byte[] arr)
          write to the serial port.
 void write(byte[] arr, int offset, int len)
          writes the given array to the serial port.
 void write(int ch)
          write the byte to the serial port.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VEND_PORT

public static final int VEND_PORT

COMMAND

public static final int COMMAND

STDIN

public static final int STDIN

STDOUT

public static final int STDOUT

STDERR

public static final int STDERR

GENERIC

public static final int GENERIC

SPEED_300

public static final int SPEED_300

SPEED_600

public static final int SPEED_600

SPEED_1200

public static final int SPEED_1200

SPEED_2400

public static final int SPEED_2400

SPEED_4800

public static final int SPEED_4800

SPEED_9600

public static final int SPEED_9600

SPEED_19200

public static final int SPEED_19200

SPEED_38400

public static final int SPEED_38400

SPEED_57600

public static final int SPEED_57600

SPEED_115200

public static final int SPEED_115200

SERIALDEFAULTREADTIMEOUT

public static final int SERIALDEFAULTREADTIMEOUT

PARAM_COMMANDTABLE

public static final int PARAM_COMMANDTABLE
Constructor Detail

VendPort

public VendPort(int portNum,
                int stream)
         throws java.io.IOException
Method Detail

setVendParams

public static void setVendParams(int paramNum,
                                 byte[] params,
                                 int length)

open

public void open()
opens the serial port for communications. This should not be called directly. In the future, you will be able to use this method, but for now it is broken.

close

public void close()
           throws java.io.IOException
close the serial port.

write

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

write

public void write(byte[] arr,
                  int offset,
                  int len)
           throws java.io.IOException
writes the given array 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.

write

public void write(int ch)
           throws java.io.IOException
write the byte to the serial port.
Parameters:
ch - - the data to be written.
Throws:
java.io.IOException -  

read

public int read(byte[] arr,
                int offset,
                int len)
         throws java.io.IOException
read from 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
read from the serial port.
Returns:
the byte read.
Throws:
java.io.IOException -  

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
gets a serial port Input stream
Returns:
InputStream
Throws:
throws - IOException

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
gets a serial port Output stream
Returns:
OutputStream
Throws:
throws - IOException

enableReceiveTimeout

public void enableReceiveTimeout()
                          throws UnsupportedCommOperationException
enables the receive timeout - currently not implemented.
Throws:
UnsupportedCommOperationException -  

disableReceiveTimeout

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

setReceiveTimeout

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

isReceiveTimeoutEnabled

public boolean isReceiveTimeoutEnabled()
returns true if the receive timeout is enabled. currently always returns true.
Returns:
boolean true if receive timeout is enabled

getInputBufferSize

public int getInputBufferSize()
gets the size of the input buffer.

getOutputBufferSize

public int getOutputBufferSize()
gets the size of the output buffer.
Returns:
int - the size of the output buffer.

setInputBufferSize

public void setInputBufferSize(int size)
                        throws UnsupportedCommOperationException
sets the size of the input buffer.
Parameters:
size - - the size of the input buffer.
Throws:
UnsupportedCommOperationException - - thrown if the buffer cannot be resized.

setOutputBufferSize

public void setOutputBufferSize(int size)
                         throws UnsupportedCommOperationException
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.

setBaudRate

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

sendBreak

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

available

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