com.buglabs.bug.module.gps
Class NMEASentenceProvider

java.lang.Object
  extended by java.lang.Thread
      extended by com.buglabs.bug.module.gps.NMEASentenceProvider
All Implemented Interfaces:
INMEASentenceProvider, java.lang.Runnable

public class NMEASentenceProvider
extends java.lang.Thread
implements INMEASentenceProvider

This class is a thread that listens for NMEA sentences on the InputStream passed in the constructor, and will present the last parsed sentence to clients.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static java.lang.String SLEEP_INTERVAL_PROPERTY_KEY
          System property to define sleep between GPS reads.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
NMEASentenceProvider(java.io.InputStream nmeaStream, BundleContext context)
           
 
Method Summary
 int getIndex()
           
 RMC getLastRMC()
           
 RMC getRMC()
          Provides the latest RMC sentence read from the GPS Device, or null if no information is available.
 void run()
           
 void serviceChanged(ServiceEvent event)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SLEEP_INTERVAL_PROPERTY_KEY

public static final java.lang.String SLEEP_INTERVAL_PROPERTY_KEY
System property to define sleep between GPS reads.

See Also:
Constant Field Values
Constructor Detail

NMEASentenceProvider

public NMEASentenceProvider(java.io.InputStream nmeaStream,
                            BundleContext context)
Method Detail

getRMC

public RMC getRMC()
Description copied from interface: INMEASentenceProvider
Provides the latest RMC sentence read from the GPS Device, or null if no information is available.

Specified by:
getRMC in interface INMEASentenceProvider
Returns:
RMC sentence object

getLastRMC

public RMC getLastRMC()
Specified by:
getLastRMC in interface INMEASentenceProvider
Returns:
Last parsed RMC NMEA sentence, or null if no sentence with location information has been received.

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

getIndex

public int getIndex()
Specified by:
getIndex in interface INMEASentenceProvider
Returns:
the index of the RMC value currently available. Useful for determining if new RMC is available.

serviceChanged

public void serviceChanged(ServiceEvent event)