Added error handling to listing of users and showing of user information.
[speedfreak] / Client / maemo5location.cpp
index b294c53..535cef3 100755 (executable)
@@ -9,6 +9,7 @@
 //#ifdef Q_WS_MAEMO_5
 #include "maemo5locationprivate.h"
 #include "maemo5location.h"
+#include <QDebug>
 
 /**
   *Default constructor of this class.
   */
 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();
 }
 
 /**
@@ -35,23 +35,27 @@ Maemo5Location::Maemo5Location(QObject* parent):QObject(parent)
   */
 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();
 }
 
 /**
@@ -79,6 +83,30 @@ int Maemo5Location::getSignalStrength()
 }
 
 /**
+  *Returns gps online.
+  */
+bool Maemo5Location::getGpsOnline()
+{
+    return ptr->get_gps_online();
+}
+
+/**
+  *Returns latitude.
+  */
+double Maemo5Location::getLatitude()
+{
+    return ptr->get_lat();
+}
+
+/**
+  *Returns longitude.
+  */
+double Maemo5Location::getLongitude()
+{
+    return ptr->get_lon();
+}
+
+/**
   *Returns timestamp of the update in seconds.
   */
 double Maemo5Location::getTime()