summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/gps.cpp
authormickeyl <mickeyl>2003-08-11 19:04:52 (UTC)
committer mickeyl <mickeyl>2003-08-11 19:04:52 (UTC)
commite7f79ca3acf58aef3ff150a2974f8087189621f5 (patch) (unidiff)
treeb8397506f85d9a3b547940e416111de4b2da1f18 /noncore/net/wellenreiter/gui/gps.cpp
parent62cb34a352c38f97967882a7ac604d9670f0e75f (diff)
downloadopie-e7f79ca3acf58aef3ff150a2974f8087189621f5.zip
opie-e7f79ca3acf58aef3ff150a2974f8087189621f5.tar.gz
opie-e7f79ca3acf58aef3ff150a2974f8087189621f5.tar.bz2
assorted fixes and more work on GPS
Diffstat (limited to 'noncore/net/wellenreiter/gui/gps.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/gps.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/noncore/net/wellenreiter/gui/gps.cpp b/noncore/net/wellenreiter/gui/gps.cpp
index c3bff53..4a24647 100644
--- a/noncore/net/wellenreiter/gui/gps.cpp
+++ b/noncore/net/wellenreiter/gui/gps.cpp
@@ -15,3 +15,51 @@
15 15
16#include "gps.h" 16#include "gps.h"
17 17
18GPS::GPS( QObject* parent, const char * name )
19 :QObject( parent, name )
20{
21 qDebug( "GPS::GPS()" );
22 _socket = new QSocket( this, "gpsd commsock" );
23}
24
25
26GPS::~GPS()
27{
28 qDebug( "GPS::~GPS()" );
29}
30
31
32bool GPS::open( const QString& host, int port )
33{
34 _socket->connectToHost( host, port );
35}
36
37
38float GPS::latitude() const
39{
40 char buf[256];
41
42 int result = _socket->writeBlock( "p\r\n", 3 );
43 if ( result )
44 {
45 qDebug( "GPS write succeeded" );
46 _socket->waitForMore( 20 );
47 if ( _socket->canReadLine() )
48 {
49
50 int num = _socket->readLine( &buf[0], sizeof buf );
51 if ( num )
52 {
53 qDebug( "GPS got line: %s", &buf );
54 return 0.0;
55 }
56 }
57 }
58 return -1.0;
59}
60
61
62float GPS::longitute() const
63{
64}
65