Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.dinopolis.gpstool.gpsinput
Class GPSGeneralDataProcessor  view GPSGeneralDataProcessor download GPSGeneralDataProcessor.java

java.lang.Object
  extended byorg.dinopolis.gpstool.gpsinput.GPSGeneralDataProcessor
All Implemented Interfaces:
GPSDataProcessor
Direct Known Subclasses:
GPSSimulationDataProcessor

public abstract class GPSGeneralDataProcessor
extends java.lang.Object
implements GPSDataProcessor

All classes extending this class are interpreting data from a GPSDevice (serial gps-receivier, file containing gps data, ...) and provide this information in a uniform way. So an NMEA-processor interprets NMEA sentences, while a Garmin-Processor understands the garmin protocol.

This abstract class adds some basic functionality all GSPDataProcessors might use.

Version:
$Revision: 1.5 $

Field Summary
protected  java.util.Map gps_data_
          the map the gps data is stored in
protected  java.lang.Object gps_data_lock_
          the lock object for the gps data
protected  GPSDevice gps_device_
          the GPSDevice
protected  java.util.Vector progress_listener_
          the progress listener
protected  java.beans.PropertyChangeSupport property_change_support_
          the gps data change listeners
protected  java.util.Vector raw_data_listener_
          the raw data listener
 
Fields inherited from interface org.dinopolis.gpstool.gpsinput.GPSDataProcessor
ALTITUDE, DEPTH, EPE, GETROUTES, GETSCREENSHOT, GETTRACKS, GETWAYPOINTS, HEADING, KM2NAUTIC, LOCATION, NUMBER_SATELLITES, SATELLITE_INFO, SETROUTES, SETTRACKS, SETWAYPOINTS, SPEED
 
Constructor Summary
GPSGeneralDataProcessor()
           
 
Method Summary
 void addGPSDataChangeListener(java.beans.PropertyChangeListener listener)
          Adds a listener for GPS data change events.
 void addGPSDataChangeListener(java.lang.String key, java.beans.PropertyChangeListener listener)
          Adds a listener for GPS data change events.
 void addGPSRawDataListener(GPSRawDataListener listener)
          Adds a listener for raw GPS data (for loggin purpose or similar).
 void addProgressListener(org.dinopolis.gpstool.util.ProgressListener listener)
          Adds a listener for transfer progress (for transfer or route/track/waypoint data).
protected  void changeGPSData(java.lang.String key, java.lang.Object value)
          Changes the gps data with given key.
abstract  void close()
          Stopps the data processing.
protected  void fireProgressActionEnd(java.lang.String action_id)
          Fire the ProgressListener actionEnd
protected  void fireProgressActionProgress(java.lang.String action_id, int current_value)
          Fire the progressListener actionStart
protected  void fireProgressActionStart(java.lang.String action_id, int min_value, int max_value)
          Fire the ProgressListener actionStart
protected  void fireRawDataReceived(char[] raw_data, int offset, int length)
          Fire the event for raw data that was received (for loggers etc.)
 java.util.Map getGPSData()
          Returns a map containing the last received data from the GPSDevice or null, if no data was retrieved until now.
 java.lang.Object getGPSData(java.lang.String key)
          Returns the last received data from the GPSDevice that is named by the key or null if no data with the given key was retrieved until now.
 GPSDevice getGPSDevice()
          Returns the GPSDevice where the data will be retrieved from.
abstract  GPSPosition getGPSPosition()
          Returns the last received position from the GPSDevice or null if no position was retrieved until now.
abstract  float getHeading()
          Returns the last received heading (direction) from the GPSDevice or -1.0 if no heading was retrieved until now.
 java.util.List getRoutes()
          Get a list of routes from the gps device.
 java.awt.image.BufferedImage getScreenShot()
          Get a screenshot of the gpsdevice.
 java.util.List getTracks()
          Get a list of tracks from the gps device.
 java.util.List getWaypoints()
          Get a list of waypoints from the gps device.
