dk.itu.haas.GPS
Class GPS

java.lang.Object
  |
  +--dk.itu.haas.GPS.GPS
Direct Known Subclasses:
GarminGPS

public abstract class GPS
extends java.lang.Object

This is the abstract base-class that encapsulates the functionality of a generic GPS-unit.


Field Summary
protected  java.util.Vector GPSlisteners
          A vector containing references to the objects registered as listeners on this GPS.
protected  java.util.Vector TransferListeners
          A vector containing references to the objects registered as listeners for transfers from the GPS.
protected  java.util.Vector WaypointListeners
          A vector containing references to the objects registered as listeners for waypoint-data from the GPS.
 
Constructor Summary
protected GPS()
           
 
Method Summary
 void addGPSlistener(IGPSlistener l)
          Adds the specified IGPSlistener to receive data from the GPS.
protected  void addTransferListener(ITransferListener l)
          Adds l to the list of listeners interested in transfer-events.
 void addWaypointListener(IWaypointListener l)
          Adds l to the list of listeners interested in waypoint-data.
protected  void fireDateData(IDate dat)
          Goes through the list of GPSlisteners and distributes the new date data.
protected  void firePositionData(IPosition pos)
          Goes through the list of GPSlisteners and distributes the new position data.
protected  void fireTimeData(ITime time)
          Goes through the list of GPSlisteners and distributes the new time data.
 void fireTransferComplete()
          Notifies listeners of the end of a stream of data.
 void fireTransferStart(int number)
          Notifies listeners of the beginning of a stream of data.
 void fireWaypointData(IWaypoint wp)
          Goes through the list of Waypoint-listeners and distributes the waypoint wp.
abstract  java.lang.String getDescription()
          Requests a descriptive string from the GPS.
 void removeGPSListener(IGPSlistener l)
          Removes the the GPS-listener l from the list of GPS-listeners.
protected  void removeTransferListener(ITransferListener l)
          Removes the the transfer-listener l from the list of transfer-listeners.
 void removeWaypointListener(IWaypointListener l)
          Removes the the Waypoint-listener l from the list of Waypoint-listeners.
abstract  void requestDate()
          Makes a request for the specified data to the GPS.
abstract  void requestPosition()
          Makes a request for the specified data to the GPS.
abstract  void requestTime()
          Makes a request for the specified data to the GPS.
abstract  void requestWaypoints()
          Asks the GPS to transmit all the waypoints in it's memory.
abstract  void setAutoTransmit(boolean t)
          Asks the GPS to either start or stop transmitting data periodically.
abstract  void shutdown(boolean b)
          Stops communication with GPS.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GPSlisteners

protected java.util.Vector GPSlisteners
A vector containing references to the objects registered as listeners on this GPS.


WaypointListeners

protected java.util.Vector WaypointListeners
A vector containing references to the objects registered as listeners for waypoint-data from the GPS.


TransferListeners

protected java.util.Vector TransferListeners
A vector containing references to the objects registered as listeners for transfers from the GPS. A listener can't be directly add to this group, but will instead be added when it registers for some other data that is being transmitted in transfer-groups.

Constructor Detail

GPS

protected GPS()
Method Detail

addGPSlistener

public void addGPSlistener(IGPSlistener l)
Adds the specified IGPSlistener to receive data from the GPS.


addTransferListener

protected void addTransferListener(ITransferListener l)
Adds l to the list of listeners interested in transfer-events. Members of this list can't be directly added, but have to be added through addition of other listeners.


addWaypointListener

public void addWaypointListener(IWaypointListener l)
Adds l to the list of listeners interested in waypoint-data. Also adds l to the list of transfer-listeners.


removeWaypointListener

public void removeWaypointListener(IWaypointListener l)
Removes the the Waypoint-listener l from the list of Waypoint-listeners.


removeGPSListener

public void removeGPSListener(IGPSlistener l)
Removes the the GPS-listener l from the list of GPS-listeners.


removeTransferListener

protected void removeTransferListener(ITransferListener l)
Removes the the transfer-listener l from the list of transfer-listeners.


fireTransferStart

public void fireTransferStart(int number)
Notifies listeners of the beginning of a stream of data. Tells listeners of the number of data-units in the transfer.


fireWaypointData

public void fireWaypointData(IWaypoint wp)
Goes through the list of Waypoint-listeners and distributes the waypoint wp.


fireTransferComplete

public void fireTransferComplete()
Notifies listeners of the end of a stream of data.


firePositionData

protected void firePositionData(IPosition pos)
Goes through the list of GPSlisteners and distributes the new position data.


fireDateData

protected void fireDateData(IDate dat)
Goes through the list of GPSlisteners and distributes the new date data.


fireTimeData

protected void fireTimeData(ITime time)
Goes through the list of GPSlisteners and distributes the new time data.


requestPosition

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


requestTime

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


requestDate

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


getDescription

public abstract java.lang.String getDescription()
Requests a descriptive string from the GPS. Should be formatted for human-reading. The string should be constructed by every GPS-implementation upon startup.


requestWaypoints

public abstract void requestWaypoints()
Asks the GPS to transmit all the waypoints in it's memory. The result will be returned through the WaypointListener-interface. Throws a FeatureNotSupportException if it isn't possible to do this on the GPS.


setAutoTransmit

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


shutdown

public abstract 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. Throws a FeatureNotSupportException if b is true, but the GPS-unit doesn't support that function.