author | mickeyl <mickeyl> | 2004-02-15 18:54:55 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-02-15 18:54:55 (UTC) |
commit | ef7f95fa147c7675999b091c76b081029c415d19 (patch) (unidiff) | |
tree | 5563bb2697fa1764814adf28c276f310f069c05d /noncore/net | |
parent | 842923f72761677ea132c16a23091c5ee3a35780 (diff) | |
download | opie-ef7f95fa147c7675999b091c76b081029c415d19.zip opie-ef7f95fa147c7675999b091c76b081029c415d19.tar.gz opie-ef7f95fa147c7675999b091c76b081029c415d19.tar.bz2 |
default gps speed now 4800 - seems to be more compatible
-rw-r--r-- | noncore/net/wellenreiter/gui/configbase.ui | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/gps.cpp | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 9 |
3 files changed, 8 insertions, 5 deletions
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui index de6abfc..469effe 100644 --- a/noncore/net/wellenreiter/gui/configbase.ui +++ b/noncore/net/wellenreiter/gui/configbase.ui | |||
@@ -1383,25 +1383,25 @@ | |||
1383 | <widget> | 1383 | <widget> |
1384 | <class>QLineEdit</class> | 1384 | <class>QLineEdit</class> |
1385 | <property stdset="1"> | 1385 | <property stdset="1"> |
1386 | <name>name</name> | 1386 | <name>name</name> |
1387 | <cstring>commandGPS</cstring> | 1387 | <cstring>commandGPS</cstring> |
1388 | </property> | 1388 | </property> |
1389 | <property stdset="1"> | 1389 | <property stdset="1"> |
1390 | <name>enabled</name> | 1390 | <name>enabled</name> |
1391 | <bool>false</bool> | 1391 | <bool>false</bool> |
1392 | </property> | 1392 | </property> |
1393 | <property stdset="1"> | 1393 | <property stdset="1"> |
1394 | <name>text</name> | 1394 | <name>text</name> |
1395 | <string>gpsd -p /dev/ttyS3 -s 57600</string> | 1395 | <string>gpsd -p /dev/ttyS3 -s 4800</string> |
1396 | </property> | 1396 | </property> |
1397 | </widget> | 1397 | </widget> |
1398 | <spacer> | 1398 | <spacer> |
1399 | <property> | 1399 | <property> |
1400 | <name>name</name> | 1400 | <name>name</name> |
1401 | <cstring>Spacer4_2</cstring> | 1401 | <cstring>Spacer4_2</cstring> |
1402 | </property> | 1402 | </property> |
1403 | <property stdset="1"> | 1403 | <property stdset="1"> |
1404 | <name>orientation</name> | 1404 | <name>orientation</name> |
1405 | <enum>Vertical</enum> | 1405 | <enum>Vertical</enum> |
1406 | </property> | 1406 | </property> |
1407 | <property stdset="1"> | 1407 | <property stdset="1"> |
diff --git a/noncore/net/wellenreiter/gui/gps.cpp b/noncore/net/wellenreiter/gui/gps.cpp index 5b1b4a4..b845aa1 100644 --- a/noncore/net/wellenreiter/gui/gps.cpp +++ b/noncore/net/wellenreiter/gui/gps.cpp | |||
@@ -48,25 +48,25 @@ GpsLocation GPS::position() const | |||
48 | double lat = -111.0; | 48 | double lat = -111.0; |
49 | double lon = -111.0; | 49 | double lon = -111.0; |
50 | 50 | ||
51 | int result = _socket->writeBlock( "p\r\n", 3 ); | 51 | int result = _socket->writeBlock( "p\r\n", 3 ); |
52 | _socket->flush(); | 52 | _socket->flush(); |
53 | if ( result ) | 53 | if ( result ) |
54 | { | 54 | { |
55 | int numAvail = _socket->bytesAvailable(); | 55 | int numAvail = _socket->bytesAvailable(); |
56 | qDebug( "GPS write succeeded, %d bytes available for reading...", numAvail ); | 56 | qDebug( "GPS write succeeded, %d bytes available for reading...", numAvail ); |
57 | if ( numAvail ) | 57 | if ( numAvail ) |
58 | { | 58 | { |
59 | int numRead = _socket->readBlock( &buf[0], sizeof buf ); | 59 | int numRead = _socket->readBlock( &buf[0], sizeof buf ); |
60 | int numScan = sscanf( &buf[0], "GPSD,P=%lg %lg", &lat, &lon); | 60 | int numScan = ::sscanf( &buf[0], "GPSD,P=%lg %lg", &lat, &lon); |
61 | 61 | ||
62 | if ( numRead < 7 || numScan != 2 ) | 62 | if ( numRead < 7 || numScan != 2 ) |
63 | { | 63 | { |
64 | qDebug( "GPS read %d bytes succeeded, invalid response: '%s'", numRead, &buf[0] ); | 64 | qDebug( "GPS read %d bytes succeeded, invalid response: '%s'", numRead, &buf[0] ); |
65 | return GpsLocation( -111, -111 ); | 65 | return GpsLocation( -111, -111 ); |
66 | } | 66 | } |
67 | else | 67 | else |
68 | { | 68 | { |
69 | return GpsLocation( lat, lon ); | 69 | return GpsLocation( lat, lon ); |
70 | } | 70 | } |
71 | } | 71 | } |
72 | } | 72 | } |
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 72624f7..3729ed0 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp | |||
@@ -39,24 +39,26 @@ | |||
39 | #include <qtoolbutton.h> | 39 | #include <qtoolbutton.h> |
40 | 40 | ||
41 | #ifdef QWS | 41 | #ifdef QWS |
42 | #include <qpe/resource.h> | 42 | #include <qpe/resource.h> |
43 | #include <opie2/ofiledialog.h> | 43 | #include <opie2/ofiledialog.h> |
44 | using namespace Opie; | 44 | using namespace Opie; |
45 | #else | 45 | #else |
46 | #include "resource.h" | 46 | #include "resource.h" |
47 | #include <qapplication.h> | 47 | #include <qapplication.h> |
48 | #include <qfiledialog.h> | 48 | #include <qfiledialog.h> |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | #include <unistd.h> | ||
52 | |||
51 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) | 53 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) |
52 | :QMainWindow( parent, name, f ) | 54 | :QMainWindow( parent, name, f ) |
53 | { | 55 | { |
54 | cw = new WellenreiterConfigWindow( this ); | 56 | cw = new WellenreiterConfigWindow( this ); |
55 | mw = new Wellenreiter( this ); | 57 | mw = new Wellenreiter( this ); |
56 | mw->setConfigWindow( cw ); | 58 | mw->setConfigWindow( cw ); |
57 | setCentralWidget( mw ); | 59 | setCentralWidget( mw ); |
58 | 60 | ||
59 | // setup application icon | 61 | // setup application icon |
60 | 62 | ||
61 | #ifndef QWS | 63 | #ifndef QWS |
62 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); | 64 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); |
@@ -125,25 +127,25 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
125 | view->insertItem( tr( "&Configure..." ) ); | 127 | view->insertItem( tr( "&Configure..." ) ); |
126 | 128 | ||
127 | QPopupMenu* sniffer = new QPopupMenu( mb ); | 129 | QPopupMenu* sniffer = new QPopupMenu( mb ); |
128 | sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) ); | 130 | sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) ); |
129 | sniffer->insertSeparator(); | 131 | sniffer->insertSeparator(); |
130 | startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) ); | 132 | startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) ); |
131 | sniffer->setItemEnabled( startID, false ); | 133 | sniffer->setItemEnabled( startID, false ); |
132 | stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) ); | 134 | stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) ); |
133 | sniffer->setItemEnabled( stopID, false ); | 135 | sniffer->setItemEnabled( stopID, false ); |
134 | 136 | ||
135 | QPopupMenu* demo = new QPopupMenu( mb ); | 137 | QPopupMenu* demo = new QPopupMenu( mb ); |
136 | demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) ); | 138 | demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) ); |
137 | demo->insertItem( tr( "&Read from GPSd" ), this, SLOT( demoReadFromGps() ) ); | 139 | //demo->insertItem( tr( "&Read from GPSd" ), this, SLOT( demoReadFromGps() ) ); |
138 | 140 | ||
139 | id = mb->insertItem( tr( "&File" ), file ); | 141 | id = mb->insertItem( tr( "&File" ), file ); |
140 | //id = mb->insertItem( tr( "&View" ), view ); | 142 | //id = mb->insertItem( tr( "&View" ), view ); |
141 | //mb->setItemEnabled( id, false ); | 143 | //mb->setItemEnabled( id, false ); |
142 | id = mb->insertItem( tr( "&Sniffer" ), sniffer ); | 144 | id = mb->insertItem( tr( "&Sniffer" ), sniffer ); |
143 | 145 | ||
144 | id = mb->insertItem( tr( "&Demo" ), demo ); | 146 | id = mb->insertItem( tr( "&Demo" ), demo ); |
145 | mb->setItemEnabled( id, true ); | 147 | mb->setItemEnabled( id, true ); |
146 | mb->setItemEnabled( uploadID, false ); | 148 | mb->setItemEnabled( uploadID, false ); |
147 | 149 | ||
148 | #ifdef QWS | 150 | #ifdef QWS |
149 | mb->insertItem( startButton ); | 151 | mb->insertItem( startButton ); |
@@ -210,48 +212,49 @@ void WellenreiterMainWindow::changedSniffingState() | |||
210 | menuBar()->setItemEnabled( stopID, mw->sniffing ); | 212 | menuBar()->setItemEnabled( stopID, mw->sniffing ); |
211 | 213 | ||
212 | if ( !mw->sniffing ) | 214 | if ( !mw->sniffing ) |
213 | { | 215 | { |
214 | menuBar()->setItemEnabled( uploadID, true ); | 216 | menuBar()->setItemEnabled( uploadID, true ); |
215 | uploadButton->setEnabled( true ); | 217 | uploadButton->setEnabled( true ); |
216 | } | 218 | } |
217 | } | 219 | } |
218 | 220 | ||
219 | 221 | ||
220 | WellenreiterMainWindow::~WellenreiterMainWindow() | 222 | WellenreiterMainWindow::~WellenreiterMainWindow() |
221 | { | 223 | { |
222 | qDebug( "Wellenreiter:: bye." ); | 224 | qDebug( "Wellenreiter: bye." ); |
223 | }; | 225 | }; |
224 | 226 | ||
225 | 227 | ||
226 | void WellenreiterMainWindow::demoAddStations() | 228 | void WellenreiterMainWindow::demoAddStations() |
227 | { | 229 | { |
228 | //mw = 0; // test SIGSEGV handling | 230 | //mw = 0; // test SIGSEGV handling |
229 | 231 | ||
230 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 39.8794, -94.0936) ); | 232 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 39.8794, -94.0936) ); |
231 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) ); | 233 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) ); |
232 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:03:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) ); | 234 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:03:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) ); |
233 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:04:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) ); | 235 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:04:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) ); |
234 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:05:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) ); | 236 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:05:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) ); |
235 | } | 237 | } |
236 | 238 | ||
237 | 239 | ||
238 | void WellenreiterMainWindow::demoReadFromGps() | 240 | void WellenreiterMainWindow::demoReadFromGps() |
239 | { | 241 | { |
240 | WellenreiterConfigWindow* configwindow = WellenreiterConfigWindow::instance(); | 242 | WellenreiterConfigWindow* configwindow = WellenreiterConfigWindow::instance(); |
241 | GPS* gps = new GPS( this ); | 243 | GPS* gps = new GPS( this ); |
244 | qDebug( "Wellenreiter::demoReadFromGps(): url=gps://%s:%d/", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); | ||
242 | gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); | 245 | gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); |
243 | GpsLocation loc = gps->position(); | 246 | GpsLocation loc = gps->position(); |
244 | |||
245 | QMessageBox::information( this, "Wellenreiter/Opie", tr( "GPS said:\n%1" ).arg( loc.dmsPosition() ) ); | 247 | QMessageBox::information( this, "Wellenreiter/Opie", tr( "GPS said:\n%1" ).arg( loc.dmsPosition() ) ); |
248 | delete gps; | ||
246 | } | 249 | } |
247 | 250 | ||
248 | 251 | ||
249 | QString WellenreiterMainWindow::getFileName( bool save ) | 252 | QString WellenreiterMainWindow::getFileName( bool save ) |
250 | { | 253 | { |
251 | QMap<QString, QStringList> map; | 254 | QMap<QString, QStringList> map; |
252 | map.insert( tr("All"), QStringList() ); | 255 | map.insert( tr("All"), QStringList() ); |
253 | QStringList text; | 256 | QStringList text; |
254 | text << "text/*"; | 257 | text << "text/*"; |
255 | map.insert( tr("Text"), text ); | 258 | map.insert( tr("Text"), text ); |
256 | text << "*"; | 259 | text << "*"; |
257 | map.insert( tr("All"), text ); | 260 | map.insert( tr("All"), text ); |