+++ /dev/null
-#include "gps.h"
-
-#include <QDebug>
-
-#ifdef Q_WS_MAEMO_5
-
-bool ValidQReal(qreal value);
-
-GpsMaemo5::GpsMaemo5(LocationGPSDControlInterval location_interval,
- LocationGPSDControlMethod location_method,
- QObject *parent) :
- QObject(parent)
-{
- latitude = 0;
- longitude = 0;
- accuracy = 0;
-
- control = location_gpsd_control_get_default();
- device = (LocationGPSDevice*) g_object_new(LOCATION_TYPE_GPS_DEVICE, NULL);
-
- updateGPSConfig (location_interval, location_method);
-
- g_signal_connect(device, "changed", G_CALLBACK(GpsMaemo5_changed), this);
-}
-
-void GpsMaemo5::enable()
-{
- location_gpsd_control_start(control);
-}
-void GpsMaemo5::disable()
-{
- location_gpsd_control_stop(control);
-}
-
-void GpsMaemo5::updateGPSConfig (LocationGPSDControlInterval location_interval,
- LocationGPSDControlMethod location_method)
-{
- g_object_set(G_OBJECT(control), "preferred-interval", location_interval, NULL);
- g_object_set(G_OBJECT(control), "preferred-method", location_method, NULL);
- qDebug() << "preferred-interval: " << location_interval;
- qDebug() << "preferred-method: " << location_method;
-}
-
-void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps) {
- if (device->fix) {
- if (device->fix->fields) {
- if ( !ValidQReal(gps->device->fix->eph/100.) )
- return;
- g_print("lat = %f, long = %f, eph = %f\n", gps->device->fix->latitude, gps->device->fix->longitude, gps->device->fix->eph/100.);
- gps->latitude = gps->device->fix->latitude;
- gps->longitude = gps->device->fix->longitude;
- gps->accuracy = gps->device->fix->eph/100.;
- emit gps->fix();
- }
- }
-}
-
-bool ValidQReal(qreal value)
-{
- if (value != value){
- return false;
- }
- else if (value > std::numeric_limits<qreal>::max()){
- return false;
- }
- else if (value < -std::numeric_limits<qreal>::max()){
- return false;
- }
- else
- return true;
-}
-
-#endif // Q_WS_MAEMO_5