This class allows to find random but valid dummy traces and to cache them locally. More...
#include <DummyCache.h>
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. |
This class allows to find random but valid dummy traces and to cache them locally.
DummyCache::DummyCache | ( | QObject * | parent = 0 |
) |
Create an instance of the Dummy Cache.
void DummyCache::addCells | ( | QHash< QString, QList< QString > > | cells | ) | [slot] |
Add the cell tower information to the cache.
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.
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.
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.
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 |
void DummyCache::init | ( | ) |
Initialize = Reset to zero and reload Cache
void DummyCache::setCacheRegion | ( | QGeoCoordinate | center | ) |
Set the dummy cache center.
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.