es.uv.robotica.gvsig.mobile.gps
Class GPSManager

java.lang.Object
  extended byes.uv.robotica.gvsig.mobile.gps.GPSManager
All Implemented Interfaces:
java.util.EventListener, java.beans.PropertyChangeListener

public class GPSManager
extends java.lang.Object
implements java.beans.PropertyChangeListener

This class manages access to the GPS device and calls listeners related to GPS events

Author:
jgui
See Also:
GPSRelevantEventsListener, GPSProcessedEventsListener, GPSManagementEventsListener

Field Summary
static int FILE_DEVICE
          Constant identifying a GPS serial port device
 GPSFix lastGPSFix
          A structure containing all information concerning the last GPS fix
static int SERIAL_PORT_DEVICE
          Constant identifying a GPS serial port device
 
Constructor Summary
GPSManager()
          Constructor.
 
Method Summary
 void addGPSManagementEventsListener(GPSRelevantEventsListener listener)
          Adds a listener for GPS management events (connection, disconnection, etc.)
 void addGPSRawDataListener(GPSRawDataListener listener)
          Public method for adding Raw Data listeners, like a GPS debug console
 void addGPSRelevantEventsListener(GPSRelevantEventsListener listener)
          Adds a listener for GPS relevant events (position, time, date, etc.)
 void connectToGPS()
          Connects to the GPS device
 Waypoint createWaypoint()
          Creates a waypoint with the current values for lat, lon, ele and time The rest of attributes shall be completed manually
 void disconnectFromGPS()
          Disconnect from the GPS device
 int getBaudRate()
          Returns the selected baud rate to communicate with the GPS device via serial port
 int getDeviceType()
          Gets the GPS device type
