author | mickeyl <mickeyl> | 2004-02-15 15:28:27 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-02-15 15:28:27 (UTC) |
commit | 4f5703de93628ec6920957ef18d6cd5c87a69ba1 (patch) (unidiff) | |
tree | 674e0d5eeb30ccf52dd5f0491522e651c2383116 /noncore/net/wellenreiter/gui/gps.cpp | |
parent | 3d50523ac7782e08795fabb071c8678d79a71b13 (diff) | |
download | opie-4f5703de93628ec6920957ef18d6cd5c87a69ba1.zip opie-4f5703de93628ec6920957ef18d6cd5c87a69ba1.tar.gz opie-4f5703de93628ec6920957ef18d6cd5c87a69ba1.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'noncore/net/wellenreiter/gui/gps.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/gps.cpp | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/noncore/net/wellenreiter/gui/gps.cpp b/noncore/net/wellenreiter/gui/gps.cpp index b814427..5b1b4a4 100644 --- a/noncore/net/wellenreiter/gui/gps.cpp +++ b/noncore/net/wellenreiter/gui/gps.cpp | |||
@@ -47,2 +47,4 @@ GpsLocation GPS::position() const | |||
47 | char buf[256]; | 47 | char buf[256]; |
48 | double lat = -111.0; | ||
49 | double lon = -111.0; | ||
48 | 50 | ||
@@ -55,15 +57,15 @@ GpsLocation GPS::position() const | |||
55 | if ( numAvail ) | 57 | if ( numAvail ) |
56 | { | 58 | { |
57 | QTextStream stream( _socket ); | 59 | int numRead = _socket->readBlock( &buf[0], sizeof buf ); |
58 | 60 | int numScan = sscanf( &buf[0], "GPSD,P=%lg %lg", &lat, &lon); | |
59 | QString str; | 61 | |
60 | stream.readRawBytes( &buf[0], 7 ); | 62 | if ( numRead < 7 || numScan != 2 ) |
61 | float lat = -111; | 63 | { |
62 | stream >> lat; | 64 | qDebug( "GPS read %d bytes succeeded, invalid response: '%s'", numRead, &buf[0] ); |
63 | stream.skipWhiteSpace(); | 65 | return GpsLocation( -111, -111 ); |
64 | float lon = -111; | 66 | } |
65 | stream >> lon; | 67 | else |
66 | stream.readRawBytes( &buf[0], 200 ); // read and discard the stuff until EOF | 68 | { |
67 | 69 | return GpsLocation( lat, lon ); | |
68 | return GpsLocation( lat, lon ); | 70 | } |
69 | } | 71 | } |
@@ -125,7 +127 @@ QString GpsLocation::dmsPosition() const | |||
125 | } | } | |
126 | |||
127 | |||
128 | |||
129 | |||
130 | |||
131 | |||