abstract  void open()
          Starts the data processing.
 void removeGPSDataChangeListener(java.beans.PropertyChangeListener listener)
          Removes a listener for GPS data change events.
 void removeGPSDataChangeListener(java.lang.String key, java.beans.PropertyChangeListener listener)
          Removes a listener for GPS data change events.
 void removeGPSRawDataListener(GPSRawDataListener listener)
          Removes a listener for faw GPS data.
 void removeProgressListener(org.dinopolis.gpstool.util.ProgressListener listener)
          Removes a listener for transfer progress (for transfer or route/track/waypoint data).
 void setGPSDevice(GPSDevice gps_device)
          Sets the GPSDevice where the data will be retrieved from.
 void setRoutes(java.util.List routes)
          Write the routes to the gps device.
 void setTracks(java.util.List tracks)
          Write the tracks to the gps device.
 void setWaypoints(java.util.List waypoints)
          Write the waypoints to the gps device.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.dinopolis.gpstool.gpsinput.GPSDataProcessor
getGPSInfo, startSendPositionPeriodically, stopSendPositionPeriodically
 

Field Detail

gps_device_

protected GPSDevice gps_device_
the GPSDevice


gps_data_

protected java.util.Map gps_data_
the map the gps data is stored in


gps_data_lock_

protected java.lang.Object gps_data_lock_
the lock object for the gps data


property_change_support_

protected java.beans.PropertyChangeSupport property_change_support_
the gps data change listeners


raw_data_listener_

protected java.util.Vector raw_data_listener_
the raw data listener


progress_listener_

protected java.util.Vector progress_listener_
the progress listener

Constructor Detail

GPSGeneralDataProcessor

public GPSGeneralDataProcessor()
Method Detail

open

public abstract void open()
                   throws GPSException
Starts the data processing. The Data Processor connects to the GPSDevice and starts retrieving information.

Specified by:
open in interface GPSDataProcessor

close

public abstract void close()
                    throws GPSException
Stopps the data processing. The Data Processor disconnects from the GPSDevice.

Specified by:
close in interface GPSDataProcessor

setGPSDevice

public void setGPSDevice(GPSDevice gps_device)
Sets the GPSDevice where the data will be retrieved from.

Specified by:
setGPSDevice in interface GPSDataProcessor

getGPSDevice

public GPSDevice getGPSDevice()
Returns the GPSDevice where the data will be retrieved from.

Specified by:
getGPSDevice in interface GPSDataProcessor

getGPSPosition

public abstract GPSPosition getGPSPosition()
Returns the last received position from the GPSDevice or null if no position was retrieved until now.

Specified by:
getGPSPosition in interface GPSDataProcessor

getHeading

public abstract float getHeading()
Returns the last received heading (direction) from the GPSDevice or -1.0 if no heading was retrieved until now.

Specified by:
getHeading in interface GPSDataProcessor

getGPSData

public java.lang.Object getGPSData(java.lang.String key)
                            throws java.lang.IllegalArgumentException
Returns the last received data from the GPSDevice that is named by the key or null if no data with the given key was retrieved until now. The naming scheme for the keys is taken from the NMEA standard (e.g. GLL for location, HDG for heading, ...)

Specified by:
getGPSData in interface GPSDataProcessor

getGPSData

public java.util.Map getGPSData()
Returns a map containing the last received data from the GPSDevice or null, if no data was retrieved until now. The naming scheme for the keys is taken from the NMEA standard (e.g. GLL for location, HDG for heading, ...)

Specified by:
getGPSData in interface GPSDataProcessor

getWaypoints

public java.util.List getWaypoints()
                            throws java.lang.UnsupportedOperationException,
                                   GPSException
Get a list of waypoints from the gps device.

Specified by:
getWaypoints in interface GPSDataProcessor

setWaypoints

public void setWaypoints(java.util.List waypoints)
                  throws java.lang.UnsupportedOperationException,
                         GPSException
Write the waypoints to the gps device.

Specified by:
setWaypoints in interface GPSDataProcessor

getRoutes

public java.util.List getRoutes()
                         throws java.lang.UnsupportedOperationException,
                                GPSException
Get a list of routes from the gps device.

Specified by:
getRoutes in interface GPSDataProcessor

setRoutes

