org.placelab.spotter
Class BluetoothGPSSpotter

java.lang.Object
  extended byorg.placelab.spotter.AbstractSpotter
      extended byorg.placelab.spotter.NMEAGPSSpotter
          extended byorg.placelab.spotter.BluetoothGPSSpotter
All Implemented Interfaces:
Spotter
Direct Known Subclasses:
HardcodedBluetoothGPSSpotter, InquiryBluetoothGPSSpotter, ListenerBluetoothGPSSpotter

public abstract class BluetoothGPSSpotter
extends NMEAGPSSpotter


Nested Class Summary
protected  class BluetoothGPSSpotter.ScanThread
           
 
Field Summary
protected  javax.microedition.io.StreamConnection conn
           
protected  java.lang.String connectedDeviceName
           
protected  java.io.DataInputStream is
           
protected  java.lang.String lingeringData
           
protected  BluetoothGPSSpotter.ScanThread scanThread
           
protected  java.lang.String serviceUrl
           
protected  boolean shutdown
           
protected  java.lang.String state
           
 
Constructor Summary
BluetoothGPSSpotter()
           
 
Method Summary
protected  void cleanup()
           
 void close()
          Unloads resources used by the spotter.
protected abstract  void findGPS()
          Locates a bluetooth gps device and hooks up serviceUrl, conn, and is.
 java.lang.String getState()
           
 void open()
          Load resources used by the spotter.
protected  void readGPSData()
           
protected  void scanningThreadRun()
           
 void sendASentence(java.lang.String sentence)
          Send a sentence, complete with checksum, to the gps device.
protected  void startScanningImpl()
          Begin collecting and processing sentences from the gps device, handing them off to the NMEAGPSSpotter.lineAvailable(String) method as they are read in.
protected  void stopScanningImpl()
          Stop collecting sentences from the gps device
 
Methods inherited from class org.placelab.spotter.NMEAGPSSpotter
getMeasurement, lineAvailable, measurementAvailable, startScanning, startScanning, stopScanning
 
Methods inherited from class org.placelab.spotter.AbstractSpotter
addListener, notifyEndOfScan, notifyEndOfScan, notifyGotException, notifyGotException, notifyGotMeasurement, notifyGotMeasurement, removeListener, scanOnce, scanOnce, waitForThread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scanThread

protected BluetoothGPSSpotter.ScanThread scanThread

conn

protected javax.microedition.io.StreamConnection conn

is

protected java.io.DataInputStream is

serviceUrl

protected java.lang.String serviceUrl

state

protected java.lang.String state

connectedDeviceName

protected java.lang.String connectedDeviceName

shutdown

protected boolean shutdown

lingeringData

protected java.lang.String lingeringData
Constructor Detail

BluetoothGPSSpotter

public BluetoothGPSSpotter()
Method Detail

open

public void open()
Description copied from interface: Spotter
Load resources used by the spotter. Applications should be able to invoke this methods multiple times in sequence and have the "right" things happen. All Spotters should be opened before being used.


close

public void close()
Description copied from interface: Spotter
Unloads resources used by the spotter. Multiple calls to close are ok.


startScanningImpl

protected void startScanningImpl()
Description copied from class: NMEAGPSSpotter
Begin collecting and processing sentences from the gps device, handing them off to the NMEAGPSSpotter.lineAvailable(String) method as they are read in.

Specified by:
startScanningImpl in class NMEAGPSSpotter

stopScanningImpl

protected void stopScanningImpl()
Description copied from class: NMEAGPSSpotter
Stop collecting sentences from the gps device

Specified by:
stopScanningImpl in class NMEAGPSSpotter

scanningThreadRun

protected void scanningThreadRun()

cleanup

protected void cleanup()

findGPS

protected abstract void findGPS()
Locates a bluetooth gps device and hooks up serviceUrl, conn, and is. If no bluetooth gps device can be found, leave those 3 alone. Feel free to block in here if you like.


readGPSData

protected void readGPSData()
                    throws java.io.IOException
Throws:
java.io.IOException

sendASentence

public void sendASentence(java.lang.String sentence)
Description copied from class: NMEAGPSSpotter
Send a sentence, complete with checksum, to the gps device. Neither newline nor carraige return should be included.

Specified by:
sendASentence in class NMEAGPSSpotter

getState

public java.lang.String getState()