Added new file: gpsdata, maemo5location, maemo5locationprivate.
authorToni Jussila <toni.jussila@fudeco.com>
Wed, 17 Mar 2010 09:39:34 +0000 (11:39 +0200)
committerToni Jussila <toni.jussila@fudeco.com>
Wed, 17 Mar 2010 09:39:34 +0000 (11:39 +0200)
Client/UI.pro
Client/gpsdata.cpp [new file with mode: 0644]
Client/gpsdata.h [new file with mode: 0644]
Client/maemo5location.cpp [new file with mode: 0755]
Client/maemo5location.h [new file with mode: 0755]
Client/maemo5locationprivate.cpp [new file with mode: 0755]
Client/maemo5locationprivate.h [new file with mode: 0755]

index 88304df..752b2a1 100644 (file)
@@ -23,8 +23,10 @@ SOURCES += main.cpp \
     xmlreader.cpp \
     httpclient.cpp \
     categorylist.cpp \
-    welcomedialog.cpp
-
+    welcomedialog.cpp \
+    gpsdata.cpp \
+    maemo5locationprivate.cpp \
+    maemo5location.cpp
 HEADERS += carmainwindow.h \
     resultdialog.h \
     stringlistmodel.h \
@@ -38,11 +40,31 @@ HEADERS += carmainwindow.h \
     xmlreader.h \
     httpclient.h \
     categorylist.h \
-    welcomedialog.h
-
+    welcomedialog.h \
+    gpsdata.h \
+    maemo5locationprivate.h \
+    maemo5location.h
 FORMS += carmainwindow.ui \
     resultdialog.ui \
     measuredialog.ui \
     loginwindow.ui \
     registration.ui \
     welcomedialog.ui
