|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectlocation.generators.RealGPSMonitor
This class monitors the GPS information provided by the Garmin GPS unit on the serial port. It uses the javax.comm package to connect to the serial port and read data from it.
| Field Summary | |
(package private) double |
altitude
|
(package private) double |
course
|
(package private) java.util.Date |
date
|
private boolean |
done
Should the GPS thread exit. |
private java.util.Vector |
gps_listeners
The GPSListeners that are waiting for GPSInfoEvents. |
private java.io.InputStreamReader |
inputSR
The reader to convert the input stream to a reader |
private java.io.InputStream |
inputStream
The input stream to the serial port |
(package private) boolean |
isValid
|
(package private) Latitude |
latitude
|
private java.util.Vector |
listeners
The GPSListeners that are waiting for GPSEvents. |
(package private) Longitude |
longitude
|
(package private) java.lang.String |
mode
|
(package private) double |
mps
|
(package private) LocationEvent |
prevLE
The previous LocationEvent that was broadcasted |
private int |
safe
|
(package private) java.util.Vector |
Sat
|
private javax.comm.SerialPort |
serialPort
The serial port to read from |
private boolean |
start
|
(package private) java.lang.String |
time
|
(package private) java.lang.String |
usedSat
|
(package private) java.lang.String |
validity
|
(package private) java.lang.String |
viewedSat
|
| Constructor Summary | |
RealGPSMonitor(java.lang.String commName,
int baud)
The constructor sets the instance variables and sets up the serial port to be read from. |
|
| Method Summary | |
void |
addGpsInfoListener(GpsInfoListener gps)
Add a GpsInfo listener. |
void |
addLocationListener(LocationListener ll)
Add a Location listener. |
(package private) void |
broadcastInformation()
Send a new location information to the registered listeners. |
LocationEvent |
getLocation()
Returns the current location reading of the GPS receiver or null of the no reading has been received yet. |
void |
kill()
Stops this RealGPSMonitor. |
private void |
parseString(java.lang.String readSentence)
Parses the string of characters recieved from the GPS unit to get the new GPS location and other useful info |
void |
removeGpsInfoListener(GpsInfoListener gps)
Remove a GpsInfo listener. |
void |
removeLocationListener(LocationListener ll)
Remove a location listener. |
void |
serialEvent(javax.comm.SerialPortEvent event)
This method implements the serialEvent(....) method required by SerialPortEventListener. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private java.io.InputStream inputStream
private java.io.InputStreamReader inputSR
private javax.comm.SerialPort serialPort
private java.util.Vector listeners
private java.util.Vector gps_listeners
private boolean done
LocationEvent prevLE
java.util.Vector Sat
java.lang.String viewedSat
java.lang.String validity
java.lang.String usedSat
double altitude
java.lang.String mode
java.lang.String time
boolean isValid
Latitude latitude
Longitude longitude
double mps
double course
java.util.Date date
private boolean start
private int safe
| Constructor Detail |
public RealGPSMonitor(java.lang.String commName,
int baud)
commName - the String name of the serial port to connect to. For
example, to connect to COM port 1, specify "COM1".baud - the baud rate of the GPS unit's communication| Method Detail |
public void addLocationListener(LocationListener ll)
addLocationListener in interface LocationGeneratorll - the new location listener.
public void removeLocationListener(LocationListener ll)
removeLocationListener in interface LocationGeneratorll - the location listener to remove.
public void addGpsInfoListener(GpsInfoListener gps)
addGpsInfoListener in interface LocationGeneratorgps - the new GpsInfo listener.
public void removeGpsInfoListener(GpsInfoListener gps)
removeGpsInfoListener in interface LocationGeneratorgps - the GpsInfo listener to remove.
public void kill()
kill in interface LocationGeneratorpublic LocationEvent getLocation()
getLocation in interface LocationGeneratorvoid broadcastInformation()
private void parseString(java.lang.String readSentence)
public void serialEvent(javax.comm.SerialPortEvent event)
serialEvent in interface javax.comm.SerialPortEventListenerevent - the event generated by the serial portSerialPortEventListener
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||