summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/gps.cpp
authormickeyl <mickeyl>2003-09-09 13:42:04 (UTC)
committer mickeyl <mickeyl>2003-09-09 13:42:04 (UTC)
commit807165ababca1b8c93b88d6b41f75ec96ce5e799 (patch) (side-by-side diff)
tree5042886f052d34d7d79bf4e784f87cbad171c86c /noncore/net/wellenreiter/gui/gps.cpp
parentfca4c73a5f0c672db9150f312eb85f1299e80e1b (diff)
downloadopie-807165ababca1b8c93b88d6b41f75ec96ce5e799.zip
opie-807165ababca1b8c93b88d6b41f75ec96ce5e799.tar.gz
opie-807165ababca1b8c93b88d6b41f75ec96ce5e799.tar.bz2
reading GPS data from gpsd is now working. TODO: save the data
Diffstat (limited to 'noncore/net/wellenreiter/gui/gps.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/gps.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/noncore/net/wellenreiter/gui/gps.cpp b/noncore/net/wellenreiter/gui/gps.cpp
index 3206655..288afee 100644
--- a/noncore/net/wellenreiter/gui/gps.cpp
+++ b/noncore/net/wellenreiter/gui/gps.cpp
@@ -17,2 +17,5 @@
#include <unistd.h>
+
+#include <qtextstream.h>
+
GPS::GPS( QObject* parent, const char * name )
@@ -37,3 +40,3 @@ bool GPS::open( const QString& host, int port )
-float GPS::latitude() const
+GpsLocation GPS::position() const
{
@@ -49,17 +52,17 @@ float GPS::latitude() const
{
+ QTextStream stream( _socket );
- int num = _socket->readLine( &buf[0], sizeof buf );
- if ( num )
- {
- qDebug( "GPS got %d bytes ['%s']", num, &buf[0] );
- return 0.0;
- }
- }
+ QString str;
+ stream.readRawBytes( &buf[0], 7 );
+ float lat = -111.111;
+ stream >> lat;
+ stream.skipWhiteSpace();
+ float lon = -111.111;
+ stream >> lon;
+ stream.readRawBytes( &buf[0], 200 ); // read and discard the stuff until EOF
+
+ return GpsLocation( lat, lon );
}
- return -1.0;
}
-
-
-float GPS::longitute() const
-{
+ return GpsLocation( -1.0, -1.0 );
}