gps.connection
Class GPSrxtx

java.lang.Object
  extended by gps.connection.GPSrxtx

public final class GPSrxtx
extends java.lang.Object

This class implements the low level driver of the GPS device.
The serial link reader is defined as a State. The State defines the protocol.
The getResponse() function should be called regularly to retrieve and interpret the GPS device's response.

Author:
Mario De Weerd

Field Summary
static int ERR_CHECKSUM
           
static int ERR_INCOMPLETE
           
static int ERR_NOERROR
           
static int ERR_TOO_LONG
           
 
Constructor Summary
GPSrxtx()
           
GPSrxtx(GPSPort port)
           
 
Method Summary
 void closePort()
           
 java.lang.String getFreeTextPort()
           
 GPSPort getGpsPort()
           
 int getPort()
           
 byte getReadBufferByte()
           
 char getReadBufferChar()
           
 java.lang.Object getResponse()
           
 int getSpeed()
           
 java.lang.Object getState()
          Returns the current state which is part of the context.
static boolean hasDefaultPortInstance()
           
 boolean isConnected()
           
 boolean isDebugConn()
           
 boolean isReadBufferEmpty()
           
 void newState(DecoderStateInterface newState)
          Enters a state that can be provided for externally.
 void newState(int newState)
          Called by state or other means to change state.
 void openPort()
           
 void setBaudRate(int speed)
           
 void setBluetoothAndOpen()
           
 void setDebugConn(boolean gps_debug, java.lang.String s)
           
static void setDefaultGpsPortInstance(GPSPort portInstance)
           
 void setDefaults(int port, int speed)
          Set the defaults for the device according to the given parameters.
 int setFreeTextPortAndOpen(java.lang.String s)
           
 int setPortAndOpen(int port)
          Set and open a normal port (giving the port number)
 void setUSBAndOpen()
           
 void virtualReceive(java.lang.String rvd)
           
 void write(byte[] bytes)
           
 void write(java.lang.String text)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERR_NOERROR

public static final int ERR_NOERROR
See Also:
Constant Field Values

ERR_CHECKSUM

public static final int ERR_CHECKSUM
See Also:
Constant Field Values

ERR_INCOMPLETE

public static final int ERR_INCOMPLETE
See Also:
Constant Field Values

ERR_TOO_LONG

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

GPSrxtx

public GPSrxtx()

GPSrxtx

public GPSrxtx(GPSPort port)
Method Detail

newState

public final void newState(int newState)
Called by state or other means to change state.


newState

public final void newState(DecoderStateInterface newState)
Enters a state that can be provided for externally.

Parameters:
newState -

getState

public final java.lang.Object getState()
Returns the current state which is part of the context.


setDefaultGpsPortInstance

public static final void setDefaultGpsPortInstance(GPSPort portInstance)

hasDefaultPortInstance

public static final boolean hasDefaultPortInstance()

getGpsPort

public final GPSPort getGpsPort()

setDefaults

public final void setDefaults(int port,
                              int speed)
Set the defaults for the device according to the given parameters.

Parameters:
port -
speed -

setBluetoothAndOpen

public final void setBluetoothAndOpen()

setUSBAndOpen

public final void setUSBAndOpen()

closePort

public final void closePort()

openPort

public final void openPort()

setPortAndOpen

public final int setPortAndOpen(int port)
Set and open a normal port (giving the port number)

Parameters:
port - Port number of the port to open
Returns:
result of opening the port, 0 if success.

setFreeTextPortAndOpen

public final int setFreeTextPortAndOpen(java.lang.String s)

getFreeTextPort

public final java.lang.String getFreeTextPort()

getPort

public final int getPort()

getSpeed

public final int getSpeed()

setBaudRate

public final void setBaudRate(int speed)

isConnected

public final boolean isConnected()

write

public final void write(java.lang.String text)

write

public final void write(byte[] bytes)

virtualReceive

public final void virtualReceive(java.lang.String rvd)

getResponse

public final java.lang.Object getResponse()

setDebugConn

public final void setDebugConn(boolean gps_debug,
                               java.lang.String s)

isDebugConn

public final boolean isDebugConn()

isReadBufferEmpty

public final boolean isReadBufferEmpty()

getReadBufferChar

public final char getReadBufferChar()

getReadBufferByte

public final byte getReadBufferByte()