gnu.io
Class Raw

java.lang.Object
  extended bygnu.io.CommPort
      extended bygnu.io.RawPort
          extended bygnu.io.Raw

final class Raw
extends RawPort

Since:
JDK1.0

Nested Class Summary
(package private)  class Raw.MonitorThread
           
(package private)  class Raw.RawInputStream
          Inner class for RawInputStream
(package private)  class Raw.RawOutputStream
          Inner class for RawOutputStream
 
Field Summary
private  int ciAddress
          File descriptor
private  int dataAvailable
           
private  int dataBits
          Data bits port parameter
static int DATABITS_5
           
static int DATABITS_6
           
static int DATABITS_7
           
static int DATABITS_8
           
(package private) static boolean dsrFlag
          DSR flag
static int FLOWCONTROL_NONE
           
static int FLOWCONTROL_RTSCTS_IN
           
static int FLOWCONTROL_RTSCTS_OUT
           
static int FLOWCONTROL_XONXOFF_IN
           
static int FLOWCONTROL_XONXOFF_OUT
           
private  int flowmode
          Flow control
private  Raw.RawInputStream in
          Input stream
private  int InputBuffer
          FIXME I think this refers to FOPEN(3)/SETBUF(3)/FREAD(3)/FCLOSE(3) taj@www.linux.org.uk These are native stubs...
static int IO_PORT
           
private  Raw.MonitorThread monThread
          Thread to monitor data
private  Raw.RawOutputStream out
          Output stream
private  int OutputBuffer
           
private  int parity
          Parity port parameter
static int PARITY_EVEN
           
static int PARITY_MARK
           
static int PARITY_NONE
           
static int PARITY_ODD
           
static int PARITY_SPACE
           
private  int speed
          Line speed in bits-per-second
private  RawPortEventListener SPEventListener
          Raw Port Event listener
private  int stopBits
          Stop bits port parameter
static int STOPBITS_1
           
static int STOPBITS_1_5
           
static int STOPBITS_2
           
private  int threshold
          Receive threshold control
private  int timeout
          Receive timeout control
static int WRITE_SIZE
           
 
Fields inherited from class gnu.io.CommPort
name
 
Constructor Summary
Raw(java.lang.String name)
          Open the named port
 
Method Summary
 void addEventListener(RawPortEventListener lsnr)
          Add an event listener
 void close()
           
 void disableReceiveFraming()
           
 void disableReceiveThreshold()
           
 void disableReceiveTimeout()
           
private  void drain()
           
 void enableReceiveFraming(int f)
          Receive framing control
 void enableReceiveThreshold(int thresh)
           
 void enableReceiveTimeout(int time)
           
(package private)  void eventLoop()
          Process RawPortEvents
protected  void finalize()
          Finalize the port
 int getBaudRate()
           
 int getDataBits()
           
 int getFlowControlMode()
           
 int getInputBufferSize()
           
 java.io.InputStream getInputStream()
           
 int getOutputBufferSize()
           
 java.io.OutputStream getOutputStream()
           
 int getParity()
           
 int getReceiveFramingByte()
           
 int getReceiveThreshold()
           
 int getReceiveTimeout()
           
 int getStopBits()
           
 java.lang.String getVersion()
           
private static void Initialize()
          Initialize the native library
 boolean isCD()
           
 boolean isCTS()
           
 boolean isDSR()
           
 boolean isDTR()
          Line status methods
 boolean isReceiveFramingEnabled()
           
 boolean isReceiveThresholdEnabled()
           
 boolean isReceiveTimeoutEnabled()
           
 boolean isRI()
           
 boolean isRTS()
           
private  int nativeavailable()
          Raw read methods
private  int nativeClose()
          Close the port
 void NativeEnableReceiveTimeoutThreshold(int time, int threshold, int InputBuffer)
           
 int NativegetReceiveTimeout()
           
 boolean NativeisReceiveTimeoutEnabled()
           
private  void nativeSetRawPortParams(int speed, int dataBits, int stopBits, int parity)
          Set the native Raw port parameters
 void notifyOnBreakInterrupt(boolean enable)
           
 void notifyOnCarrierDetect(boolean enable)
           
 void notifyOnCTS(boolean enable)
           
 void notifyOnDataAvailable(boolean enable)
           
 void notifyOnDSR(boolean enable)
           
 void notifyOnFramingError(boolean enable)
           
 void notifyOnOutputEmpty(boolean enable)
           
 void notifyOnOverrunError(boolean enable)
           
 void notifyOnParityError(boolean enable)
           
 void notifyOnRingIndicator(boolean enable)
           
private  int open(int ciAddress)
           
private  int readArray(byte[] b, int off, int len)
           
private  int readByte()
           
 void removeEventListener()
          Remove the Raw port event listener
 void sendBreak(int duration)
          Write to the port
 void sendEvent(int event, boolean state)
           
