Merge branch 'package'
[speedfreak] / Client / maemo5location.cpp
index b294c53..9e953e2 100755 (executable)
@@ -9,53 +9,60 @@
 //#ifdef Q_WS_MAEMO_5
 #include "maemo5locationprivate.h"
 #include "maemo5location.h"
+#include <QDebug>
 
 /**
-  *Default constructor of this class.
-  *@param QObject pointer to parent object. By default the value is NULL.
+  * Default constructor of this class.
+  *
+  * @param QObject pointer to parent object. By default the value is NULL.
   */
 Maemo5Location::Maemo5Location(QObject* parent):QObject(parent)
 {
+    qDebug() << "__Maemo5Location";
     ptr = new Maemo5LocationPrivate(this);
 
-    connect(ptr,SIGNAL(agnss()),this,SIGNAL(agnss()));
-    connect(ptr,SIGNAL(awcp()),this,SIGNAL(awcp()));
-    connect(ptr,SIGNAL(locationUpdated()),this,SIGNAL(locationUpdated()));
+    connect(ptr, SIGNAL(agnss()), this, SIGNAL(agnss()));
+    connect(ptr, SIGNAL(awcp()), this, SIGNAL(awcp()));
+    connect(ptr, SIGNAL(locationUpdated()), this, SIGNAL(locationUpdated()));
     connect(ptr, SIGNAL(gps_connected()), this, SIGNAL(gps_connected()));
     connect(ptr, SIGNAL(gps_disconnected()), this, SIGNAL(gps_disconnected()));
-    connect(ptr, SIGNAL(gps_err(int)), this, SIGNAL(gps_error(int)));
+    connect(ptr, SIGNAL(gps_error(int)), this, SIGNAL(gps_error(int)));
     connect(ptr, SIGNAL(gpsd_running()), this, SIGNAL(gpsd_running()));
     connect(ptr, SIGNAL(gpsd_stopped()), this, SIGNAL(gpsd_stopped()));
-
-    ptr->get_agnss();
 }
 
 /**
-  *Destructor of this class. Should be used to release all allocated resources.
+  * Destructor of this class. Should be used to release all allocated resources.
   */
 Maemo5Location::~Maemo5Location()
 {
-    delete ptr;
+    qDebug() << "__~Maemo5Location";
+    if(ptr)
+        delete ptr;
 }
 
 /**
-  *Returns latitude.
+  * Start polling gps.
   */
-double Maemo5Location::getLatitude()
+void Maemo5Location::startPollingGPS()
 {
-    return ptr->get_lat();
+    qDebug() << "__Maemo5Location: startPollingGPS";
+    ptr->get_agnss();
 }
 
 /**
-  *Returns longitude.
+  * Stop polling gps.
   */
