org.jscience.devices.gps.garmin
Class GarminGPS

java.lang.Object
  extended by org.jscience.devices.gps.GPS
      extended by org.jscience.devices.gps.garmin.GarminGPS
All Implemented Interfaces:
java.lang.Runnable

public class GarminGPS
extends GPS
implements java.lang.Runnable

DOCUMENT ME!


Field Summary
protected  boolean active
          The listening thread will be active as long as this variable remains true.
protected  java.lang.String description
          A human-readable description of the GPS-unit.
protected  java.util.Vector GarminListeners
          A vector containing references to all the GarminListeners.
 
Fields inherited from class org.jscience.devices.gps.GPS
zListeners
 
Constructor Summary
GarminGPS(java.io.BufferedInputStream i, java.io.BufferedOutputStream o)
           
 
Method Summary
 void addGarminListener(GarminListener l)
          Adds the specified GarminListener to receive all packets sent from the GPS.
protected  void Distribute(GarminPacket p)
          This method is used to identify the type of packet received, and distribute it to the correct listeners.
protected  void fireGarminPacket(GarminPacket p)
          Goes through the list of GarminListeners and transmits p to them.
 java.lang.String getDescription()
          Returns a string telling the brand of the Garmin-gps, software version and the protocols supported.
 void removeGarminListener(GarminListener l)
          Removes the specified GarminListener from the list of listeners.
 void requestDate()
          Makes a request for the specified data to the GPS.
 void requestLaps()
          Asks the GPS to transmit all the laps in it's memory.
 void requestPosition()
          Makes a request for the specified data to the GPS.
 void requestTime()
          Makes a request for the specified data to the GPS.
 void requestTracks()
          Asks the GPS to transmit all the tracks in it's memory.
 void requestWaypoints()
          Asks the GPS to transmit all the waypoints in it's memory.
 void run()
          This method is listening for input from the GPS.
 void setAutoTransmit(boolean t)
          Asks the GPS to either start or stop transmitting data periodically.
 void shutdown(boolean b)
          Stops communication with GPS.
 
Methods inherited from class org.jscience.devices.gps.GPS
addGPSlistener, addLapListener, addTrackListener, addTransferListener, addWaypointListener, fireDateData, fireLapData, firePositionData, fireTimeData, fireTrackpointData, fireTransferComplete, fireTransferStart, fireWaypointData, removeGPSListener, removeLapListener, removeTrackListener, removeTransferListener, removeWaypointListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

description

protected java.lang.String description
A human-readable description of the GPS-unit.


active

protected boolean active
The listening thread will be active as long as this variable remains true.


GarminListeners

protected java.util.Vector GarminListeners
A vector containing references to all the GarminListeners.

Constructor Detail

GarminGPS

public GarminGPS(java.io.BufferedInputStream i,
                 java.io.BufferedOutputStream o)
Method Detail

addGarminListener

public void addGarminListener(GarminListener l)
Adds the specified GarminListener to receive all packets sent from the GPS.

Parameters:
l - DOCUMENT ME!

removeGarminListener

public void removeGarminListener(GarminListener l)
Removes the specified GarminListener from the list of listeners.

Parameters:
l - DOCUMENT ME!

fireGarminPacket

protected void fireGarminPacket(GarminPacket p)
Goes through the list of GarminListeners and transmits p to them.

Parameters:
p - DOCUMENT ME!

run

public void run()
This method is listening for input from the GPS.

Specified by:
run in interface java.lang.Runnable

Distribute

protected void Distribute(GarminPacket p)
This method is used to identify the type of packet received, and distribute it to the correct listeners.

Parameters:
p - DOCUMENT ME!

requestPosition

public void requestPosition()
Makes a request for the specified data to the GPS. Data will be returned to all listeners through the IGPSlistener-interface.

Specified by:
requestPosition in class GPS

requestTime

public void requestTime()
Makes a request for the specified data to the GPS. Data will be returned to all listeners through the IGPSlistener-interface.

Specified by:
requestTime in class GPS

requestDate

public void requestDate()
Makes a request for the specified data to the GPS. Data will be returned to all listeners through the IGPSlistener-interface.

Specified by:
requestDate in class GPS

requestWaypoints

public void requestWaypoints()
Asks the GPS to transmit all the waypoints in it's memory. The result will be returned through the WaypointListener-interface.

Specified by:
requestWaypoints in class GPS

requestTracks

public void requestTracks()
Asks the GPS to transmit all the tracks in it's memory. The result will be returned through the TrackListener-interface.

Specified by:
requestTracks in class GPS

requestLaps

public void requestLaps()
Asks the GPS to transmit all the laps in it's memory. The result will be returned through the LapsListener-interface.


setAutoTransmit

public void setAutoTransmit(boolean t)
Asks the GPS to either start or stop transmitting data periodically.
The data will be that which is accessible through the IGPSlistener-interface. Throws a FeatureNotSupportException if it isn't possible to do this on the GPS.

Specified by:
setAutoTransmit in class GPS
Parameters:
t - DOCUMENT ME!

shutdown

public void shutdown(boolean b)
Stops communication with GPS.
Most likely, your program won't be able to shut down before you've called this method. If b is set to true, the GPS will be asked to turn off. If b is set to false, the GPS will remain turned on.

Specified by:
shutdown in class GPS
Parameters:
b - DOCUMENT ME!

getDescription

public java.lang.String getDescription()
Returns a string telling the brand of the Garmin-gps, software version and the protocols supported.

Specified by:
getDescription in class GPS
Returns:
DOCUMENT ME!