DummyCache Class Reference

This class allows to find random but valid dummy traces and to cache them locally. More...

#include <DummyCache.h>

List of all members.

Public Slots

void addMacs (QHash< QString, QGeoCoordinate > macs)
 Add a point (set of APs) to the defined trace.
void addCells (QHash< QString, QList< QString > > cells)
 Add the cell tower information to the cache.

Signals

void cacheDone (QString src)

Public Member Functions

 DummyCache (QObject *parent=0)
QPair< int, QGeoCoordinate > startTrace ()
 Start a new dummy trace.
QPair< QGeoCoordinate, QList
< QString > > 
getPosition (int d, QGeoCoordinate pos, int traceID)
 Get a valid dummy position at a given distance from the current position.
QList< QString > getCellId (QGeoCoordinate pos)
 Get cell tower information from cache based on the position.
void reset ()
 Reset the dummy cache.
void init ()
void setCacheRegion (QGeoCoordinate center)
 Set the dummy cache center.

Detailed Description

This class allows to find random but valid dummy traces and to cache them locally.


Constructor & Destructor Documentation

DummyCache::DummyCache ( QObject *  parent = 0  ) 

Create an instance of the Dummy Cache.


Member Function Documentation

void DummyCache::addCells ( QHash< QString, QList< QString > >  cells  )  [slot]

Add the cell tower information to the cache.

Parameters:
cells is the cell tower information and the positions
void DummyCache::addMacs ( QHash< QString, QGeoCoordinate >  macs  )  [slot]

Add a point (set of APs) to the defined trace.

This slot is called by a QNetworkReply instance if it receives an answer from Wigle. It checks whether the there are enough APs for the point and adds it to the defined trace. It also checks whether this is the last answer for this trace (requestCounter == 0) and verifies whether there are enough traces in this boundig box. If not, it discards the the boundig box and restart the process.

Parameters:
macs is hashmap of nearby APs and their position
QList< QString > DummyCache::getCellId ( QGeoCoordinate  pos  ) 

Get cell tower information from cache based on the position.

Parameters:
position indicates the region in which we are interested
QPair< QGeoCoordinate, QList< QString > > DummyCache::getPosition ( int  d,
QGeoCoordinate  startPos,
int  traceID 
)

Get a valid dummy position at a given distance from the current position.

This funtion returns a dummy but valid position that is about d meters away from the startPos. The position which has the shortest distance to defined circle is chosen. A traceID is required to make sure that the position used before the current position is not used.

Parameters:
d defines the radius of circle in meters (we want to find the position with the shortest distance to this circle)
startPos defines the center of the circle
traceID defines the ID of the trace
Returns:
the distance from startPos to the position found, in meters, and a list of MAC address for this position
void DummyCache::init (  ) 

Initialize = Reset to zero and reload Cache

void DummyCache::setCacheRegion ( QGeoCoordinate  center  ) 

Set the dummy cache center.

Parameters:
center is the center of the cache
QPair< int, QGeoCoordinate > DummyCache::startTrace (  ) 

Start a new dummy trace.

This functions selects random position from the set of dummy positions and returns it's coordinates. Additionally the ID of the trace is returned. This ID is required for requesting the following positions in the trace.

Returns:
the ID of the new trace and starting position of the new trace

The documentation for this class was generated from the following files:
Generated on Thu Jun 24 21:31:43 2010 for PrivL by  doxygen 1.6.3