-double Maemo5Location::getLongitude()
+void Maemo5Location::stopPollingGPS()
 {
-    return ptr->get_lon();
+    qDebug() << "__Maemo5Location: stopPollingGPS";
+    ptr->stop();
 }
 
 /**
-  *Returns number of satellites in use.
+  * Get number of satellites in use.
+  *
+  * @return int satellites in use
   */
 int Maemo5Location::getSatellitesInUse()
 {
@@ -63,7 +70,9 @@ int Maemo5Location::getSatellitesInUse()
 }
 
 /**
-  *Returns number of satellites in view.
+  * Get number of satellites in view.
+  *
+  * @return int satellites in view
   */
 int Maemo5Location::getSatellitesInView()
 {
@@ -71,7 +80,9 @@ int Maemo5Location::getSatellitesInView()
 }
 
 /**
-  *Returns average signal strength of satellites which are in use.
+  * Get average signal strength of satellites which are in use.
+  *
+  * @return int signal strength
   */
 int Maemo5Location::getSignalStrength()
 {
@@ -79,7 +90,39 @@ int Maemo5Location::getSignalStrength()
 }
 
 /**
-  *Returns timestamp of the update in seconds.
+  * Get gps online.
+  *
+  * @return bool gps online
+  */
+bool Maemo5Location::getGpsOnline()
+{
+    return ptr->get_gps_online();
+}
+
+/**
+  * Get latitude.
+  *
+  * @return double latitude
+  */
+double Maemo5Location::getLatitude()
+{
+    return ptr->get_lat();
+}
+
+/**
+  * Get longitude.
+  *
+  * @return double longitude
+  */
+double Maemo5Location::getLongitude()
+{
+    return ptr->get_lon();
+}
+
+/**
+  * Get timestamp of the update in seconds.
+  *
+  * @return double time
   */
 double Maemo5Location::getTime()
 {
@@ -87,7 +130,9 @@ double Maemo5Location::getTime()
 }
 
 /**
-  *Returns time accuracy in seconds.
+  * Get time accuracy in seconds.
+  *
+  * @return double ept
   */
 double Maemo5Location::getEpt()
 {
@@ -95,7 +140,9 @@ double Maemo5Location::getEpt()
 }
 
 /**
-  *Returns horizontal position accuracy in cm.
+  * Get horizontal position accuracy in cm.
+  *
+  * @return double eph
   */
 double Maemo5Location::getEph()
 {
@@ -103,7 +150,9 @@ double Maemo5Location::getEph()
 }
 
 /**
-  *Returns fix altitude in meters.
+  * Get fix altitude in meters.
+  *
+  * @return double altitude
   */
 double Maemo5Location::getAltitude()
 {
@@ -111,7 +160,9 @@ double Maemo5Location::getAltitude()
 }
 
 /**
-  *Returns altitude accuracy in meters.
+  * Get altitude accuracy in meters.
+  *
+  * @return double epv
   */
 double Maemo5Location::getEpv()
 {
@@ -119,7 +170,9 @@ double Maemo5Location::getEpv()
 }
 
 /**
-  *Returns direction of motion in degrees(0-359).
+  * Get direction of motion in degrees(0-359).
+  *
+  * @return double track
   */
 double Maemo5Location::getTrack()
 {
@@ -127,7 +180,9 @@ double Maemo5Location::getTrack()
 }
 
 /**
-  *Returns track accuracy in degrees.
+  * Get track accuracy in degrees.
+  *
+  * @return double epd
   */
 double Maemo5Location::getEpd()
 {
@@ -135,7 +190,9 @@ double Maemo5Location::getEpd()
 }
 
 /**
-  *Returns current speed in km/h.
+  * Get current speed in km/h.
+  *
+  * @return double speed
   */
 double Maemo5Location::getSpeed()
 {
@@ -143,7 +200,9 @@ double Maemo5Location::getSpeed()
 }
 
 /**
-  *Returns speed accuracy in km/h.
+  * Get speed accuracy in km/h.
+  *
+  * @return double eps
   */
 double Maemo5Location::getEps()
 {
@@ -151,7 +210,9 @@ double Maemo5Location::getEps()
 }
 
 /**
-  *Returns current rate of climb in m/s.
+  * Get current rate of climb in m/s.
+  *
+  * @return double climb
   */
 double Maemo5Location::getClimb()
 {
@@ -159,7 +220,9 @@ double Maemo5Location::getClimb()
 }
 
 /**
-  *Returns climb accuracy in m/s.
+  * Get climb accuracy in m/s.
+  *
+  * @return double epc
   */
 double Maemo5Location::getEpc()
 {
@@ -167,11 +230,13 @@ double Maemo5Location::getEpc()
 }
 
 /**
-  *Returns distance between two points in kilometers.
-  *@param latitude of first point
-  *@param longitude of first point
-  *@param latitude of second point
-  *@param longitude of second point
+  * Get distance between two points in kilometers.
+  *
+  * @param double latitude of first point
+  * @param double longitude of first point
+  * @param double latitude of second point
+  * @param double longitude of second point
+  * @return double distance
   */
 double Maemo5Location::distance_between_two_points(double latitude_s, double longitude_s, double latitude_f, double longitude_f)
 {