eWON JTK

com.ewon.ewonitf
Class CommDriver

java.lang.Object
  extended by com.ewon.ewonitf.CommDriver

public class CommDriver
extends Object


Constructor Summary
CommDriver()
           
 
Method Summary
static int availableImpl(int hPort)
          return the number of bytes available for reading on the given serial port.
static void closeImpl(int hPort)
          Close a serial port.
static void configurePortImpl(int port, int baud, int flags)
          Configure a serial port optional parameters.
static void configuretimeoutsImpl(int port, int rxTimeout, int txTimeout)
          Configure the timeouts for the serial port blocking operations
static int getModemSignalImpl(int port, int signal)
          Get the postion of a port signal
static int getTxBufferUsedImpl(int hPort)
           
static int openByNameImpl(String name, int baud, int flags)
          Open a serial port by system dependent device name.
static int openByNumberImpl(int port, int baud, int flags)
          Open a serial port by logical number.
static int readBytesImpl(int hPort, byte[] b, int off, int len)
          Read from a serial port without blocking.
static void setBreakImpl(int hPort, boolean breakOn)
          Enable or disable break on the serial port output.
static void setModemSignalImpl(int port, int signal, boolean value)
          Set the postion of a port signal
static int writeBytesImpl(int hPort, byte[] b, int off, int len)
          Write to a serial port without blocking.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommDriver

public CommDriver()
Method Detail

configuretimeoutsImpl

public static void configuretimeoutsImpl(int port,
                                         int rxTimeout,
                                         int txTimeout)
                                  throws IOException
Configure the timeouts for the serial port blocking operations

Throws:
IOException

openByNumberImpl

public static int openByNumberImpl(int port,
                                   int baud,
                                   int flags)
                            throws IOException
Open a serial port by logical number.

Parameters:
port - logical number of the port 0 being the first
baud - baud rate to set the port at
flags - options for the serial port
Returns:
handle to a native serial port
Throws:
IOException - if an I/O error occurs.

openByNameImpl

public static int openByNameImpl(String name,
                                 int baud,
                                 int flags)
                          throws IOException
Open a serial port by system dependent device name.

Parameters:
name - device name of the port
baud - baud rate to set the port at
flags - options for the serial port
Returns:
handle to a native serial port
Throws:
IOException - if an I/O error occurs.

configurePortImpl

public static void configurePortImpl(int port,
                                     int baud,
                                     int flags)
                              throws IOException
Configure a serial port optional parameters.

Parameters:
port - device port returned from open
baud - baud rate to set the port at
flags - options for the serial port
Throws:
IOException - if an I/O error occurs

closeImpl

public static void closeImpl(int hPort)
                      throws IOException
Close a serial port.

Parameters:
hPort - handle to a native serial port
Throws:
IOException - if an I/O error occurs

availableImpl

public static int availableImpl(int hPort)
                         throws IOException
return the number of bytes available for reading on the given serial port.

Parameters:
hPort - handle to a native serial port
Returns:
number of bytes available for reading on the given serial port.
Throws:
IOException - if an I/O error occurs

getTxBufferUsedImpl

public static int getTxBufferUsedImpl(int hPort)
                               throws IOException
Throws:
IOException

setBreakImpl

public static void setBreakImpl(int hPort,
                                boolean breakOn)
                         throws IOException
Enable or disable break on the serial port output.

Throws:
IOException

setModemSignalImpl

public static void setModemSignalImpl(int port,
                                      int signal,
                                      boolean value)
                               throws IOException
Set the postion of a port signal

Throws:
IOException

getModemSignalImpl

public static int getModemSignalImpl(int port,
                                     int signal)
                              throws IOException
Get the postion of a port signal

Throws:
IOException

readBytesImpl

public static int readBytesImpl(int hPort,
                                byte[] b,
                                int off,
                                int len)
                         throws IOException
Read from a serial port without blocking.

Parameters:
hPort - handle to a native serial port
b - I/O buffer
off - starting offset for data
len - length of data
Returns:
number of bytes read
Throws:
IOException - if an I/O error occurs

writeBytesImpl

public static int writeBytesImpl(int hPort,
                                 byte[] b,
                                 int off,
                                 int len)
                          throws IOException
Write to a serial port without blocking.

Parameters:
hPort - handle to a native serial port
b - I/O buffer
off - starting offset for data
len - length of data
Returns:
number of bytes that were written
Throws:
IOException - if an I/O error occurs.

eWON JTK

www.eWON.biz: Your Eyes Watching Over Net