org.jscience.devices.gps
Class GPS

java.lang.Object
  extended by org.jscience.devices.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.HashMap zListeners
          DOCUMENT ME!
 
Constructor Summary
protected GPS()
          Creates a new GPS object.
 
Method Summary
 void addGPSlistener(IGPSlistener l)
          Adds the specified IGPSlistener to receive data from the GPS.
 void addLapListener(ILapListener l)
          Adds l to the list of listeners interested in waypoint-data.
 void addTrackListener(ITrackpointListener l)
          Adds l to the list of listeners interested in waypoint-data.
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.
 void fireLapData(ILap lp)
          Goes through the list of Waypoint-listeners and distributes the waypoint wp.
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 fireTrackpointData(ITrackpoint tp)
          Goes through the list of Waypoint-listeners and distributes the waypoint wp.
 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.
 void removeLapListener(ILapListener l)
          Removes the the Waypoint-listener l from the list of Waypoint-listeners.
 void removeTrackListener(ITrackpointListener l)
          Removes the the Waypoint-listener l from the list of Waypoint-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 requestTracks()
          Asks the GPS to transmit all the waypoints in it's memory.
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

zListeners

protected java.util.HashMap zListeners
DOCUMENT ME!

Constructor Detail

GPS

protected GPS()
Creates a new GPS object.

Method Detail

addGPSlistener

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

Parameters:
l - DOCUMENT ME!

removeGPSListener

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

Parameters:
l - DOCUMENT ME!

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.

Parameters:
l - DOCUMENT ME!

removeTransferListener

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

Parameters:
l - DOCUMENT ME!

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.

Parameters:
l - DOCUMENT ME!

removeWaypointListener

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

Parameters:
l - DOCUMENT ME!

addTrackListener

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

Parameters:
l - DOCUMENT ME!

removeTrackListener

public void removeTrackListener(ITrackpointListener l)
Removes the the Waypoint-listener l from the list of Waypoint-listeners.

Parameters:
l - DOCUMENT ME!

addLapListener

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

Parameters:
l - DOCUMENT ME!

removeLapListener

public void removeLapListener(ILapListener l)
Removes the the Waypoint-listener l from the list of Waypoint-listeners.

Parameters:
l - DOCUMENT ME!

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.

Parameters:
number - DOCUMENT ME!

fireWaypointData

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

Parameters:
wp - DOCUMENT ME!

fireTrackpointData

public void fireTrackpointData(ITrackpoint tp)
Goes through the list of Waypoint-listeners and distributes the waypoint wp.

Parameters:
tp - DOCUMENT ME!

fireLapData

public void fireLapData(ILap lp)
Goes through the list of Waypoint-listeners and distributes the waypoint wp.

Parameters:
lp - DOCUMENT ME!

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.

Parameters:
pos - DOCUMENT ME!

fireDateData

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

Parameters:
dat - DOCUMENT ME!

fireTimeData

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

Parameters:
time - DOCUMENT ME!

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.

Returns:
DOCUMENT ME!

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.


requestTracks

public abstract void requestTracks()
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.

Parameters:
t - DOCUMENT ME!

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.

Parameters:
b - DOCUMENT ME!