com.dalsemi.comm
Class NativeComm

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

public class NativeComm
extends java.lang.Object

Class declaration


Field Summary
static int PORT_LCD
          Field PORT_LCD
static int PORT_SERIAL0
          Field PORT_SERIAL0
static int PORT_SERIAL1
          Field PORT_SERIAL1
static int PORT_SERIAL2
          Field PORT_SERIAL2
static int PORT_SERIAL3
          Field PORT_SERIAL3
static int STREAM_STDERR
          Field STREAM_STDERR
static int STREAM_STDIN
          Field STREAM_STDIN
static int STREAM_STDOUT
          Field STREAM_STDOUT
 
Constructor Summary
NativeComm()
           
 
Method Summary
static int available(int handle)
          returns the number of bytes available in a driver.
static int close(int handle)
          Closes a previously opened port.
static int ioctl(int handle, byte[] arr, int offset, int length, int timeout)
          Performs a generic ioctl method.
static int open(int port, int stream)
          Opens a port for use.
static int read(int handle, byte[] arr, int timeout, boolean suspend)
          Calls the drivers read method.
static int read(int handle, byte[] arr, int offset, int length, int timeout, boolean suspend)
          Calls the drivers read method.
static void write(int handle, byte[] arr)
          Calls the drivers write method.
static void write(int handle, byte[] arr, int offset, int length)
          Calls the drivers write method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STREAM_STDIN

public static final int STREAM_STDIN
Field STREAM_STDIN

STREAM_STDOUT

public static final int STREAM_STDOUT
Field STREAM_STDOUT

STREAM_STDERR

public static final int STREAM_STDERR
Field STREAM_STDERR

PORT_SERIAL0

public static final int PORT_SERIAL0
Field PORT_SERIAL0

PORT_SERIAL1

public static final int PORT_SERIAL1
Field PORT_SERIAL1

PORT_LCD

public static final int PORT_LCD
Field PORT_LCD

PORT_SERIAL2

public static final int PORT_SERIAL2
Field PORT_SERIAL2

PORT_SERIAL3

public static final int PORT_SERIAL3
Field PORT_SERIAL3
Constructor Detail

NativeComm

public NativeComm()
Method Detail

open

public static int open(int port,
                       int stream)
Opens a port for use. This calls the driver open function.
Parameters:
port - - The port type to open.
stream - - The stream type to open.
Returns:
- handle to the opened port.
See Also:

close

public static int close(int handle)
Closes a previously opened port. This calls the driver close function.
Parameters:
handle - - handle of a previously opened port.
Returns:
- success/failure(0)
See Also:

write

public static void write(int handle,
                         byte[] arr)
Calls the drivers write method. Calling with a 0 byte array flushes the buffers of the IO driver.
Parameters:
handle - - handle returned by open
arr - - array of data to write
See Also:

write

public static void write(int handle,
                         byte[] arr,
                         int offset,
                         int length)
Calls the drivers write method. This calls the driver write function Calling with a 0 byte array flushes the buffers of the IO driver.
Parameters:
handle - - handle returned by open
arr - - array of data to write
offset - - offset into the array to write
length - - ammount of data to write
See Also:

read

public static int read(int handle,
                       byte[] arr,
                       int timeout,
                       boolean suspend)
Calls the drivers read method.
Parameters:
handle - - handle returned by open
arr - - array to read data into
timeout - - ammount of time to wait for a read.
suspend - - false if read call should block, true if timeout should be used.
Returns:
 
See Also:

read

public static int read(int handle,
                       byte[] arr,
                       int offset,
                       int length,
                       int timeout,
                       boolean suspend)
Calls the drivers read method.
Parameters:
handle - - handle returned by open
arr - - array of data to read into
length - - ammount of data to read
timeout - - ammount of time to wait for data in ms
suspend - - false - never times out.
Returns:
 
See Also:

ioctl

public static int ioctl(int handle,
                        byte[] arr,
                        int offset,
                        int length,
                        int timeout)
Performs a generic ioctl method. The driver is responsible for the format of the data passed to it.
Parameters:
handle -  
arr -  
length -  
timeout -  
Returns:
 
See Also:

available

public static int available(int handle)
returns the number of bytes available in a driver.
Parameters:
handle -  
Returns:
ammount of data that can be read
See Also:


Also see:
o
o TINI Home Page
o 1-Wire API

Last update Thu May 15 08:21:09 CDT 2003