summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/gps.cpp
Unidiff
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