private  void setDSR(boolean state)
           
 void setDTR(boolean state)
           
(package private)  void setflowcontrol(int flowcontrol)
           
 void setFlowControlMode(int flowcontrol)
           
 void setInputBufferSize(int size)
           
 void setOutputBufferSize(int size)
           
 void setRawPortParams(int b, int d, int s, int p)
          Set the RawPort parameters
 void setRTS(boolean state)
           
private  void writeArray(byte[] b, int off, int len)
           
private  void writeByte(int b)
           
 
Methods inherited from class gnu.io.CommPort
getName, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ciAddress

private int ciAddress
File descriptor


dsrFlag

static boolean dsrFlag
DSR flag


out

private final Raw.RawOutputStream out
Output stream


in

private final Raw.RawInputStream in
Input stream


speed

private int speed
Line speed in bits-per-second


dataBits

private int dataBits
Data bits port parameter


stopBits

private int stopBits
Stop bits port parameter


parity

private int parity
Parity port parameter


flowmode

private int flowmode
Flow control


timeout

private int timeout
Receive timeout control


threshold

private int threshold
Receive threshold control


InputBuffer

private int InputBuffer
FIXME I think this refers to FOPEN(3)/SETBUF(3)/FREAD(3)/FCLOSE(3) taj@www.linux.org.uk These are native stubs...


OutputBuffer

private int OutputBuffer

SPEventListener

private RawPortEventListener SPEventListener
Raw Port Event listener


monThread

private Raw.MonitorThread monThread
Thread to monitor data


dataAvailable

private int dataAvailable

DATABITS_5

public static final int DATABITS_5
See Also:
Constant Field Values

DATABITS_6

public static final int DATABITS_6
See Also:
Constant Field Values

DATABITS_7

public static final int DATABITS_7
See Also:
Constant Field Values

DATABITS_8

public static final int DATABITS_8
See Also:
Constant Field Values

PARITY_NONE

public static final int PARITY_NONE
See Also:
Constant Field Values

PARITY_ODD

public static final int PARITY_ODD
See Also:
Constant Field Values

PARITY_EVEN

public static final int PARITY_EVEN
See Also:
Constant Field Values

PARITY_MARK

public static final int PARITY_MARK
See Also:
Constant Field Values

PARITY_SPACE

public static final int PARITY_SPACE
See Also:
Constant Field Values

STOPBITS_1

public static final int STOPBITS_1
See Also:
Constant Field Values

STOPBITS_1_5

public static final int STOPBITS_1_5
See Also:
Constant Field Values

STOPBITS_2

public static final int STOPBITS_2
See Also:
Constant Field Values

FLOWCONTROL_NONE

public static final int FLOWCONTROL_NONE
See Also:
Constant Field Values

FLOWCONTROL_RTSCTS_IN

public static final int FLOWCONTROL_RTSCTS_IN
See Also:
Constant Field Values

FLOWCONTROL_RTSCTS_OUT

public static final int FLOWCONTROL_RTSCTS_OUT
See Also:
Constant Field Values

FLOWCONTROL_XONXOFF_IN

public static final int FLOWCONTROL_XONXOFF_IN
See Also:
Constant Field Values

FLOWCONTROL_XONXOFF_OUT

public static final int FLOWCONTROL_XONXOFF_OUT
See Also:
Constant Field Values

WRITE_SIZE

public static final int WRITE_SIZE
See Also:
Constant Field Values

IO_PORT

public static final int IO_PORT
See Also:
Constant Field Values
Constructor Detail

Raw

public Raw(java.lang.String name)
    throws PortInUseException
Open the named port

Method Detail

Initialize

private static void Initialize()
Initialize the native library


open

private int open(int ciAddress)
          throws PortInUseException
Throws:
PortInUseException

getOutputStream

public java.io.OutputStream getOutputStream()
Specified by:
getOutputStream in class CommPort

getInputStream

public java.io.InputStream getInputStream()
Specified by:
getInputStream in class CommPort

setRawPortParams

public void setRawPortParams(int b,
                             int d,
                             int s,
                             int p)
                      throws UnsupportedCommOperationException
Set the RawPort parameters

Specified by:
setRawPortParams in class RawPort
Throws:
UnsupportedCommOperationException

nativeSetRawPortParams

private void nativeSetRawPortParams(int speed,
                                    int dataBits,
                                    int stopBits,
                                    int parity)
                             throws UnsupportedCommOperationException
Set the native Raw port parameters

Throws:
UnsupportedCommOperationException

getBaudRate

public int getBaudRate()

getDataBits

public int getDataBits()

getStopBits

public int getStopBits()

getParity

public int getParity()

setFlowControlMode

public void setFlowControlMode(int flowcontrol)

getFlowControlMode

public int getFlowControlMode()

setflowcontrol

void setflowcontrol(int flowcontrol)
              throws java.io.IOException
Throws:
java.io.IOException

enableReceiveFraming

