author | mickeyl <mickeyl> | 2004-01-07 23:04:55 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-01-07 23:04:55 (UTC) |
commit | cfb7335c5b65a79f5817b393e5a8b3345558f220 (patch) (unidiff) | |
tree | a8d2d2bcc0bd29a6aac7fec7325f058f148d466e /noncore/net/wellenreiter/gui/gps.cpp | |
parent | c4d6574e85f74d6086c1709ecf0d117df7417222 (diff) | |
download | opie-cfb7335c5b65a79f5817b393e5a8b3345558f220.zip opie-cfb7335c5b65a79f5817b393e5a8b3345558f220.tar.gz opie-cfb7335c5b65a79f5817b393e5a8b3345558f220.tar.bz2 |
A bunch of miscellaneous changes and improvements. read the ChangeLog :)
Oh and it's WIP - not everything mentioned there works already. Will soon, though.
Diffstat (limited to 'noncore/net/wellenreiter/gui/gps.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/gps.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/net/wellenreiter/gui/gps.cpp b/noncore/net/wellenreiter/gui/gps.cpp index 31f95ce..b814427 100644 --- a/noncore/net/wellenreiter/gui/gps.cpp +++ b/noncore/net/wellenreiter/gui/gps.cpp | |||
@@ -49,41 +49,41 @@ GpsLocation GPS::position() const | |||
49 | int result = _socket->writeBlock( "p\r\n", 3 ); | 49 | int result = _socket->writeBlock( "p\r\n", 3 ); |
50 | _socket->flush(); | 50 | _socket->flush(); |
51 | if ( result ) | 51 | if ( result ) |
52 | { | 52 | { |
53 | int numAvail = _socket->bytesAvailable(); | 53 | int numAvail = _socket->bytesAvailable(); |
54 | qDebug( "GPS write succeeded, %d bytes available for reading...", numAvail ); | 54 | qDebug( "GPS write succeeded, %d bytes available for reading...", numAvail ); |
55 | if ( numAvail ) | 55 | if ( numAvail ) |
56 | { | 56 | { |
57 | QTextStream stream( _socket ); | 57 | QTextStream stream( _socket ); |
58 | 58 | ||
59 | QString str; | 59 | QString str; |
60 | stream.readRawBytes( &buf[0], 7 ); | 60 | stream.readRawBytes( &buf[0], 7 ); |
61 | float lat = -111.111; | 61 | float lat = -111; |
62 | stream >> lat; | 62 | stream >> lat; |
63 | stream.skipWhiteSpace(); | 63 | stream.skipWhiteSpace(); |
64 | float lon = -111.111; | 64 | float lon = -111; |
65 | stream >> lon; | 65 | stream >> lon; |
66 | stream.readRawBytes( &buf[0], 200 ); // read and discard the stuff until EOF | 66 | stream.readRawBytes( &buf[0], 200 ); // read and discard the stuff until EOF |
67 | 67 | ||
68 | return GpsLocation( lat, lon ); | 68 | return GpsLocation( lat, lon ); |
69 | } | 69 | } |
70 | } | 70 | } |
71 | return GpsLocation( -111.111, -111.111 ); | 71 | return GpsLocation( -111, -111 ); |
72 | } | 72 | } |
73 | 73 | ||
74 | 74 | ||
75 | QString GpsLocation::dmsPosition() const | 75 | QString GpsLocation::dmsPosition() const |
76 | { | 76 | { |
77 | if ( _latitude == -111.111 || _longitude == -111.11 ) | 77 | if ( _latitude == -111 || _longitude == -111 ) |
78 | return "N/A"; | 78 | return "N/A"; |
79 | if ( _latitude == 0.0 && _longitude == 0.0 ) | 79 | if ( _latitude == 0.0 && _longitude == 0.0 ) |
80 | return "NULL"; | 80 | return "NULL"; |
81 | 81 | ||
82 | /* compute latitude */ | 82 | /* compute latitude */ |
83 | 83 | ||
84 | QString dms = "N"; | 84 | QString dms = "N"; |
85 | if ( _latitude >= 0 ) dms.append( "+" ); | 85 | if ( _latitude >= 0 ) dms.append( "+" ); |
86 | 86 | ||
87 | int trunc = int( _latitude ); | 87 | int trunc = int( _latitude ); |
88 | float rest = _latitude - trunc; | 88 | float rest = _latitude - trunc; |
89 | 89 | ||