public void setRoutes(java.util.List routes)
               throws java.lang.UnsupportedOperationException,
                      GPSException
Write the routes to the gps device.

Specified by:
setRoutes in interface GPSDataProcessor

getTracks

public java.util.List getTracks()
                         throws java.lang.UnsupportedOperationException,
                                GPSException
Get a list of tracks from the gps device.

Specified by:
getTracks in interface GPSDataProcessor

setTracks

public void setTracks(java.util.List tracks)
               throws java.lang.UnsupportedOperationException,
                      GPSException
Write the tracks to the gps device.

Specified by:
setTracks in interface GPSDataProcessor

getScreenShot

public java.awt.image.BufferedImage getScreenShot()
                                           throws java.lang.UnsupportedOperationException,
                                                  GPSException
Get a screenshot of the gpsdevice.

Specified by:
getScreenShot in interface GPSDataProcessor

addGPSDataChangeListener

public void addGPSDataChangeListener(java.lang.String key,
                                     java.beans.PropertyChangeListener listener)
                              throws java.lang.IllegalArgumentException
Adds a listener for GPS data change events.

Specified by:
addGPSDataChangeListener in interface GPSDataProcessor

addGPSDataChangeListener

public void addGPSDataChangeListener(java.beans.PropertyChangeListener listener)
                              throws java.lang.IllegalArgumentException
Adds a listener for GPS data change events.

Specified by:
addGPSDataChangeListener in interface GPSDataProcessor

removeGPSDataChangeListener

public void removeGPSDataChangeListener(java.lang.String key,
                                        java.beans.PropertyChangeListener listener)
                                 throws java.lang.IllegalArgumentException
Removes a listener for GPS data change events.

Specified by:
removeGPSDataChangeListener in interface GPSDataProcessor

removeGPSDataChangeListener

public void removeGPSDataChangeListener(java.beans.PropertyChangeListener listener)
                                 throws java.lang.IllegalArgumentException
Removes a listener for GPS data change events.

Specified by:
removeGPSDataChangeListener in interface GPSDataProcessor

changeGPSData

protected void changeGPSData(java.lang.String key,
                             java.lang.Object value)
                      throws java.lang.IllegalArgumentException
Changes the gps data with given key. If there exists a gps data with the given key, the new value replaces the old one. If the value is set to null the gps data is deleted. If there did not exist a gps data with the given key, it will be created.


fireRawDataReceived

protected void fireRawDataReceived(char[] raw_data,
                                   int offset,
                                   int length)
Fire the event for raw data that was received (for loggers etc.)


addGPSRawDataListener

public void addGPSRawDataListener(GPSRawDataListener listener)
                           throws java.lang.IllegalArgumentException
Adds a listener for raw GPS data (for loggin purpose or similar).

Specified by:
addGPSRawDataListener in interface GPSDataProcessor

removeGPSRawDataListener

public void removeGPSRawDataListener(GPSRawDataListener listener)
                              throws java.lang.IllegalArgumentException
Removes a listener for faw GPS data.

Specified by:
removeGPSRawDataListener in interface GPSDataProcessor

addProgressListener

public void addProgressListener(org.dinopolis.gpstool.util.ProgressListener listener)
                         throws java.lang.IllegalArgumentException
Adds a listener for transfer progress (for transfer or route/track/waypoint data).

Specified by:
addProgressListener in interface GPSDataProcessor

removeProgressListener

public void removeProgressListener(org.dinopolis.gpstool.util.ProgressListener listener)
                            throws java.lang.IllegalArgumentException
Removes a listener for transfer progress (for transfer or route/track/waypoint data).

Specified by:
removeProgressListener in interface GPSDataProcessor

fireProgressActionStart

protected void fireProgressActionStart(java.lang.String action_id,
                                       int min_value,
                                       int max_value)
Fire the ProgressListener actionStart


fireProgressActionProgress

protected void fireProgressActionProgress(java.lang.String action_id,
                                          int current_value)
Fire the progressListener actionStart


fireProgressActionEnd

protected void fireProgressActionEnd(java.lang.String action_id)
Fire the ProgressListener actionEnd