From 31392488d2d9591629bf777b3deb7942478799bd Mon Sep 17 00:00:00 2001 From: Niels Date: Wed, 21 Jul 2010 21:04:58 +0200 Subject: [PATCH] get direction, speed and altitude from gpsd --- gpsclient.cpp | 9 +++++++++ gpsclient.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/gpsclient.cpp b/gpsclient.cpp index d63a3e9..9056714 100644 --- a/gpsclient.cpp +++ b/gpsclient.cpp @@ -60,6 +60,15 @@ void GpsClient::readData() lat = entry.section(":", 1, 1).toDouble(); } else if (entry.contains("lon")) { lon = entry.section(":", 1, 1).toDouble(); + } else if (entry.contains("alt")) { + qreal alt = entry.section(":", 1, 1).toDouble(); + emit altitude(alt); + } else if (entry.contains("track")) { + qreal track = entry.section(":", 1, 1).toDouble(); + emit direction(track); + } else if (entry.contains("speed")) { + qreal currentSpeed = entry.section(":", 1, 1).toDouble(); + emit speed(currentSpeed); } else if (entry.contains("mode")) { // 0: no mode value yet seen // 1: no fix diff --git a/gpsclient.h b/gpsclient.h index 61f359d..dceb0c2 100644 --- a/gpsclient.h +++ b/gpsclient.h @@ -36,6 +36,9 @@ public slots: signals: void position(const QPointF &pos); + void altitude(qreal alt); + void direction(qreal track); + void speed(qreal speed); void connected(); void disconnected();