|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.iu.gps.GPSDriver
This class realizes access to GPS devices over a serial line (NMEA0183 message format). GPSDriver has the following features: - auto-detection of the GPS device's serial line - logging of GPS information into a file - playback of previously logged GPS information (application transparent; application thinks data comes from GPS)
| Constructor Summary | |
GPSDriver()
Creates a close GPSDriver instance. |
|
GPSDriver(java.lang.String port,
int baudRate)
Creates a new GPSDriver instance, open and listening on the given serial port with the specified baudRate. |
|
| Method Summary | |
void |
addGPSListener(GPSListener gl)
Add new GPS listener. |
void |
close()
Close the GPS device. |
static org.iu.gps.GPSDriver.Configuration |
detect()
Tries to find the serial line + baudRate to which a GPS is connected to. |
void |
disableHardware()
Disables GPS hardware reporting. |
void |
disableLogging()
Disable logging. |
void |
disableRawLogging()
Stops logging process. |
void |
disableReplay()
Disables replay mode. |
void |
enableHardware()
Enables GPS hardware reporting. |
void |
enableLogging(java.io.OutputStream s)
Enables logging current GPS data into a stream. |
void |
enableRawLogging(java.io.OutputStream s)
Start logging GPS information into the given output stream (usually a FileOutputStream will be used). |
void |
enableReplay(java.io.InputStream logStream)
Enables replay from a previously logged stream. |
static int[] |
getBaudrateList()
Returns the list of all known baud rates. |
org.iu.gps.GPSDriver.Configuration |
getConfiguration()
Return the current GPS configuration. |
GPSInfo |
getGPSInfo()
Obtain the current GPS information. |
static java.lang.String[] |
getPortList()
Returns the list of all known serial ports. |
void |
gpsThread()
Method |
boolean |
isAlive()
Checks if the GPS is alive according to the following definition: There have been more than 5 valid NMEA messages on the current serial line. |
void |
logThread()
Method |
static void |
main(java.lang.String[] arg)
The main program for the GPSDriver class |
static void |
normGPSInfo(GPSInfo gi)
Normalize GPS Information: convert from degrees/minutes to degrees only representation, convert from the GPS ellipsoid, and fill in the GaussKrueger coordinates |
static double |
normLatLong(double c)
Method |
void |
open(org.iu.gps.GPSDriver.Configuration cfg)
Open the GPSDevice using the given configuration. |
void |
open(java.io.InputStream logStream)
Open GPSDevice using an input stream to replay logged GPS information. |
void |
removeGPSListener(GPSListener gl)
Remove GPS listener. |
void |
replayThread()
Method |
void |
run()
Main thread. |
void |
setSimulationInfo(GPSInfo gi)
Simulate a GPS device that returns the given GPSInfo. |
void |
setSimulationPosition(double lat,
double lon)
Sets the current GPSInfo to the given position. |
void |
setupGPS(java.lang.String port,
int baudRate)
Setup the GPS hardware. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public GPSDriver(java.lang.String port,
int baudRate)
throws java.lang.Exception
port - Symbolic name of serial port to listen on (/dev/ttySX
on UN*X, or COMx: on Win32)baudRate - Baudrate to use in communication with the GPS devicejava.lang.Exception - Exceptionjava.lang.Exception - Throws various exceptions if comm. cannot be
established, or if the port does not exist.public GPSDriver()
| Method Detail |
public static java.lang.String[] getPortList()
public static int[] getBaudrateList()
public static void main(java.lang.String[] arg)
throws java.lang.Exception
arg - The command line argumentsjava.lang.Exception - Exceptionpublic static org.iu.gps.GPSDriver.Configuration detect()
public static void normGPSInfo(GPSInfo gi)
gi - GPSInfo to normalize.public static double normLatLong(double c)
c - Parameterpublic void setSimulationInfo(GPSInfo gi)
gi - GPSInfo to use.
public void setSimulationPosition(double lat,
double lon)
lat - Latitude to use for simulation.lon - Longitude to use for simulation.
public void setupGPS(java.lang.String port,
int baudRate)
throws java.lang.Exception
port - Serial port.baudRate - Baud rate of GPS device.java.lang.Exception - public org.iu.gps.GPSDriver.Configuration getConfiguration()
public boolean isAlive()
public GPSInfo getGPSInfo()
public void open(org.iu.gps.GPSDriver.Configuration cfg)
throws java.lang.Exception
cfg - Configuration.java.lang.Exception - If comm. to GPS cannot be established.
public void open(java.io.InputStream logStream)
throws java.lang.Exception
logStream - Input stream with logged GPS information.java.lang.Exception - If the stream is in error.
public void enableReplay(java.io.InputStream logStream)
throws java.lang.Exception
logStream - Stream with logged information.java.lang.Exception - In case the stream cannnot be opened or the format cannot
be detected, an IllegalArgumentException is thrown.public void disableReplay()
public void enableHardware()
public void disableHardware()
public void enableRawLogging(java.io.OutputStream s)
s - Output stream to use for logging.public void disableRawLogging()
public void enableLogging(java.io.OutputStream s)
s - Stream to use for logging.public void disableLogging()
public void close()
throws java.io.IOException
java.io.IOException - public void replayThread()
public void logThread()
public void gpsThread()
public void run()
run in interface java.lang.Runnablepublic void addGPSListener(GPSListener gl)
gl - GPSListener to add.public void removeGPSListener(GPSListener gl)
gl - GPSListener to remove.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||