-rw-r--r-- | noncore/net/wellenreiter/gui/gps.cpp | 66 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/gps.h | 13 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 8 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 9 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.h | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 2 |
6 files changed, 82 insertions, 18 deletions
diff --git a/noncore/net/wellenreiter/gui/gps.cpp b/noncore/net/wellenreiter/gui/gps.cpp index 288afee..31f95ce 100644 --- a/noncore/net/wellenreiter/gui/gps.cpp +++ b/noncore/net/wellenreiter/gui/gps.cpp | |||
@@ -1,69 +1,131 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "gps.h" | 16 | #include "gps.h" |
17 | #include <unistd.h> | ||
18 | 17 | ||
18 | /* QT */ | ||
19 | #include <qtextstream.h> | 19 | #include <qtextstream.h> |
20 | 20 | ||
21 | /* STD */ | ||
22 | #include <stdlib.h> | ||
23 | #include <unistd.h> | ||
24 | |||
21 | GPS::GPS( QObject* parent, const char * name ) | 25 | GPS::GPS( QObject* parent, const char * name ) |
22 | :QObject( parent, name ) | 26 | :QObject( parent, name ) |
23 | { | 27 | { |
24 | qDebug( "GPS::GPS()" ); | 28 | qDebug( "GPS::GPS()" ); |
25 | _socket = new QSocket( this, "gpsd commsock" ); | 29 | _socket = new QSocket( this, "gpsd commsock" ); |
26 | } | 30 | } |
27 | 31 | ||
28 | 32 | ||
29 | GPS::~GPS() | 33 | GPS::~GPS() |
30 | { | 34 | { |
31 | qDebug( "GPS::~GPS()" ); | 35 | qDebug( "GPS::~GPS()" ); |
32 | } | 36 | } |
33 | 37 | ||
34 | 38 | ||
35 | bool GPS::open( const QString& host, int port ) | 39 | bool GPS::open( const QString& host, int port ) |
36 | { | 40 | { |
37 | _socket->connectToHost( host, port ); | 41 | _socket->connectToHost( host, port ); |
38 | } | 42 | } |
39 | 43 | ||
40 | 44 | ||
41 | GpsLocation GPS::position() const | 45 | GpsLocation GPS::position() const |
42 | { | 46 | { |
43 | char buf[256]; | 47 | char buf[256]; |
44 | 48 | ||
45 | int result = _socket->writeBlock( "p\r\n", 3 ); | 49 | int result = _socket->writeBlock( "p\r\n", 3 ); |
46 | _socket->flush(); | 50 | _socket->flush(); |
47 | if ( result ) | 51 | if ( result ) |
48 | { | 52 | { |
49 | int numAvail = _socket->bytesAvailable(); | 53 | int numAvail = _socket->bytesAvailable(); |
50 | qDebug( "GPS write succeeded, %d bytes available for reading...", numAvail ); | 54 | qDebug( "GPS write succeeded, %d bytes available for reading...", numAvail ); |
51 | if ( numAvail ) | 55 | if ( numAvail ) |
52 | { | 56 | { |
53 | QTextStream stream( _socket ); | 57 | QTextStream stream( _socket ); |
54 | 58 | ||
55 | QString str; | 59 | QString str; |
56 | stream.readRawBytes( &buf[0], 7 ); | 60 | stream.readRawBytes( &buf[0], 7 ); |
57 | float lat = -111.111; | 61 | float lat = -111.111; |
58 | stream >> lat; | 62 | stream >> lat; |
59 | stream.skipWhiteSpace(); | 63 | stream.skipWhiteSpace(); |
60 | float lon = -111.111; | 64 | float lon = -111.111; |
61 | stream >> lon; | 65 | stream >> lon; |
62 | 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 |
63 | 67 | ||
64 | return GpsLocation( lat, lon ); | 68 | return GpsLocation( lat, lon ); |
65 | } | 69 | } |
66 | } | 70 | } |
67 | return GpsLocation( -1.0, -1.0 ); | 71 | return GpsLocation( -111.111, -111.111 ); |
68 | } | 72 | } |
69 | 73 | ||
74 | |||
75 | QString GpsLocation::dmsPosition() const | ||
76 | { | ||
77 | if ( _latitude == -111.111 || _longitude == -111.11 ) | ||
78 | return "N/A"; | ||
79 | if ( _latitude == 0.0 && _longitude == 0.0 ) | ||
80 | return "NULL"; | ||
81 | |||
82 | /* compute latitude */ | ||
83 | |||
84 | QString dms = "N"; | ||
85 | if ( _latitude >= 0 ) dms.append( "+" ); | ||
86 | |||
87 | int trunc = int( _latitude ); | ||
88 | float rest = _latitude - trunc; | ||
89 | |||
90 | float minf = rest * 60; | ||
91 | int minutes = int( minf ); | ||
92 | |||
93 | rest = minf - minutes; | ||
94 | int seconds = int( rest * 60 ); | ||
95 | |||
96 | dms.append( QString::number( trunc ) ); | ||
97 | dms.append( "° " ); | ||
98 | dms.append( QString::number( ::abs( minutes ) ) ); | ||
99 | dms.append( "' " ); | ||
100 | dms.append( QString::number( ::abs( seconds ) ) ); | ||
101 | dms.append( "'' " ); | ||
102 | |||
103 | /* compute longitude */ | ||
104 | |||
105 | dms.append( " | W" ); | ||
106 | if ( _longitude > 0 ) dms.append( "+" ); | ||
107 | |||
108 | trunc = int( _longitude ); | ||
109 | rest = _longitude - trunc; | ||
110 | |||
111 | minf = rest * 60; | ||
112 | minutes = int( minf ); | ||
113 | |||
114 | rest = minf - minutes; | ||
115 | seconds = int( rest * 60 ); | ||
116 | |||
117 | dms.append( QString::number( trunc ) ); | ||
118 | dms.append( "° " ); | ||
119 | dms.append( QString::number( ::abs( minutes ) ) ); | ||
120 | dms.append( "' " ); | ||
121 | dms.append( QString::number( ::abs( seconds ) ) ); | ||
122 | dms.append( "'' " ); | ||
123 | |||
124 | return dms; | ||
125 | } | ||
126 | |||
127 | |||
128 | |||
129 | |||
130 | |||
131 | |||
diff --git a/noncore/net/wellenreiter/gui/gps.h b/noncore/net/wellenreiter/gui/gps.h index 8143fe4..cfe1cdb 100644 --- a/noncore/net/wellenreiter/gui/gps.h +++ b/noncore/net/wellenreiter/gui/gps.h | |||
@@ -1,46 +1,51 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #ifndef GPS_H | 16 | #ifndef GPS_H |
17 | #define GPS_H | 17 | #define GPS_H |
18 | 18 | ||
19 | #include <qobject.h> | 19 | #include <qobject.h> |
20 | #include <qsocket.h> | 20 | #include <qsocket.h> |
21 | 21 | ||
22 | struct GpsLocation | 22 | class GpsLocation |
23 | { | 23 | { |
24 | GpsLocation( const float& lat, const float& lon ) : latitude(lat), longitude(lon) {}; | 24 | public: |
25 | GpsLocation( const float& lat, const float& lon ) : _latitude(lat), _longitude(lon) {}; | ||
25 | ~GpsLocation() {}; | 26 | ~GpsLocation() {}; |
26 | float latitude; | 27 | float latitude() const { return _latitude; }; |
27 | float longitude; | 28 | float longitude() const { return _longitude; }; |
29 | QString dmsPosition() const; | ||
30 | private: | ||
31 | float _latitude; | ||
32 | float _longitude; | ||
28 | }; | 33 | }; |
29 | 34 | ||
30 | 35 | ||
31 | class GPS : public QObject | 36 | class GPS : public QObject |
32 | { | 37 | { |
33 | Q_OBJECT | 38 | Q_OBJECT |
34 | 39 | ||
35 | public: | 40 | public: |
36 | GPS( QObject* parent = 0, const char * name = "GPS" ); | 41 | GPS( QObject* parent = 0, const char * name = "GPS" ); |
37 | ~GPS(); | 42 | ~GPS(); |
38 | 43 | ||
39 | bool open( const QString& host = "localhost", int port = 2947 ); | 44 | bool open( const QString& host = "localhost", int port = 2947 ); |
40 | GpsLocation position() const; | 45 | GpsLocation position() const; |
41 | 46 | ||
42 | private: | 47 | private: |
43 | QSocket* _socket; | 48 | QSocket* _socket; |
44 | }; | 49 | }; |
45 | 50 | ||
46 | #endif // GPS_H | 51 | #endif // GPS_H |
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index ca9851c..d4e3279 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp | |||
@@ -203,53 +203,53 @@ void WellenreiterMainWindow::changedSniffingState() | |||
203 | { | 203 | { |
204 | startButton->setEnabled( !mw->sniffing ); | 204 | startButton->setEnabled( !mw->sniffing ); |
205 | menuBar()->setItemEnabled( startID, !mw->sniffing ); | 205 | menuBar()->setItemEnabled( startID, !mw->sniffing ); |
206 | stopButton->setEnabled( mw->sniffing ); | 206 | stopButton->setEnabled( mw->sniffing ); |
207 | menuBar()->setItemEnabled( stopID, mw->sniffing ); | 207 | menuBar()->setItemEnabled( stopID, mw->sniffing ); |
208 | 208 | ||
209 | if ( !mw->sniffing ) | 209 | if ( !mw->sniffing ) |
210 | { | 210 | { |
211 | menuBar()->setItemEnabled( uploadID, true ); | 211 | menuBar()->setItemEnabled( uploadID, true ); |
212 | uploadButton->setEnabled( true ); | 212 | uploadButton->setEnabled( true ); |
213 | } | 213 | } |
214 | } | 214 | } |
215 | 215 | ||
216 | 216 | ||
217 | WellenreiterMainWindow::~WellenreiterMainWindow() | 217 | WellenreiterMainWindow::~WellenreiterMainWindow() |
218 | { | 218 | { |
219 | qDebug( "Wellenreiter:: bye." ); | 219 | qDebug( "Wellenreiter:: bye." ); |
220 | }; | 220 | }; |
221 | 221 | ||
222 | 222 | ||
223 | void WellenreiterMainWindow::demoAddStations() | 223 | void WellenreiterMainWindow::demoAddStations() |
224 | { | 224 | { |
225 | //mw = 0; // test SIGSGV handling | 225 | //mw = 0; // test SIGSGV handling |
226 | 226 | ||
227 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 10.10, 20.20 ) ); | 227 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 39.8794, -94.0936) ); |
228 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) ); | 228 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) ); |
229 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:A0:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) ); | 229 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:03:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) ); |
230 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:AA:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) ); | 230 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:04:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) ); |
231 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:B0:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) ); | 231 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:05:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) ); |
232 | } | 232 | } |
233 | 233 | ||
234 | 234 | ||
235 | QString WellenreiterMainWindow::getFileName( bool save ) | 235 | QString WellenreiterMainWindow::getFileName( bool save ) |
236 | { | 236 | { |
237 | QMap<QString, QStringList> map; | 237 | QMap<QString, QStringList> map; |
238 | map.insert( tr("All"), QStringList() ); | 238 | map.insert( tr("All"), QStringList() ); |
239 | QStringList text; | 239 | QStringList text; |
240 | text << "text/*"; | 240 | text << "text/*"; |
241 | map.insert( tr("Text"), text ); | 241 | map.insert( tr("Text"), text ); |
242 | text << "*"; | 242 | text << "*"; |
243 | map.insert( tr("All"), text ); | 243 | map.insert( tr("All"), text ); |
244 | 244 | ||
245 | QString str; | 245 | QString str; |
246 | if ( save ) | 246 | if ( save ) |
247 | { | 247 | { |
248 | #ifdef QWS | 248 | #ifdef QWS |
249 | str = OFileDialog::getSaveFileName( 2, "/", QString::null, map ); | 249 | str = OFileDialog::getSaveFileName( 2, "/", QString::null, map ); |
250 | #else | 250 | #else |
251 | str = QFileDialog::getSaveFileName(); | 251 | str = QFileDialog::getSaveFileName(); |
252 | #endif | 252 | #endif |
253 | if ( str.isEmpty() /*|| QFileInfo(str).isDir()*/ ) | 253 | if ( str.isEmpty() /*|| QFileInfo(str).isDir()*/ ) |
254 | return ""; | 254 | return ""; |
255 | } | 255 | } |
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 1cca507..d89c71f 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -168,49 +168,49 @@ void MScanListView::addNewItem( const QString& type, | |||
168 | #ifdef DEBUG | 168 | #ifdef DEBUG |
169 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); | 169 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); |
170 | #endif | 170 | #endif |
171 | item->receivedBeacon(); | 171 | item->receivedBeacon(); |
172 | return; | 172 | return; |
173 | } | 173 | } |
174 | } | 174 | } |
175 | else | 175 | else |
176 | { | 176 | { |
177 | s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); | 177 | s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); |
178 | MLogWindow::logwindow()->log( s ); | 178 | MLogWindow::logwindow()->log( s ); |
179 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0 ); | 179 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0 ); |
180 | } | 180 | } |
181 | 181 | ||
182 | 182 | ||
183 | // insert new station as child from network | 183 | // insert new station as child from network |
184 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? | 184 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? |
185 | 185 | ||
186 | #ifdef DEBUG | 186 | #ifdef DEBUG |
187 | qDebug( "inserting new station %s", (const char*) macaddr ); | 187 | qDebug( "inserting new station %s", (const char*) macaddr ); |
188 | #endif | 188 | #endif |
189 | 189 | ||
190 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); | 190 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); |
191 | station->setManufacturer( mac.manufacturer() ); | 191 | station->setManufacturer( mac.manufacturer() ); |
192 | station->setLocation( loc.latitude, loc.longitude ); | 192 | station->setLocation( loc.dmsPosition() ); |
193 | 193 | ||
194 | if ( type == "managed" ) | 194 | if ( type == "managed" ) |
195 | { | 195 | { |
196 | s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); | 196 | s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); |
197 | } | 197 | } |
198 | else | 198 | else |
199 | { | 199 | { |
200 | s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); | 200 | s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); |
201 | } | 201 | } |
202 | MLogWindow::logwindow()->log( s ); | 202 | MLogWindow::logwindow()->log( s ); |
203 | 203 | ||
204 | } | 204 | } |
205 | 205 | ||
206 | 206 | ||
207 | void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) | 207 | void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) |
208 | { | 208 | { |
209 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); | 209 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); |
210 | 210 | ||
211 | while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) | 211 | while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) |
212 | { | 212 | { |
213 | #ifdef DEBUG | 213 | #ifdef DEBUG |
214 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); | 214 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); |
215 | #endif | 215 | #endif |
216 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); | 216 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); |
@@ -512,54 +512,51 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, | |||
512 | listView()->triggerUpdate(); | 512 | listView()->triggerUpdate(); |
513 | 513 | ||
514 | this->type = type; | 514 | this->type = type; |
515 | _type = type; | 515 | _type = type; |
516 | _essid = essid; | 516 | _essid = essid; |
517 | _macaddr = macaddr; | 517 | _macaddr = macaddr; |
518 | _channel = channel; | 518 | _channel = channel; |
519 | _beacons = 1; | 519 | _beacons = 1; |
520 | _signal = 0; | 520 | _signal = 0; |
521 | 521 | ||
522 | if ( WellenreiterConfigWindow::instance()->openTree->isChecked() ) | 522 | if ( WellenreiterConfigWindow::instance()->openTree->isChecked() ) |
523 | { | 523 | { |
524 | listView()->ensureItemVisible( this ); | 524 | listView()->ensureItemVisible( this ); |
525 | } | 525 | } |
526 | 526 | ||
527 | } | 527 | } |
528 | 528 | ||
529 | 529 | ||
530 | void MScanListItem::setManufacturer( const QString& manufacturer ) | 530 | void MScanListItem::setManufacturer( const QString& manufacturer ) |
531 | { | 531 | { |
532 | setText( col_manuf, manufacturer ); | 532 | setText( col_manuf, manufacturer ); |
533 | } | 533 | } |
534 | 534 | ||
535 | 535 | ||
536 | void MScanListItem::setLocation( const float& latitude, const float& longitude ) | 536 | void MScanListItem::setLocation( const QString& location ) |
537 | { | 537 | { |
538 | if ( latitude == 0.0 || longitude == 0.0 ) | 538 | setText( col_location, location ); |
539 | setText( col_location, "N/A" ); | ||
540 | else | ||
541 | setText( col_location, QString().sprintf( "%.2f / %.2f", latitude, longitude ) ); | ||
542 | } | 539 | } |
543 | 540 | ||
544 | 541 | ||
545 | void MScanListItem::playSound( const QString& sound ) const | 542 | void MScanListItem::playSound( const QString& sound ) const |
546 | { | 543 | { |
547 | #ifdef QWS | 544 | #ifdef QWS |
548 | if ( sound == "Ignore" ) return; | 545 | if ( sound == "Ignore" ) return; |
549 | else if ( sound == "Touch" ) ODevice::inst()->touchSound(); | 546 | else if ( sound == "Touch" ) ODevice::inst()->touchSound(); |
550 | else if ( sound == "Key" ) ODevice::inst()->keySound(); | 547 | else if ( sound == "Key" ) ODevice::inst()->keySound(); |
551 | else if ( sound == "Alarm" ) ODevice::inst()->alarmSound(); | 548 | else if ( sound == "Alarm" ) ODevice::inst()->alarmSound(); |
552 | #endif | 549 | #endif |
553 | } | 550 | } |
554 | 551 | ||
555 | 552 | ||
556 | void MScanListItem::receivedBeacon() | 553 | void MScanListItem::receivedBeacon() |
557 | { | 554 | { |
558 | _beacons++; | 555 | _beacons++; |
559 | #ifdef DEBUG | 556 | #ifdef DEBUG |
560 | qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); | 557 | qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); |
561 | #endif | 558 | #endif |
562 | setText( col_sig, QString::number( _beacons ) ); | 559 | setText( col_sig, QString::number( _beacons ) ); |
563 | setText( col_lastseen, QTime::currentTime().toString() ); | 560 | setText( col_lastseen, QTime::currentTime().toString() ); |
564 | 561 | ||
565 | MScanListItem* p = (MScanListItem*) parent(); | 562 | MScanListItem* p = (MScanListItem*) parent(); |
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h index a9b74f1..6cd8fc0 100644 --- a/noncore/net/wellenreiter/gui/scanlist.h +++ b/noncore/net/wellenreiter/gui/scanlist.h | |||
@@ -82,49 +82,49 @@ class MScanListItem: public OListViewItem | |||
82 | bool wep = false, | 82 | bool wep = false, |
83 | int channel = 0, | 83 | int channel = 0, |
84 | int signal = 0 ); | 84 | int signal = 0 ); |
85 | 85 | ||
86 | 86 | ||
87 | protected: | 87 | protected: |
88 | virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); | 88 | virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); |
89 | 89 | ||
90 | public: | 90 | public: |
91 | QString type; | 91 | QString type; |
92 | 92 | ||
93 | public: | 93 | public: |
94 | //const QString& type() { return _type; }; | 94 | //const QString& type() { return _type; }; |
95 | const QString& essid() const; | 95 | const QString& essid() const; |
96 | const QString& macaddr() { return _macaddr; }; | 96 | const QString& macaddr() { return _macaddr; }; |
97 | bool wep() { return _wep; }; | 97 | bool wep() { return _wep; }; |
98 | int channel() { return _channel; }; | 98 | int channel() { return _channel; }; |
99 | int signal() { return _signal; }; | 99 | int signal() { return _signal; }; |
100 | int beacons() { return _beacons; }; | 100 | int beacons() { return _beacons; }; |
101 | 101 | ||
102 | void setSignal( int signal ) { /* TODO */ }; | 102 | void setSignal( int signal ) { /* TODO */ }; |
103 | void receivedBeacon(); | 103 | void receivedBeacon(); |
104 | 104 | ||
105 | void setManufacturer( const QString& manufacturer ); | 105 | void setManufacturer( const QString& manufacturer ); |
106 | void setLocation( const float& latitude, const float& longitude ); | 106 | void setLocation( const QString& location ); |
107 | 107 | ||
108 | virtual OListViewItem* childFactory(); | 108 | virtual OListViewItem* childFactory(); |
109 | virtual void serializeTo( QDataStream& s ) const; | 109 | virtual void serializeTo( QDataStream& s ) const; |
110 | virtual void serializeFrom( QDataStream& s ); | 110 | virtual void serializeFrom( QDataStream& s ); |
111 | 111 | ||
112 | protected: | 112 | protected: |
113 | void playSound( const QString& ) const; | 113 | void playSound( const QString& ) const; |
114 | 114 | ||
115 | private: | 115 | private: |
116 | QString _type; | 116 | QString _type; |
117 | QString _essid; | 117 | QString _essid; |
118 | QString _macaddr; | 118 | QString _macaddr; |
119 | bool _wep; | 119 | bool _wep; |
120 | int _channel; | 120 | int _channel; |
121 | int _signal; | 121 | int _signal; |
122 | int _beacons; | 122 | int _beacons; |
123 | 123 | ||
124 | }; | 124 | }; |
125 | 125 | ||
126 | //****************************** MScanListViewFactory **************************************************************** | 126 | //****************************** MScanListViewFactory **************************************************************** |
127 | 127 | ||
128 | /* | 128 | /* |
129 | 129 | ||
130 | class MScanListViewFactory : public OListViewFactory | 130 | class MScanListViewFactory : public OListViewFactory |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 9255a6d..5575d6e 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -168,49 +168,49 @@ void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) | |||
168 | } | 168 | } |
169 | else if ( beacon->canESS() ) | 169 | else if ( beacon->canESS() ) |
170 | { | 170 | { |
171 | type = "managed"; | 171 | type = "managed"; |
172 | } | 172 | } |
173 | else | 173 | else |
174 | { | 174 | { |
175 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); | 175 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); |
176 | return; | 176 | return; |
177 | } | 177 | } |
178 | 178 | ||
179 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 179 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
180 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); | 180 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); |
181 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 181 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
182 | int channel = ds ? ds->channel() : -1; | 182 | int channel = ds ? ds->channel() : -1; |
183 | 183 | ||
184 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 184 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
185 | 185 | ||
186 | GpsLocation loc( 0, 0 ); | 186 | GpsLocation loc( 0, 0 ); |
187 | if ( configwindow->enableGPS->isChecked() ) | 187 | if ( configwindow->enableGPS->isChecked() ) |
188 | { | 188 | { |
189 | // TODO: add check if GPS is working!? | 189 | // TODO: add check if GPS is working!? |
190 | qDebug( "Wellenreiter::gathering GPS data..." ); | 190 | qDebug( "Wellenreiter::gathering GPS data..." ); |
191 | loc = gps->position(); | 191 | loc = gps->position(); |
192 | qDebug( "Wellenreiter::GPS data received is ( %f , %f )", loc.latitude, loc.longitude ); | 192 | qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); |
193 | } | 193 | } |
194 | 194 | ||
195 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); | 195 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); |
196 | 196 | ||
197 | // update graph window | 197 | // update graph window |
198 | if ( ds ) | 198 | if ( ds ) |
199 | { | 199 | { |
200 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); | 200 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); |
201 | if ( prism ) | 201 | if ( prism ) |
202 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); | 202 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); |
203 | else | 203 | else |
204 | graphwindow->traffic( ds->channel(), 95 ); | 204 | graphwindow->traffic( ds->channel(), 95 ); |
205 | } | 205 | } |
206 | } | 206 | } |
207 | 207 | ||
208 | 208 | ||
209 | void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) | 209 | void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) |
210 | { | 210 | { |
211 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | 211 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); |
212 | if ( wlan->fromDS() && !wlan->toDS() ) | 212 | if ( wlan->fromDS() && !wlan->toDS() ) |
213 | { | 213 | { |
214 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); | 214 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); |
215 | from = wlan->macAddress3(); | 215 | from = wlan->macAddress3(); |
216 | to = wlan->macAddress2(); | 216 | to = wlan->macAddress2(); |