static GPSManager getGPSManager()
          Returns the GPSManager, which is a singleton
 java.lang.String getPortName()
          Returns the port name of the GPS device, which can be a serial port name (i.e.
 java.lang.String getSimFileName()
           
 java.lang.String getSimFolderName()
           
 int getVSim()
          Devuelve la velocidad de simulacion actual
 boolean isConnected()
          Returns the state of the GPS device
 boolean isRecenter()
           
 boolean isShowIcon()
           
 void propertyChange(java.beans.PropertyChangeEvent event)
          Procesa los cambios de propiedades como posicion, tiempo, velocidad, etc Metodo de tipo callback perteneciente al interfaz PropertyChangeListener, invocado cada vez que cambia una propiedad del GPS
 void removeGPSManagementEventsListener(GPSRelevantEventsListener listener)
          Removes a listener for GPS management events
 void removeGPSRawDataListener(GPSRawDataListener listener)
          Public method for removing Raw Data listeners
 void removeGPSRelevantEventsListener(GPSRelevantEventsListener listener)
          Removes a listener for GPS relevant events
 void setBaudRate(int baudRate)
          Sets the baud rate to communicate with the GPS device via serial port
 void setDeviceType(int _deviceType)
          Sets the GPS device type
 void setPortName(java.lang.String portName)
          Sets the port name of the GPS device, which can be a serial port name (i.e.
 void setRecenter(boolean recenter)
           
 void setShowIcon(boolean showIcon)
           
 void setSimFileName(java.lang.String _simFileName)
           
 void setSimFolderName(java.lang.String _simFolderName)
           
 void setVSim(int VSim)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERIAL_PORT_DEVICE

public static final int SERIAL_PORT_DEVICE
Constant identifying a GPS serial port device

See Also:
Constant Field Values

FILE_DEVICE

public static final int FILE_DEVICE
Constant identifying a GPS serial port device

See Also:
Constant Field Values

lastGPSFix

public GPSFix lastGPSFix
A structure containing all information concerning the last GPS fix

Constructor Detail

GPSManager

public GPSManager()
Constructor. GPSManager is never instantiated, since it is a singleton

Method Detail

getGPSManager

public static GPSManager getGPSManager()
Returns the GPSManager, which is a singleton

Returns:

connectToGPS

public void connectToGPS()
                  throws GPSException
Connects to the GPS device

Throws:
GPSException

disconnectFromGPS

public void disconnectFromGPS()
Disconnect from the GPS device


isConnected

public boolean isConnected()
Returns the state of the GPS device

Returns:

setBaudRate

public void setBaudRate(int baudRate)
Sets the baud rate to communicate with the GPS device via serial port

Parameters:
baudRate -

getBaudRate

public int getBaudRate()
Returns the selected baud rate to communicate with the GPS device via serial port

Returns:

setPortName

public void setPortName(java.lang.String portName)
Sets the port name of the GPS device, which can be a serial port name (i.e. COM1) or a file name, in case of a simulated GPS device

Parameters:
portName -

getPortName

public java.lang.String getPortName()
Returns the port name of the GPS device, which can be a serial port name (i.e. COM1) or a file name, in case of a simulated GPS device

Returns:

setDeviceType

public void setDeviceType(int _deviceType)
Sets the GPS device type

Parameters:
_deviceType -

getDeviceType

public int getDeviceType()
Gets the GPS device type


getSimFolderName

public java.lang.String getSimFolderName()

setSimFolderName

public void setSimFolderName(java.lang.String _simFolderName)

getSimFileName

public java.lang.String getSimFileName()

setSimFileName

public void setSimFileName(java.lang.String _simFileName)

getVSim

public int getVSim()
Devuelve la velocidad de simulacion actual

Returns:
retardo en ms entre lecturas de sentencias NMEA del fichero log

setVSim

public void setVSim(int VSim)

addGPSRelevantEventsListener

public void addGPSRelevantEventsListener(GPSRelevantEventsListener listener)
                                  throws java.lang.IllegalArgumentException
Adds a listener for GPS relevant events (position, time, date, etc.)

Parameters:
listener - the listener to be added.
Throws:
java.lang.IllegalArgumentException - if listener is null.

removeGPSRelevantEventsListener

public void removeGPSRelevantEventsListener(GPSRelevantEventsListener listener)
                                     throws java.lang.IllegalArgumentException
Removes a listener for GPS relevant events

Parameters:
listener - the listener to be removed.
Throws:
java.lang.IllegalArgumentException - if listener is null.

addGPSManagementEventsListener

public void addGPSManagementEventsListener(GPSRelevantEventsListener listener)
                                    throws java.lang.IllegalArgumentException
Adds a listener for GPS management events (connection, disconnection, etc.)

Parameters:
listener - the listener to be added.
Throws:
java.lang.IllegalArgumentException - if listener is null.

removeGPSManagementEventsListener

public void removeGPSManagementEventsListener(GPSRelevantEventsListener listener)
                                       throws java.lang.IllegalArgumentException
Removes a listener for GPS management events

Parameters:
listener - the listener to be removed.
Throws:
java.lang.IllegalArgumentException - if listener is null.

addGPSRawDataListener

public void addGPSRawDataListener(GPSRawDataListener listener)
Public method for adding Raw Data listeners, like a GPS debug console

Parameters:
listener -

removeGPSRawDataListener

public void removeGPSRawDataListener(GPSRawDataListener listener)
Public method for removing Raw Data listeners

Parameters:
listener -

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
Procesa los cambios de propiedades como posicion, tiempo, velocidad, etc Metodo de tipo callback perteneciente al interfaz PropertyChangeListener, invocado cada vez que cambia una propiedad del GPS

Specified by:
propertyChange in interface java.beans.PropertyChangeListener

createWaypoint

public Waypoint createWaypoint()
Creates a waypoint with the current values for lat, lon, ele and time The rest of attributes shall be completed manually


isRecenter

public boolean isRecenter()

setRecenter

public void setRecenter(boolean recenter)

isShowIcon

public boolean isShowIcon()

setShowIcon

public void setShowIcon(boolean showIcon)