+
+contains(QT_CONFIG, hildon):CONFIG += hildon
+CONFIG += link_pkgconfig
+
+# Enable this to disable debugging
+# DEFINES += QT_NO_DEBUG_OUTPUT
+target.path += /usr/lib
+devincludes.files = $$HEADERS
+devincludes.path += /usr/include/$$TEMPLATE$$TARGET
+INSTALLS += target \
+    devincludes
+PKGCONFIG += glib-2.0 \
+    liblocation
+exists(/usr/lib/liblocation.so) {
+    DEFINES += LIBLOCATION
+    message(liblocation found)
+}
+
diff --git a/Client/gpsdata.cpp b/Client/gpsdata.cpp
new file mode 100644 (file)
index 0000000..4dd783e
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * GPS data
+ *
+ * @author     Toni Jussila <toni.jussila@fudeco.com>
+ * @copyright  (c) 2010 Speed Freak team
+ * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
+ */
+
+#include "gpsdata.h"
+
+/**
+  *Default constructor of this class.
+  */
+GPSData::GPSData()
+{
+    location = new Maemo5Location(this);
+
+    connect(location,SIGNAL(agnss()),this,SLOT(agnss()));
+    connect(location,SIGNAL(awcp()),this,SLOT(awcp()));
+    connect(location,SIGNAL(locationUpdated()),this,SLOT(locationUpdated()));
+    connect(location,SIGNAL(gps_connected()),this,SLOT(gpsConnected()));
+    connect(location,SIGNAL(gps_disconnected()),this,SLOT(gpsDisconnected()));
+    connect(location,SIGNAL(gps_error(int error)),this,SLOT(gps_error(int error)));
+    connect(location,SIGNAL(gpsd_running()),this,SLOT(gpsd_running()));
+    connect(location,SIGNAL(gpsd_stopped()),this,SLOT(gpsd_stopped()));
+}
+
+/**
+  *Destructor of this class. Deletes all dynamic objects and sets them to NULL.
+  */
+GPSData::~GPSData()
+{
+    delete location;
+    location = NULL;
+}
+
+void GPSData::agnss()
+{
+    QString satellitesInUse = QString::number(location->getSatellitesInUse());  //Returns number of satellites in use.
+    QString satellitesInView = QString::number(location->getSatellitesInView());//Returns number of satellites in view.
+    QString signalStrength = QString::number(location->getSignalStrength());    //Returns average signal strength of satellites which are in use.
+    QString latitude = QString::number(location->getLatitude());                //Returns latitude.
+    QString longitude = QString::number(location->getLongitude());              //Returns longitude.
+    QString time = QString::number(location->getTime());                        //Returns timestamp of the update in seconds.
+    QString ept = QString::number(location->getEpt());                          //Returns time accuracy in seconds.
+    QString eph = QString::number(location->getEph());                          //Returns horizontal position accuracy in cm.
+    QString altitude = QString::number(location->getAltitude());                //Returns fix altitude in meters.
+    QString epv = QString::number(location->getEpv());                          //Returns altitude accuracy in meters.
+    QString track = QString::number(location->getTrack());                      //Returns direction of motion in degrees(0-359).
+    QString epd = QString::number(location->getEpd());                          //Returns track accuracy in degrees.
+    QString speed = QString::number(location->getSpeed());                      //Returns current speed in km/h.
+    QString eps = QString::number(location->getEps());                          //Returns speed accuracy in km/h.
+    QString climp = QString::number(location->getClimb());                      //Returns current rate of climb in m/s.
+    QString epc = QString::number(location->getEpc());                          //Returns climb accuracy in m/s.
+    //location->distance_between_two_points(double latitude_s, double longitude_s, double latitude_f, double longitude_f);
+}
+
+void GPSData::awcp()
+{
+
+}
+
+void GPSData::locationUpdated()
+{
+
+}
+
+void GPSData::gpsConnected()
+{
+
+}
+
+void GPSData::gpsDisconnected()
+{
+
+}
+
+void GPSData::gps_error(int error)
+{
+
+}
+
+void GPSData::gpsd_running()
+{
+
+}
+
+void GPSData::gpsd_stopped()
+{
+
+}
diff --git a/Client/gpsdata.h b/Client/gpsdata.h
new file mode 100644 (file)
index 0000000..b51a929
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * GPS data
+ *
+ * @author     Toni Jussila <toni.jussila@fudeco.com>
+ * @copyright  (c) 2010 Speed Freak team
+ * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
+ */
+
+#ifndef GPSDATA_H
+#define GPSDATA_H
+
+#include <QObject>
+#include <maemo5location.h>
+
+class GPSData : public QObject
+{
+public:
+    GPSData();
+    ~GPSData();
+
+private:
+    Maemo5Location *location;
+
+private slots:
+    void agnss();
+    void awcp();
+    void locationUpdated();
+    void gpsConnected();
+    void gpsDisconnected();
+    void gps_error(int error);
+    void gpsd_running();
+    void gpsd_stopped();
+};
+
+#endif // GPSDATA_H
diff --git a/Client/maemo5location.cpp b/Client/maemo5location.cpp
new file mode 100755 (executable)
index 0000000..b294c53
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+ * Maemo5Location
+ *
+ * @author     Toni Jussila <toni.jussila@fudeco.com>
+ * @copyright  (c) 2010 Speed Freak team
+ * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
+ */
+
+//#ifdef Q_WS_MAEMO_5
+#include "maemo5locationprivate.h"
+#include "maemo5location.h"
+
+/**
+  *Default constructor of this class.
+  *@param QObject pointer to parent object. By default the value is NULL.
+  */
+Maemo5Location::Maemo5Location(QObject* parent):QObject(parent)
+{
+    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(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(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.
+  */
+Maemo5Location::~Maemo5Location()
+{
+    delete ptr;
+}
+
+/**
+  *Returns latitude.
+  */
+double Maemo5Location::getLatitude()
+{
+    return ptr->get_lat();
+}
+
+/**
+  *Returns longitude.
+  */
+double Maemo5Location::getLongitude()
+{
+    return ptr->get_lon();
+}
+
+/**
+  *Returns number of satellites in use.
+  */
+int Maemo5Location::getSatellitesInUse()
+{
+    return ptr->get_satellites_in_use();
+}
+
+/**
+  *Returns number of satellites in view.
+  */
+int Maemo5Location::getSatellitesInView()
+{
+    return ptr->get_satellites_in_view();
+}
+
+/**
+  *Returns average signal strength of satellites which are in use.
+  */
+int Maemo5Location::getSignalStrength()
+{
+    return ptr->get_signal_strength();
+}
+
+/**
+  *Returns timestamp of the update in seconds.
+  */
+double Maemo5Location::getTime()
+{
+    return ptr->get_time();
+}
+
+/**
+  *Returns time accuracy in seconds.
+  */
+double Maemo5Location::getEpt()
+{
+    return ptr->get_ept();
+}
+
+/**
+  *Returns horizontal position accuracy in cm.
+  */
+double Maemo5Location::getEph()
+{
+    return ptr->get_eph();
+}
+
+/**
+  *Returns fix altitude in meters.
+  */
+double Maemo5Location::getAltitude()
+{
+    return ptr->get_altitude();
+}
+
+/**
+  *Returns altitude accuracy in meters.
+  */
+double Maemo5Location::getEpv()
+{
+    return ptr->get_epv();
+}
+
+/**
+  *Returns direction of motion in degrees(0-359).
+  */
+double Maemo5Location::getTrack()
+{
+    return ptr->get_track();
+}
+
+/**
+  *Returns track accuracy in degrees.
+  */
+double Maemo5Location::getEpd()
+{
+    return ptr->get_epd();
+}
+
+/**
+  *Returns current speed in km/h.
+  */
+double Maemo5Location::getSpeed()
+{
+    return ptr->get_speed();
+}
+
+/**
+  *Returns speed accuracy in km/h.
+  */
+double Maemo5Location::getEps()
+{
+    return ptr->get_eps();
+}
+
+/**
+  *Returns current rate of climb in m/s.
+  */
+double Maemo5Location::getClimb()
+{
+    return ptr->get_climb();
+}
+
+/**
+  *Returns climb accuracy in m/s.
+  */
+double Maemo5Location::getEpc()
+{
+    return ptr->get_epc();
+}
+
+/**
+  *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
+  */
+double Maemo5Location::distance_between_two_points(double latitude_s, double longitude_s, double latitude_f, double longitude_f)
+{
+    return ptr->distance_between_two_points(latitude_s, longitude_s, latitude_f, longitude_f);
+}
diff --git a/Client/maemo5location.h b/Client/maemo5location.h
new file mode 100755 (executable)
index 0000000..c16decb
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Maemo5Location
+ *
+ * @author     Toni Jussila <toni.jussila@fudeco.com>
+ * @copyright  (c) 2010 Speed Freak team
+ * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
+ */
+
+#ifndef MAEMO5LOCATION_H
+#define MAEMO5LOCATION_H
+
+#include <QObject>
+
+class Maemo5LocationPrivate;
+
+class Maemo5Location : public QObject
+{
+    Q_OBJECT
+public:
+    Maemo5Location(QObject* parent = 0);
+    ~Maemo5Location();
+
+    int getSatellitesInUse();
+    int getSatellitesInView();
+    int getSignalStrength();
+    double getLatitude();
+    double getLongitude();
+    double getTime();
+    double getEpt();
+    double getEph();
+    double getAltitude();
+    double getEpv();
+    double getTrack();
+    double getEpd();
+    double getSpeed();
+    double getEps();
+    double getClimb();
+    double getEpc();
+    double distance_between_two_points(double latitude_s, double longitude_s, double latitude_f, double longitude_f);
+
+signals:
+    void awcp();
+    void agnss();
+    void locationUpdated();
+    void gps_connected();
+    void gps_disconnected();
+    void gps_error(int error);
+    void gpsd_running();
+    void gpsd_stopped();
+
+private:
+    Maemo5LocationPrivate* ptr;
+};
+
+#endif // MAEMO5LOCATION_H
diff --git a/Client/maemo5locationprivate.cpp b/Client/maemo5locationprivate.cpp
new file mode 100755 (executable)
index 0000000..5e4374a
--- /dev/null
@@ -0,0 +1,277 @@
+/*
+ * Maemo5LocationPrivate
+ *
+ * @author     Toni Jussila <toni.jussila@fudeco.com>
+ * @copyright  (c) 2010 Speed Freak team
+ * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
+ */
+
+#include "maemo5locationprivate.h"
+
+/**
+  *Default constructor of this class.
+  *@param Maemo5Location pointer to public interface.
+  */
+Maemo5LocationPrivate::Maemo5LocationPrivate(Maemo5Location* location):QObject(location)
+{
+    //Initialize variables
+    gps_online = false;
+    usegps = -1;
+    resetAll();
+    //Get gps control object
+    control = location_gpsd_control_get_default();
+    //create gps device
+    device = (LocationGPSDevice*) g_object_new(LOCATION_TYPE_GPS_DEVICE, NULL);
+
+    g_signal_connect(device, "changed", G_CALLBACK(gps_data_changed), this);
+    g_signal_connect(device, "connected", G_CALLBACK(gps_connected_func), this);
+    g_signal_connect(device, "disconnected", G_CALLBACK(gps_disconnected_func), this);
+
+    g_signal_connect(control, "error-verbose", G_CALLBACK(gps_error_func), this);
+    g_signal_connect(control, "gpsd_running", G_CALLBACK(gpsd_running_func), this);
+    g_signal_connect(control, "gpsd_stopped", G_CALLBACK(gpsd_running_func), this);
+
+}
+/**
+  *Destructor of this class. Should be used to release all allocated resources.
+  */
+Maemo5LocationPrivate::~Maemo5LocationPrivate()
+{
+    delete device;
+    delete control;
+}
+
+/**
+  *This function is used to start to poll with gprs
+  */
+void Maemo5LocationPrivate::get_acwp()
+{
+    g_object_set(G_OBJECT(control), "preferred-method", LOCATION_METHOD_ACWP, NULL);
+    usegps = 0;
+    restart();
+}
+
+/**
+  *This function starts to poll via gps interface
+  */
+void Maemo5LocationPrivate::get_agnss()
+{
+    g_object_set(G_OBJECT(control), "preferred-method", LOCATION_METHOD_AGNSS, NULL);
+    usegps = 1;
+    restart();
+}
+
+/**
+  *Stop pollling
+  */
+void Maemo5LocationPrivate::stop()
+{
+    location_gpsd_control_stop(control);
+}
+
+/**
+  *Stop and restart polling
+  */
+void Maemo5LocationPrivate::restart()
+{
+    location_gpsd_control_stop(control);
+    location_gpsd_control_start(control);
+}
+
+/**
+  *This function is called when device managed to connect to the lcoation server.
+  *Function emits gps_connected signal.
+  *@param Pointer to LocationGPSDevice class
+  *@param Pointer to Maemo5LocationPrivate class
+  */
+void gps_connected_func(LocationGPSDevice *device, Maemo5LocationPrivate *gps)
+{
+    emit gps->gps_connected();
+}
+
+/**
+  *This function is called when device is disconnected from the location server.
+  *Function emits gps_disconnected signal.
+  *Also this function resets all arguments of Maemo5LcoationPrivate class.
+  *@param Pointer to LocationGPSDevice class
+  *@param Pointer to Maemo5LocationPrivate class
+  */
+void gps_disconnected_func(LocationGPSDevice *device, Maemo5LocationPrivate *gps)
+{
+    gps->resetAll();
+    emit gps->gps_disconnected();
+}
+
+/**
+  *This function is called after the location_gpsd_control_stop has been called.
+  *@param Pointer to LocationGPSDControl class
+  *@param Pointer to Maemo5LocationPrivate class
+  */
+void gpsd_stopped_func(LocationGPSDControl *control, Maemo5LocationPrivate *gps)
+{
+    emit gps->gpsd_stopped();
+}
+
+/**
+  *This function is called when an error has occurred.
+  *@param Pointer to LocationGPSDControl class
+  *@param error code
+  *@param Pointer to Maemo5LocationPrivate class
+  */
+void gps_error_func(LocationGPSDControl *control, gint error, Maemo5LocationPrivate *gps)
+{
+
+    switch (error) {
+      case LOCATION_ERROR_USER_REJECTED_DIALOG:
+        emit gps->gps_err(0);
+        g_debug("User didn't enable requested methods");
+        break;
+      case LOCATION_ERROR_USER_REJECTED_SETTINGS:
+        emit gps->gps_err(1);
+        g_debug("User changed settings, which disabled location");
+        break;
+      case LOCATION_ERROR_BT_GPS_NOT_AVAILABLE:
+        emit gps->gps_err(2);
+        g_debug("Problems with BT GPS");
+        break;
+      case LOCATION_ERROR_METHOD_NOT_ALLOWED_IN_OFFLINE_MODE:
+        emit gps->gps_err(3);
+        g_debug("Requested method is not allowed in offline mode");
+        break;
+      case LOCATION_ERROR_SYSTEM:
+        emit gps->gps_err(4);
+        g_debug("System error");
+        break;
+      }
+}
+
+/**
+  *This function is called after the location_gpsd_control_start has been called.
+  *@param Pointer to LocationGPSDControl class
+  *@param Pointer to Maemo5LocationPrivate class
+  */
+void gpsd_running_func(LocationGPSDControl *control, Maemo5LocationPrivate *gps)
+{
+    emit gps->gpsd_running();
+}
+
+/**
+  *Callback function to catch gps signals.
+  *@param Pointer to LocationGPSDControl class
+  *@param Pointer to Maemo5LocationPrivate class
+  */
+void gps_data_changed(LocationGPSDevice *device, Maemo5LocationPrivate *gps)
+{
+    //First check that LocationGpsDeviceFix can be found...this data structure contains the location info.
+    if(gps->device->fix)
+    {
+        //Check that there are fields
+        if(gps->device->fix->fields)
+        {
+            //Store values and emit signal
+            if(gps->device->fix->fields & LOCATION_GPS_DEVICE_LATLONG_SET)
+            {
+                gps->latitude = gps->device->fix->latitude;
+                gps->longitude = gps->device->fix->longitude;
+                gps->eph = gps->device->fix->eph;
+            }
+
+
+            gps->satellites_in_use = gps->device->satellites_in_use;
+            gps->satellites_in_view = gps->device->satellites_in_view;
+
+            if(gps->device->fix->fields &       LOCATION_GPS_DEVICE_TIME_SET)
+            {
+                gps->time = gps->device->fix->time;
+                gps->ept = gps->device->fix->ept;
+            }
+
+            if(gps->device->fix->fields & LOCATION_GPS_DEVICE_ALTITUDE_SET)
+            {
+                gps->altitude = gps->device->fix->altitude;
+                gps->epv = gps->device->fix->epv;
+            }
+
+            if(gps->device->fix->fields & LOCATION_GPS_DEVICE_TRACK_SET)
+            {
+                gps->track = gps->device->fix->track;
+                gps->epd = gps->device->fix->epd;
+            }
+
+            if(gps->device->fix->fields & LOCATION_GPS_DEVICE_SPEED_SET)
+            {
+                gps->speed = gps->device->fix->speed;
+                gps->eps = gps->device->fix->eps;
+            }
+
+            if(gps->device->fix->fields & LOCATION_GPS_DEVICE_CLIMB_SET)
+            {
+                gps->climb = gps->device->fix->climb;
+                gps->epc = gps->device->fix->epc;
+            }
+
+
+            // Calculate average signal strength of satellites in use
+            int temp = 0;
+            if(gps->satellites_in_use != 0)
+            {
+                for(int i=0 ; i < gps->satellites_in_use ; i++)
+                {
+                    LocationGPSDeviceSatellite * view = (LocationGPSDeviceSatellite*) g_ptr_array_index (gps->device->satellites, i);
+                    temp = temp + view->signal_strength;
+                }
+                gps->signal_strength = (temp / gps->satellites_in_use);
+            }
+
+
+            if(gps->usegps == 0)
+            {
+                emit gps->awcp();
+            }
+            else if(gps->usegps == 1)
+            {
+                emit gps->agnss();
+            }
+            else
+            {
+                emit gps->locationUpdated();
+            }
+        }
+    }
+
+}
+
+/**
+  *Resets all arguments of Maemo5LocationPrivate class.
+  */
+void Maemo5LocationPrivate::resetAll()
+{
+    time = 0;
+    latitude = 0;
+    longitude = 0;
+    satellites_in_view = 0;
+    satellites_in_use = 0;
+    ept = 0;
+    eph = 0;
+    altitude = 0;
+    epv = 0;
+    track = 0;
+    epd = 0;
+    speed = 0;
+    eps = 0;
+    climb = 0;
+    epc = 0;
+}
+
+/**
+  *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
+  */
+double Maemo5LocationPrivate::distance_between_two_points(double latitude_s, double longitude_s, double latitude_f, double longitude_f)
+{
+    double distance = 0;
+    return distance = location_distance_between(latitude_s, longitude_s, latitude_f, longitude_f);
+}
diff --git a/Client/maemo5locationprivate.h b/Client/maemo5locationprivate.h
new file mode 100755 (executable)
index 0000000..14b3bba
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * Maemo5LocationPrivate
+ *
+ * @author     Toni Jussila <toni.jussila@fudeco.com>
+ * @copyright  (c) 2010 Speed Freak team
+ * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
+ */
+
+#ifndef MAEMO5LOCATIONPRIVATE_H
+#define MAEMO5LOCATIONPRIVATE_H
+
+//We have to declare these header file inside extern, since these modules are actually c modules not c++
+extern "C"
+{
+#include <location/location-gps-device.h>
+#include <location/location-gpsd-control.h>
+#include <location/location-distance-utils.h>
+}
+
+#include <QObject>
+#include "maemo5location.h"
+
+class Maemo5LocationPrivate : public QObject
+{
+    Q_OBJECT
+
+public:
+    Maemo5LocationPrivate(Maemo5Location* location);
+    ~Maemo5LocationPrivate();
+
+    void get_acwp();
+    void get_agnss();
+
+    friend void gps_data_changed(LocationGPSDevice *device, Maemo5LocationPrivate *gps);
+    friend void gps_connected_func(LocationGPSDevice *device, Maemo5LocationPrivate *gps);
+    friend void gps_disconnected_func(LocationGPSDevice *device, Maemo5LocationPrivate *gps);
+    friend void gps_error_func(LocationGPSDControl *control, gint error, Maemo5LocationPrivate *gps);
+    friend void gpsd_running_func(LocationGPSDControl *control, Maemo5LocationPrivate *gps);
+    friend void gpsd_stopped_func(LocationGPSDControl *control, Maemo5LocationPrivate *gps);
+
+    static void handleStatus( LocationGPSDeviceStatus status );
+
+    int get_satellites_in_view() { return satellites_in_view; }
+    int get_satellites_in_use() { return satellites_in_use; }
+    int get_signal_strength() { return signal_strength; }
+    gboolean get_gps_online() { return gps_online; }
+    double get_lat() { return latitude; }
+    double get_lon() { return longitude; }
+    double get_time() { return time; }
+    double get_ept() { return ept; }
+    double get_eph() { return eph; }
+    double get_altitude() { return altitude; }
+    double get_epv() { return epv; }
+    double get_track() { return track; }
+    double get_epd() { return epd; }
+    double get_speed() { return speed; }
+    double get_eps() { return eps; }
+    double get_climb() { return climb; }
+    double get_epc() { return epc; }
+    double distance_between_two_points(double latitude_s, double longitude_s, double latitude_f, double longitude_f);
+
+signals:
+    void awcp();
+    void agnss();
+    void locationUpdated();
+    void gps_connected();
+    void gps_disconnected();
+    void gps_err(int error);
+    void gpsd_running();
+    void gpsd_stopped();
+
+private:
+    void resetAll();
+    void stop();
+    void restart();
+
+    int satellites_in_view;
+    int satellites_in_use;
+    int signal_strength;
+    gboolean gps_online;
+    double latitude;
+    double longitude;
+    double time;
+    double ept;
+    double eph;
+    double altitude;
+    double epv;
+    double track;
+    double epd;
+    double speed;
+    double eps;
+    double climb;
+    double epc;
+
+    Maemo5Location* d_ptr;
+    int usegps;
+    LocationGPSDControl *control;
+    LocationGPSDevice *device;
+};
+
+void gps_data_changed(LocationGPSDevice *device, Maemo5LocationPrivate *gps);
+void gps_connected_func(LocationGPSDevice *device, Maemo5LocationPrivate *gps);
+void gps_disconnected_func(LocationGPSDevice *device, Maemo5LocationPrivate *gps);
+void gps_error_func(LocationGPSDControl *control, gint error, Maemo5LocationPrivate *gps);
+void gpsd_running_func(LocationGPSDControl *control, Maemo5LocationPrivate *gps);
+void gpsd_stopped_func(LocationGPSDControl *control, Maemo5LocationPrivate *gps);
+
+#endif // MAEMO5LOCATIONPRIVATE_H