public void enableReceiveFraming(int f)
                          throws UnsupportedCommOperationException
Receive framing control

Specified by:
enableReceiveFraming in class CommPort
Throws:
UnsupportedCommOperationException

disableReceiveFraming

public void disableReceiveFraming()
Specified by:
disableReceiveFraming in class CommPort

isReceiveFramingEnabled

public boolean isReceiveFramingEnabled()
Specified by:
isReceiveFramingEnabled in class CommPort

getReceiveFramingByte

public int getReceiveFramingByte()
Specified by:
getReceiveFramingByte in class CommPort

NativegetReceiveTimeout

public int NativegetReceiveTimeout()

NativeisReceiveTimeoutEnabled

public boolean NativeisReceiveTimeoutEnabled()

NativeEnableReceiveTimeoutThreshold

public void NativeEnableReceiveTimeoutThreshold(int time,
                                                int threshold,
                                                int InputBuffer)

disableReceiveTimeout

public void disableReceiveTimeout()
Specified by:
disableReceiveTimeout in class CommPort

enableReceiveTimeout

public void enableReceiveTimeout(int time)
Specified by:
enableReceiveTimeout in class CommPort

isReceiveTimeoutEnabled

public boolean isReceiveTimeoutEnabled()
Specified by:
isReceiveTimeoutEnabled in class CommPort

getReceiveTimeout

public int getReceiveTimeout()
Specified by:
getReceiveTimeout in class CommPort

enableReceiveThreshold

public void enableReceiveThreshold(int thresh)
Specified by:
enableReceiveThreshold in class CommPort

disableReceiveThreshold

public void disableReceiveThreshold()
Specified by:
disableReceiveThreshold in class CommPort

getReceiveThreshold

public int getReceiveThreshold()
Specified by:
getReceiveThreshold in class CommPort

isReceiveThresholdEnabled

public boolean isReceiveThresholdEnabled()
Specified by:
isReceiveThresholdEnabled in class CommPort

setInputBufferSize

public void setInputBufferSize(int size)
Specified by:
setInputBufferSize in class CommPort

getInputBufferSize

public int getInputBufferSize()
Specified by:
getInputBufferSize in class CommPort

setOutputBufferSize

public void setOutputBufferSize(int size)
Specified by:
setOutputBufferSize in class CommPort

getOutputBufferSize

public int getOutputBufferSize()
Specified by:
getOutputBufferSize in class CommPort

isDTR

public boolean isDTR()
Line status methods


setDTR

public void setDTR(boolean state)

setRTS

public void setRTS(boolean state)

setDSR

private void setDSR(boolean state)

isCTS

public boolean isCTS()

isDSR

public boolean isDSR()

isCD

public boolean isCD()

isRI

public boolean isRI()

isRTS

public boolean isRTS()

sendBreak

public void sendBreak(int duration)
Write to the port


writeByte

private void writeByte(int b)
                throws java.io.IOException
Throws:
java.io.IOException

writeArray

private void writeArray(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
Throws:
java.io.IOException

drain

private void drain()
            throws java.io.IOException
Throws:
java.io.IOException

nativeavailable

private int nativeavailable()
                     throws java.io.IOException
Raw read methods

Throws:
java.io.IOException

readByte

private int readByte()
              throws java.io.IOException
Throws:
java.io.IOException

readArray

private int readArray(byte[] b,
                      int off,
                      int len)
               throws java.io.IOException
Throws:
java.io.IOException

eventLoop

void eventLoop()
Process RawPortEvents


sendEvent

public void sendEvent(int event,
                      boolean state)

addEventListener

public void addEventListener(RawPortEventListener lsnr)
                      throws java.util.TooManyListenersException
Add an event listener

Specified by:
addEventListener in class RawPort
Throws:
java.util.TooManyListenersException

removeEventListener

public void removeEventListener()
Remove the Raw port event listener

Specified by:
removeEventListener in class RawPort

notifyOnDataAvailable

public void notifyOnDataAvailable(boolean enable)

notifyOnOutputEmpty

public void notifyOnOutputEmpty(boolean enable)

notifyOnCTS

public void notifyOnCTS(boolean enable)

notifyOnDSR

public void notifyOnDSR(boolean enable)

notifyOnRingIndicator

public void notifyOnRingIndicator(boolean enable)

notifyOnCarrierDetect

public void notifyOnCarrierDetect(boolean enable)

notifyOnOverrunError

public void notifyOnOverrunError(boolean enable)

notifyOnParityError

public void notifyOnParityError(boolean enable)

notifyOnFramingError

public void notifyOnFramingError(boolean enable)

notifyOnBreakInterrupt

public void notifyOnBreakInterrupt(boolean enable)

nativeClose

private int nativeClose()
Close the port


close

public void close()
Overrides:
close in class CommPort

finalize

protected void finalize()
Finalize the port


getVersion

public java.lang.String getVersion()