codeskin.serial
Interface ManagedSerialPort

All Known Implementing Classes:
SerialPortRxtx2_1, SocketPort

public interface ManagedSerialPort

Interface for managed serial port.


Method Summary
 void close()
          Closes port.
 boolean isOpen()
          Checks if port is open.
 void open(int b, int d, int s, int p, SerialPortClient client)
          Opens serial port (unless already open).
 boolean overflowOccured()
          Checks if buffer overflow occurred.
 void sendBreak(int duration)
          Sends break signal for certain duration.
 void setDTR(boolean set)
          Sets DTR (data terminal ready) line.
 void setRTS(boolean set)
          Sets RTS (ready to send) line.
 void write(byte[] b)
          Writes (sends) array of bytes to port.
 void write(int b)
          Writes (sends) 8-bit integer to port.
 

Method Detail

open

void open(int b,
          int d,
          int s,
          int p,
          SerialPortClient client)
          throws java.io.IOException
Opens serial port (unless already open).

Parameters:
b - baudrate
d - number of data bits
s - number of stop bits
p - parity
client -
Throws:
java.io.IOException - - if open fails

isOpen

boolean isOpen()
Checks if port is open.

Returns:
true if port is open

close

void close()
           throws java.io.IOException
Closes port.

Throws:
java.io.IOException - if unable to perform close

write

void write(int b)
           throws java.io.IOException
Writes (sends) 8-bit integer to port.

Parameters:
b - 8-bit integer
Throws:
java.io.IOException - if unable to write

write

void write(byte[] b)
           throws java.io.IOException
Writes (sends) array of bytes to port.

Parameters:
b - array of bytes
Throws:
java.io.IOException - if unable to write

overflowOccured

boolean overflowOccured()
Checks if buffer overflow occurred.

Returns:
true if overflow occurred

setDTR

void setDTR(boolean set)
            throws java.io.IOException
Sets DTR (data terminal ready) line.

Parameters:
set - true for asserting line
Throws:
java.io.IOException - if unable to control line

setRTS

void setRTS(boolean set)
            throws java.io.IOException
Sets RTS (ready to send) line.

Parameters:
set - true for asserting line
Throws:
java.io.IOException - if unable to control line

sendBreak

void sendBreak(int duration)
               throws java.io.IOException
Sends break signal for certain duration.

Parameters:
duration - time in ms
Throws:
java.io.IOException