com.esri.core.gps
Class FileGPSWatcher

java.lang.Object
  extended by com.esri.core.internal.gps.GPSWatcher
      extended by com.esri.core.gps.FileGPSWatcher
All Implemented Interfaces:
IGPSWatcher

public final class FileGPSWatcher
extends com.esri.core.internal.gps.GPSWatcher

A IGPSWatcher with file source.

This class uses an ASCII text file of stored NMEA GPS sentences instead of the streaming GPS sentences from a GPS receiver through a serial port. The NMEA sentences are expected to be separated by new-line character. To receive GPS sentences from the component the user must provide the class with a valid text file containing positional information, which adheres to the universally accepted NMEA standards. Once a connection to this file is established, the positional information is accessible through GPSEventListener.

Note that the FileGPSWatcher will NOT automatically return back to the beginning of the text file after it reaches the last line of the text, unless the loopPlayback property is set to true.

See Also:
FileGPSWatcher(String, int, boolean), FileGPSWatcher(String, int, boolean, GPSEventListener), GPSWatcher.start(), GPSWatcher.stop(), IGPSWatcher

Field Summary
 
Fields inherited from class com.esri.core.internal.gps.GPSWatcher
gpsEventListeners
 
Constructor Summary
FileGPSWatcher(String filePath, int playbackRate, boolean loopPlayback)
          Creates a File-based GPS watcher.
FileGPSWatcher(String filePath, int playbackRate, boolean loopPlayback, GPSEventListener gpsEventListener)
          Creates a File-based GPS watcher.
 
Method Summary
protected  void connect()
          Creates an underlying driver to read from the file source.
 String getFilePath()
           
 int getPlaybackRate()
           
 boolean isLoopPlayback()
           
 
Methods inherited from class com.esri.core.internal.gps.GPSWatcher
addListener, createCOMGPSDriver, createCOMGPSDriver, createFileGPSDriver, getStatus, getTimeout, getTimeoutInterval, scanGpsPorts, setStatus, setTimeout, setTimeoutInterval, start, startGps, stop, stopGps, updateLocation, updateSentence, updateStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileGPSWatcher

public FileGPSWatcher(String filePath,
                      int playbackRate,
                      boolean loopPlayback)
Creates a File-based GPS watcher.

Parameters:
filePath - path to the file with GPS data.
playbackRate - value used to vary the timer for the reading a sentence from the GPS file.
loopPlayback - flag to indicate whether the watcher should cycle the data from the GPS file.
Throws:
GPSUncheckedException - if the file does not exists, or failure to create a connection to the file.
See Also:
FileGPSWatcher(String, int, boolean, GPSEventListener), GPSWatcher.addListener(GPSEventListener), GPSWatcher.start(), GPSWatcher.stop()

FileGPSWatcher

public FileGPSWatcher(String filePath,
                      int playbackRate,
                      boolean loopPlayback,
                      GPSEventListener gpsEventListener)
Creates a File-based GPS watcher.

Parameters:
filePath - path to the file with GPS data.
playbackRate - value used to vary the timer for the reading a sentence from the GPS file.
loopPlayback - indicates whether the watcher should cycle the data from the GPS file.
gpsEventListener - listener that will be invoked on GPS events.
Throws:
GPSUncheckedException - if the file does not exists, or failure to create a connection to the file.
See Also:
FileGPSWatcher(String, int, boolean), GPSWatcher.addListener(GPSEventListener), GPSWatcher.start(), GPSWatcher.stop()
Method Detail

getFilePath

public String getFilePath()
Returns:
the file-path used as source by this watcher.

getPlaybackRate

public int getPlaybackRate()
Returns:
the value used to vary the timer for the reading a NMEA sentence from the GPS file.

isLoopPlayback

public boolean isLoopPlayback()
Returns:
whether this watcher cycles the data in the GPS file.

connect

protected void connect()
Creates an underlying driver to read from the file source.

Specified by:
connect in class com.esri.core.internal.gps.GPSWatcher
Throws:
GPSUncheckedException - if the file does not exists, or failure to create the underlying driver.


Copyright © 2012. All Rights Reserved.