Sharing Class Reference
This class provides at high level functions which can be called to share the location.
More...
#include <Sharing.h>
List of all members.
Public Slots |
void | logged (bool s, QString m) |
| Slot called if a login answer is received.
|
void | meDHTRequest (QByteArray x, QByteArray y) |
| Find the users encrypted position in the DHT.
|
void | meDHTAnswer (QString dhtAnswer, QString id, OpenDHT *dht) |
| slot called if an answer is received from the DHT
|
void | friendDHTrequest (QString id, QByteArray x, QByteArray y) |
| Find a friend's encrypted position in the DHT.
|
void | friendDHTAnswer (QString friendAnswer, QString id, OpenDHT *dht) |
| Slot called upn reception of a friend information from the DHT.
|
void | storeDHTanswer (QString q, QString id, OpenDHT *dht) |
void | setError (QString err) |
| Relay or set error messages.
|
void | setStatus (QString s) |
| Relay or set Status messages.
|
void | shareAnswer (bool s, QString m) |
| Slot called upon reception of an sharing answer.
|
void | setFriends (QHash< QString, Friend * > *freinds) |
| Update the local friend list.
|
Signals |
void | error (QString err) |
void | status (QString s) |
void | mePos (QString, double lat, double lng) |
void | friendPos (QString id, double lat, double lng) |
void | loggedIn (bool, QString) |
Public Member Functions |
| Sharing (QObject *parent=0) |
| Construct an object which allows sharing of users location.
|
void | login (QString user, QString pass) |
| Login at the selected location Sharing service.
|
void | getMe () |
| Get the users position from the LSS.
|
void | getFriends () |
| Get the friends formt the LSS.
|
void | share (QString id, double lat, double lng) |
| Share the user's position.
|
void | shareDHT (QString id, double fakeLat, double fakeLng, double realLat, double realLng) |
| Update the DHT.
|
void | setMe (Friend *me) |
| Update the local user information.
|
void | setTTL (int val) |
| Set the ttl.
|
Detailed Description
This class provides at high level functions which can be called to share the location.
It provides functions to login, to share the users location and to retrieve a list of friends and their position. This class is not related to one sharing service, but it interacts with one selected instance of a class related to the API of one given sharing service. Additionally this class takes care of encrypting and decrpting the position and of storing the position in a temporal storage. To fulgill these 2 requirements, it uses instances of the OpenDHT class for the temporal storage and of the Crypt class for the encryption/decryption.
Member Function Documentation
void Sharing::friendDHTAnswer |
( |
QString |
friendAnswer, |
|
|
QString |
id, |
|
|
OpenDHT * |
dht | |
|
) |
| | [slot] |
Slot called upn reception of a friend information from the DHT.
The function decrypts the answer and parses it. If the data is valid the friendPos signal containing the friend's Id an his position is emitted. If an error occured, the a message is emitted via the status signal. NOTICE: ENCRYPTION FOR FRIENDS IS NOT YET ENABLED, DUE TO TESTING!
- Parameters:
-
| friendAnswer | is the value as stored in the DHT |
| id | is the friend's id |
| dht | is a pointer the DHT's instance |
void Sharing::friendDHTrequest |
( |
QString |
id, |
|
|
QByteArray |
x, |
|
|
QByteArray |
y | |
|
) |
| | [slot] |
Find a friend's encrypted position in the DHT.
- Parameters:
-
| id | is the friend's id |
| x | is the first part of the reference of the friend's position in the DHT |
| y | is the second part of the reference of the friend's position in the DHT |
void Sharing::logged |
( |
bool |
success, |
|
|
QString |
msg | |
|
) |
| | [slot] |
Slot called if a login answer is received.
- Parameters:
-
| success | indicates the outcome of the login action |
| msg | is a message |
void Sharing::login |
( |
QString |
user, |
|
|
QString |
pass | |
|
) |
| | |
Login at the selected location Sharing service.
- Parameters:
-
| username | the user's id |
| password | the user's password |
void Sharing::meDHTAnswer |
( |
QString |
dhtAnswer, |
|
|
QString |
id, |
|
|
OpenDHT * |
dht | |
|
) |
| | [slot] |
slot called if an answer is received from the DHT
- Parameters:
-
| dhtAnswer | is the value return by the DHT |
| id | is the related user's id |
| dht | is a pointer to the dht instance |
void Sharing::meDHTRequest |
( |
QByteArray |
x, |
|
|
QByteArray |
y | |
|
) |
| | [slot] |
Find the users encrypted position in the DHT.
- Parameters:
-
| x | The first part of the reference of the user's position in the DHT |
| x | The second part of the reference of the user's position in the DHT |
void Sharing::setError |
( |
QString |
err |
) |
[slot] |
Relay or set error messages.
- Parameters:
-
void Sharing::setFriends |
( |
QHash< QString, Friend * > * |
friends |
) |
[slot] |
Update the local friend list.
- Parameters:
-
| friends | a pointer to the friend list |
void Sharing::setMe |
( |
Friend * |
me |
) |
|
Update the local user information.
- Parameters:
-
void Sharing::setStatus |
( |
QString |
s |
) |
[slot] |
Relay or set Status messages.
- Parameters:
-
void Sharing::setTTL |
( |
int |
ttl |
) |
|
void Sharing::share |
( |
QString |
id, |
|
|
double |
lat, |
|
|
double |
lng | |
|
) |
| | |
Share the user's position.
This functions first encrypts the users position, saves a random reference int the Sharing service an uses this reference as key to store the encrypted value of the user's position in the DHT
- Parameters:
-
| id | is the user's id |
| lat | is the latitude of the users real position |
| lng | is the longitude of the users real position |
void Sharing::shareAnswer |
( |
bool |
success, |
|
|
QString |
msg | |
|
) |
| | [slot] |
Slot called upon reception of an sharing answer.
- Parameters:
-
| success | indicates the outcome of sharing |
| msg | indicates a related message (currently not used) |
void Sharing::shareDHT |
( |
QString |
id, |
|
|
double |
fakeLat, |
|
|
double |
fakeLng, |
|
|
double |
realLat, |
|
|
double |
realLng | |
|
) |
| | |
Update the DHT.
- Parameters:
-
| id | is the user's id |
| fakeLat | is the reference latitude |
| fakeLng | is the reference longitude |
| realLat | is the latitude of the user's real position |
| realLng | is the longitude of the user's real position |
void Sharing::storeDHTanswer |
( |
QString |
q, |
|
|
QString |
id, |
|
|
OpenDHT * |
dht | |
|
) |
| | [slot] |
Slot called after after having put a value in the DHT
- Parameters:
-
| q | is the DHT's answer to indicate success |
| id | is the friend's id |
| dht | is a pointer to the DHT instance |
The documentation for this class was generated from the following files:
- C:/Workspace/SourceForge/Privl_S60/inc/sharing/Sharing.h
- C:/Workspace/SourceForge/Privl_S60/build/moc/moc_Sharing.cpp
- C:/Workspace/SourceForge/Privl_S60/src/sharing/Sharing.cpp