X-Git-Url: http://git.maemo.org/git/?p=googlelatitude;a=blobdiff_plain;f=src%2Fgps.cpp;h=833e4386d4a4231e39aa9fc538c1c89cc2b63d1b;hp=cd87f24d4377246bf8c623575b59870e87e3206e;hb=02be583c183b90011cf9eb4b3f9a069ab2b6a8b7;hpb=b80c04a8938fa73c45b5d8a17a1c2b2aab5eab3b diff --git a/src/gps.cpp b/src/gps.cpp index cd87f24..833e438 100644 --- a/src/gps.cpp +++ b/src/gps.cpp @@ -23,6 +23,14 @@ void GpsMaemo5::refresh() { QTimer::singleShot(interval*1000, this, SLOT(refresh())); QTimer::singleShot(wait*1000, this, SLOT(stop())); +#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) + QNetworkConfigurationManager mgr; + if (!mgr.isOnline()) { + qDebug() << "GpsMaemo5: offline"; + return; + } +#endif + #ifdef Q_WS_MAEMO_5 g_object_set(G_OBJECT(control), "preferred-method", LOCATION_METHOD_ACWP, NULL); if (usegps) { @@ -49,6 +57,8 @@ void GpsMaemo5::stop() { void GpsMaemo5::forcestop() { qDebug() << "GpsMaemo5: forcestop"; stopgps = true; + emitfix = false; + stop(); } int GpsMaemo5::config(int i, int w, bool g) { @@ -64,6 +74,7 @@ int GpsMaemo5::config(int i, int w, bool g) { void GpsMaemo5_changed(LocationGPSDevice *device, GpsMaemo5 *gps) { if (device->fix) { if (device->fix->fields) { + if ( isnan(gps->device->fix->eph) ) return; g_print("GpsMaemo5 lat %f lon %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;