author | mickeyl <mickeyl> | 2003-09-09 13:42:04 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-09-09 13:42:04 (UTC) |
commit | 807165ababca1b8c93b88d6b41f75ec96ce5e799 (patch) (unidiff) | |
tree | 5042886f052d34d7d79bf4e784f87cbad171c86c /noncore/net/wellenreiter/gui/gps.cpp | |
parent | fca4c73a5f0c672db9150f312eb85f1299e80e1b (diff) | |
download | opie-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.cpp | 29 |
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 @@ | |||
17 | #include <unistd.h> | 17 | #include <unistd.h> |
18 | |||
19 | #include <qtextstream.h> | ||
20 | |||
18 | GPS::GPS( QObject* parent, const char * name ) | 21 | GPS::GPS( QObject* parent, const char * name ) |
@@ -37,3 +40,3 @@ bool GPS::open( const QString& host, int port ) | |||
37 | 40 | ||
38 | float GPS::latitude() const | 41 | GpsLocation GPS::position() const |
39 | { | 42 | { |
@@ -49,17 +52,17 @@ float GPS::latitude() const | |||
49 | { | 52 | { |
53 | QTextStream stream( _socket ); | ||
50 | 54 | ||
51 | int num = _socket->readLine( &buf[0], sizeof buf ); | 55 | QString str; |
52 | if ( num ) | 56 | stream.readRawBytes( &buf[0], 7 ); |
53 | { | 57 | float lat = -111.111; |
54 | qDebug( "GPS got %d bytes ['%s']", num, &buf[0] ); | 58 | stream >> lat; |
55 | return 0.0; | 59 | stream.skipWhiteSpace(); |
56 | } | 60 | float lon = -111.111; |
57 | } | 61 | stream >> lon; |
62 | stream.readRawBytes( &buf[0], 200 ); // read and discard the stuff until EOF | ||
63 | |||
64 | return GpsLocation( lat, lon ); | ||
58 | } | 65 | } |
59 | return -1.0; | ||
60 | } | 66 | } |
61 | 67 | return GpsLocation( -1.0, -1.0 ); | |
62 | |||
63 | float GPS::longitute() const | ||
64 | { | ||
65 | } | 68 | } |