dk.itu.haas.GPS.Garmin
Class GarminGPS

java.lang.Object
  |
  +--dk.itu.haas.GPS.GPS
        |
        +--dk.itu.haas.GPS.Garmin.GarminGPS
All Implemented Interfaces:
java.lang.Runnable

public class GarminGPS
extends GPS
implements java.lang.Runnable


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 dk.itu.haas.GPS.GPS
GPSlisteners, TransferListeners, WaypointListeners
 
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 requestPosition()
          Makes a request for the specified data to the GPS.
 void requestTime()
          Makes a request for the specified data to the GPS.
 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 dk.itu.haas.GPS.GPS
addGPSlistener, addTransferListener, addWaypointListener, fireDateData, firePositionData, fireTimeData, fireTransferComplete, fireTransferStart, fireWaypointData, removeGPSListener, 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.


removeGarminListener

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


fireGarminPacket

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


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.


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

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

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

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