com.nutiteq.location.providers
Class CellIdLocationProvider

java.lang.Object
  extended by java.util.TimerTask
      extended by com.nutiteq.location.providers.CellIdLocationProvider
All Implemented Interfaces:
CellIdResponseWaiter, LocationSource, java.lang.Runnable
Direct Known Subclasses:
MotorolaCellIdLocationProvider, SonyEricssonCellIdLocationProvider

public class CellIdLocationProvider
extends java.util.TimerTask
implements CellIdResponseWaiter, LocationSource

Generic cell id location positioning handler. Supports single location query or polling at given interval. Pushes retrieved location in WGS84 to LocationListener. If location could not be determined, then null will be pushed into marker and status changes to LocationSource.STATUS_CANT_LOCATE.


Field Summary
 
Fields inherited from interface com.nutiteq.location.LocationSource
STATUS_CANT_LOCATE, STATUS_CONNECTED, STATUS_CONNECTING, STATUS_CONNECTION_LOST
 
Constructor Summary
CellIdLocationProvider(CellIdDataReader dataReader)
          Create location provider for single query
CellIdLocationProvider(CellIdDataReader cellIdDataReader, CellIdService cellIdService)
           
CellIdLocationProvider(CellIdDataReader dataReader, CellIdService cellIdService, long updateInterval)
          Create location provider that queries for location at given interval
CellIdLocationProvider(CellIdDataReader dataReader, long updateInterval)
           
 
Method Summary
 void addLocationListener(LocationListener listener)
          Add listener for location coordinates
 void cantLocate()
           
 WgsPoint getLocation()
           
 LocationMarker getLocationMarker()
          Get location marker used on screen
 int getStatus()
          Get status code for location source.
 void locationRetrieved(WgsPoint wgsPoint)
           
 void notifyError()
           
 void quit()
          Quit location polling
 void run()
           
 void setLocationMarker(LocationMarker marker)
          Set location marker where to push location updates
 void start()
          Start location polling
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CellIdLocationProvider

public CellIdLocationProvider(CellIdDataReader dataReader)
Create location provider for single query

Parameters:
dataReader - data reader used for cellid data accessing

CellIdLocationProvider

public CellIdLocationProvider(CellIdDataReader dataReader,
                              long updateInterval)

CellIdLocationProvider

public CellIdLocationProvider(CellIdDataReader cellIdDataReader,
                              CellIdService cellIdService)

CellIdLocationProvider

public CellIdLocationProvider(CellIdDataReader dataReader,
                              CellIdService cellIdService,
                              long updateInterval)
Create location provider that queries for location at given interval

Parameters:
dataReader - data reader used for cellid data access
updateInterval - update interval for location query
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable
Specified by:
run in class java.util.TimerTask

start

public void start()
Description copied from interface: LocationSource
Start location polling

Specified by:
start in interface LocationSource

getStatus

public int getStatus()
Description copied from interface: LocationSource
Get status code for location source.

Specified by:
getStatus in interface LocationSource
Returns:
status code

notifyError

public void notifyError()
Specified by:
notifyError in interface CellIdResponseWaiter

getLocationMarker

public LocationMarker getLocationMarker()
Description copied from interface: LocationSource
Get location marker used on screen

Specified by:
getLocationMarker in interface LocationSource
Returns:
associated location marker

quit

public void quit()
Description copied from interface: LocationSource
Quit location polling

Specified by:
quit in interface LocationSource

setLocationMarker

public void setLocationMarker(LocationMarker marker)
Description copied from interface: LocationSource
Set location marker where to push location updates

Specified by:
setLocationMarker in interface LocationSource
Parameters:
marker - marker displayed on screen

cantLocate

public void cantLocate()
Specified by:
cantLocate in interface CellIdResponseWaiter

locationRetrieved

public void locationRetrieved(WgsPoint wgsPoint)
Specified by:
locationRetrieved in interface CellIdResponseWaiter

getLocation

public WgsPoint getLocation()
Specified by:
getLocation in interface LocationSource

addLocationListener

public void addLocationListener(LocationListener listener)
Description copied from interface: LocationSource
Add listener for location coordinates

Specified by:
addLocationListener in interface LocationSource
Parameters:
listener - listener to be added