com.scottpreston.javarobot.chapter2
Class StandardSerialPort

java.lang.Object
  extended by com.scottpreston.javarobot.chapter2.StandardSerialPort
All Implemented Interfaces:
JSerialPort, java.util.EventListener, SerialPortEventListener

public class StandardSerialPort
extends java.lang.Object
implements SerialPortEventListener, JSerialPort


Field Summary
 
Fields inherited from interface com.scottpreston.javarobot.chapter2.JSerialPort
READ_COMMAND, WRITE_COMMAND, WRITE_READ_COMMAND
 
Constructor Summary
StandardSerialPort(int id)
           
StandardSerialPort(int id, int baud)
           
 
Method Summary
 void close()
           
 java.lang.String getName()
           
 byte[] read()
           
 byte[] read(byte[] b)
           
 java.lang.String readString()
           
 java.lang.String readString(byte[] b)
           
 void serialEvent(SerialPortEvent event)
          Notifies this listener of a serial port event.
 void setDTR(boolean dtr)
           
 void setTimeout(int timeout)
           
 void write(byte[] b)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardSerialPort

public StandardSerialPort(int id)
                   throws java.lang.Exception
Throws:
java.lang.Exception

StandardSerialPort

public StandardSerialPort(int id,
                          int baud)
                   throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

read

public byte[] read()
Specified by:
read in interface JSerialPort

readString

public java.lang.String readString()
Specified by:
readString in interface JSerialPort

write

public void write(byte[] b)
           throws java.lang.Exception
Specified by:
write in interface JSerialPort
Throws:
java.lang.Exception

close

public void close()
Specified by:
close in interface JSerialPort

read

public byte[] read(byte[] b)
            throws java.lang.Exception
Specified by:
read in interface JSerialPort
Throws:
java.lang.Exception

readString

public java.lang.String readString(byte[] b)
                            throws java.lang.Exception
Specified by:
readString in interface JSerialPort
Throws:
java.lang.Exception

serialEvent

public void serialEvent(SerialPortEvent event)
Description copied from interface: SerialPortEventListener
Notifies this listener of a serial port event.

Specified by:
serialEvent in interface SerialPortEventListener
Parameters:
event - the event

setTimeout

public void setTimeout(int timeout)
Specified by:
setTimeout in interface JSerialPort

setDTR

public void setDTR(boolean dtr)
Specified by:
setDTR in interface JSerialPort

getName

public java.lang.String getName()