summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/gps.cpp29
-rw-r--r--noncore/net/wellenreiter/gui/gps.h12
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp11
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp21
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.h6
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp8
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiterbase.cpp4
7 files changed, 64 insertions, 27 deletions
diff --git a/noncore/net/wellenreiter/gui/gps.cpp b/noncore/net/wellenreiter/gui/gps.cpp
index 3206655..288afee 100644
--- a/noncore/net/wellenreiter/gui/gps.cpp
+++ b/noncore/net/wellenreiter/gui/gps.cpp
@@ -2,65 +2,68 @@
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> 17#include <unistd.h>
18
19#include <qtextstream.h>
20
18GPS::GPS( QObject* parent, const char * name ) 21GPS::GPS( QObject* parent, const char * name )
19 :QObject( parent, name ) 22 :QObject( parent, name )
20{ 23{
21 qDebug( "GPS::GPS()" ); 24 qDebug( "GPS::GPS()" );
22 _socket = new QSocket( this, "gpsd commsock" ); 25 _socket = new QSocket( this, "gpsd commsock" );
23} 26}
24 27
25 28
26GPS::~GPS() 29GPS::~GPS()
27{ 30{
28 qDebug( "GPS::~GPS()" ); 31 qDebug( "GPS::~GPS()" );
29} 32}
30 33
31 34
32bool GPS::open( const QString& host, int port ) 35bool GPS::open( const QString& host, int port )
33{ 36{
34 _socket->connectToHost( host, port ); 37 _socket->connectToHost( host, port );
35} 38}
36 39
37 40
38float GPS::latitude() const 41GpsLocation GPS::position() const
39{ 42{
40 char buf[256]; 43 char buf[256];
41 44
42 int result = _socket->writeBlock( "p\r\n", 3 ); 45 int result = _socket->writeBlock( "p\r\n", 3 );
43 _socket->flush(); 46 _socket->flush();
44 if ( result ) 47 if ( result )
45 { 48 {
46 int numAvail = _socket->bytesAvailable(); 49 int numAvail = _socket->bytesAvailable();
47 qDebug( "GPS write succeeded, %d bytes available for reading...", numAvail ); 50 qDebug( "GPS write succeeded, %d bytes available for reading...", numAvail );
48 if ( numAvail ) 51 if ( numAvail )
49 { 52 {
53 QTextStream stream( _socket );
50 54
51 int num = _socket->readLine( &buf[0], sizeof buf ); 55 QString str;
52 if ( num ) 56 stream.readRawBytes( &buf[0], 7 );
53 { 57 float lat = -111.111;
54 qDebug( "GPS got %d bytes ['%s']", num, &buf[0] ); 58 stream >> lat;
55 return 0.0; 59 stream.skipWhiteSpace();
56 } 60 float lon = -111.111;
61 stream >> lon;
62 stream.readRawBytes( &buf[0], 200 ); // read and discard the stuff until EOF
63
64 return GpsLocation( lat, lon );
57 } 65 }
58 } 66 }
59 return -1.0; 67 return GpsLocation( -1.0, -1.0 );
60}
61
62
63float GPS::longitute() const
64{
65} 68}
66 69
diff --git a/noncore/net/wellenreiter/gui/gps.h b/noncore/net/wellenreiter/gui/gps.h
index ad0b6de..8143fe4 100644
--- a/noncore/net/wellenreiter/gui/gps.h
+++ b/noncore/net/wellenreiter/gui/gps.h
@@ -6,33 +6,41 @@
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
22struct GpsLocation
23{
24 GpsLocation( const float& lat, const float& lon ) : latitude(lat), longitude(lon) {};
25 ~GpsLocation() {};
26 float latitude;
27 float longitude;
28};
29
30
22class GPS : public QObject 31class GPS : public QObject
23{ 32{
24 Q_OBJECT 33 Q_OBJECT
25 34
26 public: 35 public:
27 GPS( QObject* parent = 0, const char * name = "GPS" ); 36 GPS( QObject* parent = 0, const char * name = "GPS" );
28 ~GPS(); 37 ~GPS();
29 38
30 bool open( const QString& host = "localhost", int port = 2947 ); 39 bool open( const QString& host = "localhost", int port = 2947 );
31 float latitude() const; 40 GpsLocation position() const;
32 float longitute() const;
33 41
34 private: 42 private:
35 QSocket* _socket; 43 QSocket* _socket;
36}; 44};
37 45
38#endif // GPS_H 46#endif // GPS_H
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp
index 27ecae3..868b0b0 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.cpp
+++ b/noncore/net/wellenreiter/gui/mainwindow.cpp
@@ -1,32 +1,33 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 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 "configwindow.h" 16#include "configwindow.h"
17#include "gps.h"
17#include "logwindow.h" 18#include "logwindow.h"
18#include "hexwindow.h" 19#include "hexwindow.h"
19#include "mainwindow.h" 20#include "mainwindow.h"
20#include "wellenreiter.h" 21#include "wellenreiter.h"
21#include "scanlist.h" 22#include "scanlist.h"
22 23
23#include <qcombobox.h> 24#include <qcombobox.h>
24#include <qdatastream.h> 25#include <qdatastream.h>
25#include <qfile.h> 26#include <qfile.h>
26#include <qfileinfo.h> 27#include <qfileinfo.h>
27#include <qiconset.h> 28#include <qiconset.h>
28#include <qmenubar.h> 29#include <qmenubar.h>
29#include <qmessagebox.h> 30#include <qmessagebox.h>
30#include <qpopupmenu.h> 31#include <qpopupmenu.h>
31#include <qstatusbar.h> 32#include <qstatusbar.h>
32#include <qtextstream.h> 33#include <qtextstream.h>
@@ -205,37 +206,37 @@ void WellenreiterMainWindow::changedSniffingState()
205 menuBar()->setItemEnabled( stopID, mw->sniffing ); 206 menuBar()->setItemEnabled( stopID, mw->sniffing );
206} 207}
207 208
208 209
209WellenreiterMainWindow::~WellenreiterMainWindow() 210WellenreiterMainWindow::~WellenreiterMainWindow()
210{ 211{
211 delete infoIconSet; 212 delete infoIconSet;
212 delete settingsIconSet; 213 delete settingsIconSet;
213 delete startIconSet; 214 delete startIconSet;
214 delete stopIconSet; 215 delete stopIconSet;
215}; 216};
216 217
217void WellenreiterMainWindow::demoAddStations() 218void WellenreiterMainWindow::demoAddStations()
218{ 219{
219 //mw = 0; // test SIGSGV handling 220 //mw = 0; // test SIGSGV handling
220 221
221 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80 ); 222 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 10.10, 20.20 ) );
222 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10 ); 223 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) );
223 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:A0:F8:E7:16:22"), false, 3, 10 ); 224 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:A0:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) );
224 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:AA:01:E7:56:62"), false, 3, 15 ); 225 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:AA:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) );
225 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:B0:8E:E7:56:E2"), false, 3, 20 ); 226 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:B0:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) );
226} 227}
227 228
228 229
229QString WellenreiterMainWindow::getFileName( bool save ) 230QString WellenreiterMainWindow::getFileName( bool save )
230{ 231{
231 QMap<QString, QStringList> map; 232 QMap<QString, QStringList> map;
232 map.insert( tr("All"), QStringList() ); 233 map.insert( tr("All"), QStringList() );
233 QStringList text; 234 QStringList text;
234 text << "text/*"; 235 text << "text/*";
235 map.insert( tr("Text"), text ); 236 map.insert( tr("Text"), text );
236 text << "*"; 237 text << "*";
237 map.insert( tr("All"), text ); 238 map.insert( tr("All"), text );
238 239
239 QString str; 240 QString str;
240 if ( save ) 241 if ( save )
241 { 242 {
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index f4cfe52..d695c17 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -34,60 +34,63 @@ using namespace Opie;
34#include <qpe/resource.h> 34#include <qpe/resource.h>
35#else 35#else
36#include "resource.h" 36#include "resource.h"
37#endif 37#endif
38 38
39const int col_type = 0; 39const int col_type = 0;
40const int col_essid = 0; 40const int col_essid = 0;
41const int col_sig = 1; 41const int col_sig = 1;
42const int col_ap = 2; 42const int col_ap = 2;
43const int col_channel = 3; 43const int col_channel = 3;
44const int col_wep = 4; 44const int col_wep = 4;
45const int col_traffic = 5; 45const int col_traffic = 5;
46const int col_ip = 6; 46const int col_ip = 6;
47const int col_manuf = 7; 47const int col_manuf = 7;
48const int col_firstseen = 8; 48const int col_firstseen = 8;
49const int col_lastseen = 9; 49const int col_lastseen = 9;
50const int col_location = 10;
50 51
51MScanListView::MScanListView( QWidget* parent, const char* name ) 52MScanListView::MScanListView( QWidget* parent, const char* name )
52 :OListView( parent, name ) 53 :OListView( parent, name )
53{ 54{
54 55
55 setFrameShape( QListView::StyledPanel ); 56 setFrameShape( QListView::StyledPanel );
56 setFrameShadow( QListView::Sunken ); 57 setFrameShadow( QListView::Sunken );
57 58
58 addColumn( tr( "Net/Station" ) ); 59 addColumn( tr( "Net/Station" ) );
59 setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); 60 setColumnAlignment( col_essid, AlignLeft || AlignVCenter );
60 addColumn( tr( "#" ) ); 61 addColumn( tr( "#" ) );
61 setColumnAlignment( col_sig, AlignCenter ); 62 setColumnAlignment( col_sig, AlignCenter );
62 addColumn( tr( "MAC" ) ); 63 addColumn( tr( "MAC" ) );
63 setColumnAlignment( col_ap, AlignCenter ); 64 setColumnAlignment( col_ap, AlignCenter );
64 addColumn( tr( "Chn" ) ); 65 addColumn( tr( "Chn" ) );
65 setColumnAlignment( col_channel, AlignCenter ); 66 setColumnAlignment( col_channel, AlignCenter );
66 addColumn( tr( "W" ) ); 67 addColumn( tr( "W" ) );
67 setColumnAlignment( col_wep, AlignCenter ); 68 setColumnAlignment( col_wep, AlignCenter );
68 addColumn( tr( "T" ) ); 69 addColumn( tr( "T" ) );
69 setColumnAlignment( col_traffic, AlignCenter ); 70 setColumnAlignment( col_traffic, AlignCenter );
70 addColumn( tr( "IP" ) ); 71 addColumn( tr( "IP" ) );
71 setColumnAlignment( col_ip, AlignCenter ); 72 setColumnAlignment( col_ip, AlignCenter );
72 addColumn( tr( "Manufacturer" ) ); 73 addColumn( tr( "Manufacturer" ) );
73 setColumnAlignment( col_manuf, AlignCenter ); 74 setColumnAlignment( col_manuf, AlignCenter );
74 addColumn( tr( "First Seen" ) ); 75 addColumn( tr( "First Seen" ) );
75 setColumnAlignment( col_firstseen, AlignCenter ); 76 setColumnAlignment( col_firstseen, AlignCenter );
76 addColumn( tr( "Last Seen" ) ); 77 addColumn( tr( "Last Seen" ) );
77 setColumnAlignment( col_lastseen, AlignCenter ); 78 setColumnAlignment( col_lastseen, AlignCenter );
79 addColumn( tr( "Location" ) );
80 setColumnAlignment( col_location, AlignCenter );
78 setRootIsDecorated( true ); 81 setRootIsDecorated( true );
79 setAllColumnsShowFocus( true ); 82 setAllColumnsShowFocus( true );
80 83
81 connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), 84 connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ),
82 this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); 85 this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) );
83 86
84 #ifdef QWS 87 #ifdef QWS
85 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 88 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
86 #endif 89 #endif
87 90
88}; 91};
89 92
90 93
91MScanListView::~MScanListView() 94MScanListView::~MScanListView()
92{ 95{
93}; 96};
@@ -100,33 +103,39 @@ OListViewItem* MScanListView::childFactory()
100 103
101 104
102void MScanListView::serializeTo( QDataStream& s) const 105void MScanListView::serializeTo( QDataStream& s) const
103{ 106{
104 qDebug( "serializing MScanListView" ); 107 qDebug( "serializing MScanListView" );
105 OListView::serializeTo( s ); 108 OListView::serializeTo( s );
106} 109}
107 110
108 111
109void MScanListView::serializeFrom( QDataStream& s) 112void MScanListView::serializeFrom( QDataStream& s)
110{ 113{
111 qDebug( "serializing MScanListView" ); 114 qDebug( "serializing MScanListView" );
112 OListView::serializeFrom( s ); 115 OListView::serializeFrom( s );
113} 116}
114 117
115 118
116void MScanListView::addNewItem( const QString& type, const QString& essid, const OMacAddress& mac, bool wep, int channel, int signal ) 119void MScanListView::addNewItem( const QString& type,
120 const QString& essid,
121 const OMacAddress& mac,
122 bool wep,
123 int channel,
124 int signal,
125 const GpsLocation& loc )
117{ 126{
118 QString macaddr = mac.toString(true); 127 QString macaddr = mac.toString(true);
119 128
120 #ifdef DEBUG 129 #ifdef DEBUG
121 qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", (const char*) type, 130 qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", (const char*) type,
122 (const char*) essid, (const char*) macaddr, channel ); 131 (const char*) essid, (const char*) macaddr, channel );
123 #endif 132 #endif
124 133
125 // search, if we already have seen this net 134 // search, if we already have seen this net
126 135
127 QString s; 136 QString s;
128 MScanListItem* network; 137 MScanListItem* network;
129 MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); 138 MScanListItem* item = static_cast<MScanListItem*> ( firstChild() );
130 139
131 while ( item && ( item->text( col_essid ) != essid ) ) 140 while ( item && ( item->text( col_essid ) != essid ) )
132 { 141 {
@@ -166,32 +175,33 @@ void MScanListView::addNewItem( const QString& type, const QString& essid, const
166 { 175 {
167 s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); 176 s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid );
168 MLogWindow::logwindow()->log( s ); 177 MLogWindow::logwindow()->log( s );
169 network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0 ); 178 network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0 );
170 } 179 }
171 180
172 181
173 // insert new station as child from network 182 // insert new station as child from network
174 // no essid to reduce clutter, maybe later we have a nick or stationname to display!? 183 // no essid to reduce clutter, maybe later we have a nick or stationname to display!?
175 184
176 #ifdef DEBUG 185 #ifdef DEBUG
177 qDebug( "inserting new station %s", (const char*) macaddr ); 186 qDebug( "inserting new station %s", (const char*) macaddr );
178 #endif 187 #endif
179 188
180 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); 189 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal );
181 station->setManufacturer( mac.manufacturer() ); 190 station->setManufacturer( mac.manufacturer() );
191 station->setLocation( loc.latitude, loc.longitude );
182 192
183 if ( type == "managed" ) 193 if ( type == "managed" )
184 { 194 {
185 s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); 195 s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel );
186 } 196 }
187 else 197 else
188 { 198 {
189 s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); 199 s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel );
190 } 200 }
191 MLogWindow::logwindow()->log( s ); 201 MLogWindow::logwindow()->log( s );
192 202
193} 203}
194 204
195 205
196void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) 206void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type )
197{ 207{
@@ -455,32 +465,41 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr,
455 this->type = type; 465 this->type = type;
456 _type = type; 466 _type = type;
457 _essid = essid; 467 _essid = essid;
458 _macaddr = macaddr; 468 _macaddr = macaddr;
459 _channel = channel; 469 _channel = channel;
460 _beacons = 1; 470 _beacons = 1;
461 _signal = 0; 471 _signal = 0;
462} 472}
463 473
464 474
465void MScanListItem::setManufacturer( const QString& manufacturer ) 475void MScanListItem::setManufacturer( const QString& manufacturer )
466{ 476{
467 setText( col_manuf, manufacturer ); 477 setText( col_manuf, manufacturer );
468} 478}
469 479
470 480
481void MScanListItem::setLocation( const float& latitude, const float& longitude )
482{
483 if ( latitude == 0.0 || longitude == 0.0 )
484 setText( col_location, "N/A" );
485 else
486 setText( col_location, QString().sprintf( "%.2f / %.2f", latitude, longitude ) );
487}
488
489
471void MScanListItem::playSound( const QString& sound ) const 490void MScanListItem::playSound( const QString& sound ) const
472{ 491{
473 #ifdef QWS 492 #ifdef QWS
474 if ( sound == "Ignore" ) return; 493 if ( sound == "Ignore" ) return;
475 else if ( sound == "Touch" ) ODevice::inst()->touchSound(); 494 else if ( sound == "Touch" ) ODevice::inst()->touchSound();
476 else if ( sound == "Key" ) ODevice::inst()->keySound(); 495 else if ( sound == "Key" ) ODevice::inst()->keySound();
477 else if ( sound == "Alarm" ) ODevice::inst()->alarmSound(); 496 else if ( sound == "Alarm" ) ODevice::inst()->alarmSound();
478 #endif 497 #endif
479} 498}
480 499
481 500
482void MScanListItem::receivedBeacon() 501void MScanListItem::receivedBeacon()
483{ 502{
484 _beacons++; 503 _beacons++;
485 #ifdef DEBUG 504 #ifdef DEBUG
486 qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); 505 qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons );
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h
index 5aba0d2..2703b6a 100644
--- a/noncore/net/wellenreiter/gui/scanlist.h
+++ b/noncore/net/wellenreiter/gui/scanlist.h
@@ -3,56 +3,59 @@
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 SCANLIST_H 16#ifndef SCANLIST_H
17#define SCANLIST_H 17#define SCANLIST_H
18 18
19#include "gps.h"
20
19/* OPIE */ 21/* OPIE */
20#include <opie2/olistview.h> 22#include <opie2/olistview.h>
21#include <opie2/onetutils.h> 23#include <opie2/onetutils.h>
22 24
23/* QT */ 25/* QT */
24#include <qtextstream.h> 26#include <qtextstream.h>
25 27
26class QString; 28class QString;
27class MScanListItem; 29class MScanListItem;
28 30
29class MScanListView: public OListView 31class MScanListView: public OListView
30{ 32{
31 Q_OBJECT 33 Q_OBJECT
32 34
33 public: 35 public:
34 MScanListView( QWidget* parent = 0, const char* name = 0 ); 36 MScanListView( QWidget* parent = 0, const char* name = 0 );
35 virtual ~MScanListView(); 37 virtual ~MScanListView();
36 38
37 virtual OListViewItem* childFactory(); 39 virtual OListViewItem* childFactory();
38 virtual void serializeTo( QDataStream& s ) const; 40 virtual void serializeTo( QDataStream& s ) const;
39 virtual void serializeFrom( QDataStream& s ); 41 virtual void serializeFrom( QDataStream& s );
40 42
41 public slots: 43 public slots:
42 void addNewItem( const QString& type, const QString& essid, const OMacAddress& macaddr, bool wep, int channel, int signal ); 44 void addNewItem( const QString& type, const QString& essid, const OMacAddress& macaddr, bool wep, int channel, int signal, const GpsLocation& location );
45
43 void fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ); 46 void fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via );
44 void toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ); 47 void toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via );
45 void WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ); 48 void WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo );
46 void IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ); 49 void IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via );
47 50
48 void identify( const OMacAddress&, const QString& ipaddr ); 51 void identify( const OMacAddress&, const QString& ipaddr );
49 52
50 void contextMenuRequested( QListViewItem* item, const QPoint&, int ); 53 void contextMenuRequested( QListViewItem* item, const QPoint&, int );
51 54
52 signals: 55 signals:
53 void rightButtonClicked(QListViewItem*,const QPoint&,int); 56 void rightButtonClicked(QListViewItem*,const QPoint&,int);
54 void joinNetwork( const QString&, const QString&, int, const QString& ); 57 void joinNetwork( const QString&, const QString&, int, const QString& );
55 58
56 protected: 59 protected:
57 void addIfNotExisting( MScanListItem* parent, const OMacAddress& addr, const QString& type = "station" ); 60 void addIfNotExisting( MScanListItem* parent, const OMacAddress& addr, const QString& type = "station" );
58 61
@@ -86,32 +89,33 @@ class MScanListItem: public OListViewItem
86 public: 89 public:
87 QString type; 90 QString type;
88 91
89 public: 92 public:
90 //const QString& type() { return _type; }; 93 //const QString& type() { return _type; };
91 const QString& essid() const; 94 const QString& essid() const;
92 const QString& macaddr() { return _macaddr; }; 95 const QString& macaddr() { return _macaddr; };
93 bool wep() { return _wep; }; 96 bool wep() { return _wep; };
94 int channel() { return _channel; }; 97 int channel() { return _channel; };
95 int signal() { return _signal; }; 98 int signal() { return _signal; };
96 int beacons() { return _beacons; }; 99 int beacons() { return _beacons; };
97 100
98 void setSignal( int signal ) { /* TODO */ }; 101 void setSignal( int signal ) { /* TODO */ };
99 void receivedBeacon(); 102 void receivedBeacon();
100 103
101 void setManufacturer( const QString& manufacturer ); 104 void setManufacturer( const QString& manufacturer );
105 void setLocation( const float& latitude, const float& longitude );
102 106
103 virtual OListViewItem* childFactory(); 107 virtual OListViewItem* childFactory();
104 virtual void serializeTo( QDataStream& s ) const; 108 virtual void serializeTo( QDataStream& s ) const;
105 virtual void serializeFrom( QDataStream& s ); 109 virtual void serializeFrom( QDataStream& s );
106 110
107 protected: 111 protected:
108 void playSound( const QString& ) const; 112 void playSound( const QString& ) const;
109 113
110 private: 114 private:
111 QString _type; 115 QString _type;
112 QString _essid; 116 QString _essid;
113 QString _macaddr; 117 QString _macaddr;
114 bool _wep; 118 bool _wep;
115 int _channel; 119 int _channel;
116 int _signal; 120 int _signal;
117 int _beacons; 121 int _beacons;
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index c03debb..5dc2e79 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -158,40 +158,42 @@ void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon )
158 { 158 {
159 type = "managed"; 159 type = "managed";
160 } 160 }
161 else 161 else
162 { 162 {
163 qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); 163 qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" );
164 return; 164 return;
165 } 165 }
166 166
167 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); 167 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
168 QString essid = ssid ? ssid->ID() : QString("<unknown>"); 168 QString essid = ssid ? ssid->ID() : QString("<unknown>");
169 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); 169 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
170 int channel = ds ? ds->channel() : -1; 170 int channel = ds ? ds->channel() : -1;
171 171
172 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 172 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
173 173
174 GpsLocation loc( 0, 0 );
174 if ( configwindow->enableGPS->isChecked() ) 175 if ( configwindow->enableGPS->isChecked() )
175 { 176 {
177 // TODO: add check if GPS is working!?
176 qDebug( "Wellenreiter::gathering GPS data..." ); 178 qDebug( "Wellenreiter::gathering GPS data..." );
177 float lat = gps->latitude(); 179 loc = gps->position();
178 qDebug( "Wellenreiter::GPS data received is ( %f , %f )", lat, 0.0 ); 180 qDebug( "Wellenreiter::GPS data received is ( %f , %f )", loc.latitude, loc.longitude );
179 } 181 }
180 182
181 netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0 ); 183 netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc );
182 184
183 // update graph window 185 // update graph window
184 if ( ds ) 186 if ( ds )
185 { 187 {
186 OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); 188 OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) );
187 if ( prism ) 189 if ( prism )
188 graphwindow->traffic( ds->channel(), prism->signalStrength() ); 190 graphwindow->traffic( ds->channel(), prism->signalStrength() );
189 else 191 else
190 graphwindow->traffic( ds->channel(), 95 ); 192 graphwindow->traffic( ds->channel(), 95 );
191 } 193 }
192} 194}
193 195
194 196
195void Wellenreiter::handleData( OPacket* p, OWaveLanDataPacket* data ) 197void Wellenreiter::handleData( OPacket* p, OWaveLanDataPacket* data )
196{ 198{
197 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); 199 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" );
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
index 36fbb9a..eac5d89 100644
--- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
@@ -110,36 +110,36 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f
110 PixmapLabel1_3_2->setLineWidth( 2 ); 110 PixmapLabel1_3_2->setLineWidth( 2 );
111 PixmapLabel1_3_2->setMargin( 0 ); 111 PixmapLabel1_3_2->setMargin( 0 );
112 PixmapLabel1_3_2->setMidLineWidth( 0 ); 112 PixmapLabel1_3_2->setMidLineWidth( 0 );
113 PixmapLabel1_3_2->setPixmap( Resource::loadPixmap( "wellenreiter/logo" ) ); 113 PixmapLabel1_3_2->setPixmap( Resource::loadPixmap( "wellenreiter/logo" ) );
114 PixmapLabel1_3_2->setScaledContents( TRUE ); 114 PixmapLabel1_3_2->setScaledContents( TRUE );
115 PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) ); 115 PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) );
116 116
117 aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 ); 117 aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 );
118 118
119 TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" ); 119 TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" );
120 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); 120 QFont TextLabel1_4_2_font( TextLabel1_4_2->font() );
121 TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); 121 TextLabel1_4_2_font.setFamily( "adobe-helvetica" );
122 TextLabel1_4_2_font.setPointSize( 10 ); 122 TextLabel1_4_2_font.setPointSize( 10 );
123 TextLabel1_4_2->setFont( TextLabel1_4_2_font ); 123 TextLabel1_4_2->setFont( TextLabel1_4_2_font );
124 TextLabel1_4_2->setText( tr( "<p align=center>\n" 124 TextLabel1_4_2->setText( tr( "<p align=center>\n"
125"<hr>\n" 125"<hr>\n"
126"Michael 'Mickey' Lauer<br><hr>\n"
126"Max Moser<br>\n" 127"Max Moser<br>\n"
127"Martin J. Muench<br>\n" 128"Martin J. Muench<br>\n"
128"Michael Lauer<br><hr>\n" 129"<b>www.wellenreiter.net</b>\n"
129"<b>www.remote-exploit.org</b>\n"
130"</p>" ) ); 130"</p>" ) );
131 TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) ); 131 TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) );
132 132
133 aboutLayout->addWidget( TextLabel1_4_2, 1, 0 ); 133 aboutLayout->addWidget( TextLabel1_4_2, 1, 0 );
134 134
135#ifdef QWS 135#ifdef QWS
136 TabWidget->addTab( ap, "wellenreiter/networks", tr( "Nets" ) ); 136 TabWidget->addTab( ap, "wellenreiter/networks", tr( "Nets" ) );
137 TabWidget->addTab( graphwindow, "wellenreiter/graph", tr( "Graph" ) ); 137 TabWidget->addTab( graphwindow, "wellenreiter/graph", tr( "Graph" ) );
138 TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); 138 TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) );
139 TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); 139 TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) );
140 TabWidget->addTab( statwindow, "wellenreiter/stat", tr( "Stat" ) ); 140 TabWidget->addTab( statwindow, "wellenreiter/stat", tr( "Stat" ) );
141 TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); 141 TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) );
142#else 142#else
143 TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) ); 143 TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) );
144 TabWidget->addTab( graphwindow, /* "wellenreiter/graph", */ tr( "Graph" ) ); 144 TabWidget->addTab( graphwindow, /* "wellenreiter/graph", */ tr( "Graph" ) );
145 TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) ); 145 TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) );