summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -1,66 +1,69 @@
/**********************************************************************
** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved.
**
** This file is part of Opie Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#include "gps.h"
#include <unistd.h>
+
+#include <qtextstream.h>
+
GPS::GPS( QObject* parent, const char * name )
:QObject( parent, name )
{
qDebug( "GPS::GPS()" );
_socket = new QSocket( this, "gpsd commsock" );
}
GPS::~GPS()
{
qDebug( "GPS::~GPS()" );
}
bool GPS::open( const QString& host, int port )
{
_socket->connectToHost( host, port );
}
-float GPS::latitude() const
+GpsLocation GPS::position() const
{
char buf[256];
int result = _socket->writeBlock( "p\r\n", 3 );
_socket->flush();
if ( result )
{
int numAvail = _socket->bytesAvailable();
qDebug( "GPS write succeeded, %d bytes available for reading...", numAvail );
if ( numAvail )
{
+ QTextStream stream( _socket );
- int num = _socket->readLine( &buf[0], sizeof buf );
- if ( num )
- {
- qDebug( "GPS got %d bytes ['%s']", num, &buf[0] );
- return 0.0;
- }
+ QString str;
+ stream.readRawBytes( &buf[0], 7 );
+ float lat = -111.111;
+ stream >> lat;
+ stream.skipWhiteSpace();
+ float lon = -111.111;
+ stream >> lon;
+ stream.readRawBytes( &buf[0], 200 ); // read and discard the stuff until EOF
+
+ return GpsLocation( lat, lon );
}
}
- return -1.0;
-}
-
-
-float GPS::longitute() const
-{
+ return GpsLocation( -1.0, -1.0 );
}
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
@@ -1,38 +1,46 @@
/**********************************************************************
** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved.
**
** This file is part of Opie Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#ifndef GPS_H
#define GPS_H
#include <qobject.h>
#include <qsocket.h>
+struct GpsLocation
+{
+ GpsLocation( const float& lat, const float& lon ) : latitude(lat), longitude(lon) {};
+ ~GpsLocation() {};
+ float latitude;
+ float longitude;
+};
+
+
class GPS : public QObject
{
Q_OBJECT
public:
GPS( QObject* parent = 0, const char * name = "GPS" );
~GPS();
bool open( const QString& host = "localhost", int port = 2947 );
- float latitude() const;
- float longitute() const;
+ GpsLocation position() const;
private:
QSocket* _socket;
};
#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,64 +1,65 @@
/**********************************************************************
** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
**
** This file is part of Opie Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#include "configwindow.h"
+#include "gps.h"
#include "logwindow.h"
#include "hexwindow.h"
#include "mainwindow.h"
#include "wellenreiter.h"
#include "scanlist.h"
#include <qcombobox.h>
#include <qdatastream.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qiconset.h>
#include <qmenubar.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qstatusbar.h>
#include <qtextstream.h>
#include <qtoolbutton.h>
#ifdef QWS
#include <qpe/resource.h>
#include <opie/ofiledialog.h>
#else
#include "resource.h"
#include <qapplication.h>
#include <qfiledialog.h>
#endif
WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f )
:QMainWindow( parent, name, f )
{
cw = new WellenreiterConfigWindow( this );
mw = new Wellenreiter( this );
mw->setConfigWindow( cw );
setCentralWidget( mw );
// setup application icon
#ifndef QWS
setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) );
setIconText( "Wellenreiter/X11" );
#endif
// setup icon sets
infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) );
settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) );
startIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) );
stopIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) );
@@ -173,101 +174,101 @@ void WellenreiterMainWindow::showConfigure()
cw->showMaximized();
#endif
int result = cw->exec();
if ( result ) updateToolButtonState();
}
void WellenreiterMainWindow::updateToolButtonState()
{
const QString& interface = cw->interfaceName->currentText();
const int cardtype = cw->driverType();
if ( ( interface != "<select>" ) && ( cardtype != 0 ) )
{
startButton->setEnabled( true );
menuBar()->setItemEnabled( startID, true );
}
else
{
startButton->setEnabled( false );
menuBar()->setItemEnabled( startID, false );
}
}
void WellenreiterMainWindow::changedSniffingState()
{
startButton->setEnabled( !mw->sniffing );
menuBar()->setItemEnabled( startID, !mw->sniffing );
stopButton->setEnabled( mw->sniffing );
menuBar()->setItemEnabled( stopID, mw->sniffing );
}
WellenreiterMainWindow::~WellenreiterMainWindow()
{
delete infoIconSet;
delete settingsIconSet;
delete startIconSet;
delete stopIconSet;
};
void WellenreiterMainWindow::demoAddStations()
{
//mw = 0; // test SIGSGV handling
- mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80 );
- mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10 );
- mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:A0:F8:E7:16:22"), false, 3, 10 );
- mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:AA:01:E7:56:62"), false, 3, 15 );
- mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:B0:8E:E7:56:E2"), false, 3, 20 );
+ mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 10.10, 20.20 ) );
+ mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) );
+ mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:A0:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) );
+ mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:AA:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) );
+ mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:B0:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) );
}
QString WellenreiterMainWindow::getFileName( bool save )
{
QMap<QString, QStringList> map;
map.insert( tr("All"), QStringList() );
QStringList text;
text << "text/*";
map.insert( tr("Text"), text );
text << "*";
map.insert( tr("All"), text );
QString str;
if ( save )
{
#ifdef QWS
str = OFileDialog::getSaveFileName( 2, "/", QString::null, map );
#else
str = QFileDialog::getSaveFileName();
#endif
if ( str.isEmpty() /*|| QFileInfo(str).isDir()*/ )
return "";
}
else
{
#ifdef QWS
str = OFileDialog::getOpenFileName( 2, "/", QString::null, map );
#else
str = QFileDialog::getOpenFileName();
#endif
if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() )
return "";
}
return str;
}
void WellenreiterMainWindow::fileSaveLog()
{
QString fname = getFileName( true );
if ( !fname.isEmpty() )
{
QFile f( fname );
if ( f.open(IO_WriteOnly) )
{
QTextStream t( &f );
t << mw->logWindow()->getLog();
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
@@ -2,228 +2,238 @@
** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
**
** This file is part of Opie Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#include "scanlist.h"
#include "configwindow.h"
#include "logwindow.h"
#include <assert.h>
#include <qcursor.h>
#include <qdatetime.h>
#include <qtextstream.h>
#include <qpopupmenu.h>
#ifdef QWS
#include <qpe/qpeapplication.h>
#include <opie/odevice.h>
using namespace Opie;
#endif
#ifdef QWS
#include <qpe/resource.h>
#else
#include "resource.h"
#endif
const int col_type = 0;
const int col_essid = 0;
const int col_sig = 1;
const int col_ap = 2;
const int col_channel = 3;
const int col_wep = 4;
const int col_traffic = 5;
const int col_ip = 6;
const int col_manuf = 7;
const int col_firstseen = 8;
const int col_lastseen = 9;
+const int col_location = 10;
MScanListView::MScanListView( QWidget* parent, const char* name )
:OListView( parent, name )
{
setFrameShape( QListView::StyledPanel );
setFrameShadow( QListView::Sunken );
addColumn( tr( "Net/Station" ) );
setColumnAlignment( col_essid, AlignLeft || AlignVCenter );
addColumn( tr( "#" ) );
setColumnAlignment( col_sig, AlignCenter );
addColumn( tr( "MAC" ) );
setColumnAlignment( col_ap, AlignCenter );
addColumn( tr( "Chn" ) );
setColumnAlignment( col_channel, AlignCenter );
addColumn( tr( "W" ) );
setColumnAlignment( col_wep, AlignCenter );
addColumn( tr( "T" ) );
setColumnAlignment( col_traffic, AlignCenter );
addColumn( tr( "IP" ) );
setColumnAlignment( col_ip, AlignCenter );
addColumn( tr( "Manufacturer" ) );
setColumnAlignment( col_manuf, AlignCenter );
addColumn( tr( "First Seen" ) );
setColumnAlignment( col_firstseen, AlignCenter );
addColumn( tr( "Last Seen" ) );
setColumnAlignment( col_lastseen, AlignCenter );
+ addColumn( tr( "Location" ) );
+ setColumnAlignment( col_location, AlignCenter );
setRootIsDecorated( true );
setAllColumnsShowFocus( true );
connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ),
this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) );
#ifdef QWS
QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
#endif
};
MScanListView::~MScanListView()
{
};
OListViewItem* MScanListView::childFactory()
{
return new MScanListItem( this );
}
void MScanListView::serializeTo( QDataStream& s) const
{
qDebug( "serializing MScanListView" );
OListView::serializeTo( s );
}
void MScanListView::serializeFrom( QDataStream& s)
{
qDebug( "serializing MScanListView" );
OListView::serializeFrom( s );
}
-void MScanListView::addNewItem( const QString& type, const QString& essid, const OMacAddress& mac, bool wep, int channel, int signal )
+void MScanListView::addNewItem( const QString& type,
+ const QString& essid,
+ const OMacAddress& mac,
+ bool wep,
+ int channel,
+ int signal,
+ const GpsLocation& loc )
{
QString macaddr = mac.toString(true);
#ifdef DEBUG
qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", (const char*) type,
(const char*) essid, (const char*) macaddr, channel );
#endif
// search, if we already have seen this net
QString s;
MScanListItem* network;
MScanListItem* item = static_cast<MScanListItem*> ( firstChild() );
while ( item && ( item->text( col_essid ) != essid ) )
{
#ifdef DEBUG
qDebug( "itemtext: %s", (const char*) item->text( col_essid ) );
#endif
item = static_cast<MScanListItem*> ( item->nextSibling() );
}
if ( item )
{
// we have already seen this net, check all childs if MAC exists
network = item;
item = static_cast<MScanListItem*> ( item->firstChild() );
assert( item ); // this shouldn't fail
while ( item && ( item->text( col_ap ) != macaddr ) )
{
#ifdef DEBUG
qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) );
#endif
item = static_cast<MScanListItem*> ( item->nextSibling() );
}
if ( item )
{
// we have already seen this item, it's a dupe
#ifdef DEBUG
qDebug( "%s is a dupe - ignoring...", (const char*) macaddr );
#endif
item->receivedBeacon();
return;
}
}
else
{
s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid );
MLogWindow::logwindow()->log( s );
network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0 );
}
// insert new station as child from network
// no essid to reduce clutter, maybe later we have a nick or stationname to display!?
#ifdef DEBUG
qDebug( "inserting new station %s", (const char*) macaddr );
#endif
MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal );
station->setManufacturer( mac.manufacturer() );
+ station->setLocation( loc.latitude, loc.longitude );
if ( type == "managed" )
{
s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel );
}
else
{
s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel );
}
MLogWindow::logwindow()->log( s );
}
void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type )
{
MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() );
while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) )
{
#ifdef DEBUG
qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) );
#endif
subitem = static_cast<MScanListItem*> ( subitem->nextSibling() );
}
if ( subitem )
{
// we have already seen this item, it's a dupe
#ifdef DEBUG
qDebug( "%s is a dupe - ignoring...", (const char*) addr.toString(true) );
#endif
subitem->receivedBeacon(); //FIXME: sent data bit
return;
}
// Hey, it seems to be a new item :-D
MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 );
station->setManufacturer( addr.manufacturer() );
QString s;
if ( type == "station" )
{
s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) );
}
else
{
s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) );
@@ -423,73 +433,82 @@ void MScanListItem::serializeFrom( QDataStream& s )
void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal )
{
#ifdef DEBUG
qDebug( "decorating scanlist item %s / %s / %s [%d]",
(const char*) type,
(const char*) essid,
(const char*) macaddr,
channel );
#endif
// set icon for managed or adhoc mode
QString name;
name.sprintf( "wellenreiter/%s", (const char*) type );
setPixmap( col_type, Resource::loadPixmap( name ) );
// set icon for wep (wireless encryption protocol)
if ( wep )
setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap!
// set channel and signal text
if ( signal != -1 )
setText( col_sig, QString::number( signal ) );
if ( channel != -1 )
setText( col_channel, QString::number( channel ) );
setText( col_firstseen, QTime::currentTime().toString() );
//setText( col_lastseen, QTime::currentTime().toString() );
listView()->triggerUpdate();
this->type = type;
_type = type;
_essid = essid;
_macaddr = macaddr;
_channel = channel;
_beacons = 1;
_signal = 0;
}
void MScanListItem::setManufacturer( const QString& manufacturer )
{
setText( col_manuf, manufacturer );
}
+void MScanListItem::setLocation( const float& latitude, const float& longitude )
+{
+ if ( latitude == 0.0 || longitude == 0.0 )
+ setText( col_location, "N/A" );
+ else
+ setText( col_location, QString().sprintf( "%.2f / %.2f", latitude, longitude ) );
+}
+
+
void MScanListItem::playSound( const QString& sound ) const
{
#ifdef QWS
if ( sound == "Ignore" ) return;
else if ( sound == "Touch" ) ODevice::inst()->touchSound();
else if ( sound == "Key" ) ODevice::inst()->keySound();
else if ( sound == "Alarm" ) ODevice::inst()->alarmSound();
#endif
}
void MScanListItem::receivedBeacon()
{
_beacons++;
#ifdef DEBUG
qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons );
#endif
setText( col_sig, QString::number( _beacons ) );
setText( col_lastseen, QTime::currentTime().toString() );
MScanListItem* p = (MScanListItem*) parent();
if ( p ) p->receivedBeacon();
}
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
@@ -1,137 +1,141 @@
/**********************************************************************
** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
**
** This file is part of Opie Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#ifndef SCANLIST_H
#define SCANLIST_H
+#include "gps.h"
+
/* OPIE */
#include <opie2/olistview.h>
#include <opie2/onetutils.h>
/* QT */
#include <qtextstream.h>
class QString;
class MScanListItem;
class MScanListView: public OListView
{
Q_OBJECT
public:
MScanListView( QWidget* parent = 0, const char* name = 0 );
virtual ~MScanListView();
virtual OListViewItem* childFactory();
virtual void serializeTo( QDataStream& s ) const;
virtual void serializeFrom( QDataStream& s );
public slots:
- void addNewItem( const QString& type, const QString& essid, const OMacAddress& macaddr, bool wep, int channel, int signal );
+ void addNewItem( const QString& type, const QString& essid, const OMacAddress& macaddr, bool wep, int channel, int signal, const GpsLocation& location );
+
void fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via );
void toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via );
void WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo );
void IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via );
void identify( const OMacAddress&, const QString& ipaddr );
void contextMenuRequested( QListViewItem* item, const QPoint&, int );
signals:
void rightButtonClicked(QListViewItem*,const QPoint&,int);
void joinNetwork( const QString&, const QString&, int, const QString& );
protected:
void addIfNotExisting( MScanListItem* parent, const OMacAddress& addr, const QString& type = "station" );
};
//****************************** MScanListItem ****************************************************************
class MScanListItem: public OListViewItem
{
public:
MScanListItem::MScanListItem( QListView* parent,
QString type = "unknown",
QString essid = "unknown",
QString macaddr = "unknown",
bool wep = false,
int channel = 0,
int signal = 0 );
MScanListItem::MScanListItem( QListViewItem* parent,
QString type = "unknown",
QString essid = "unknown",
QString macaddr = "unknown",
bool wep = false,
int channel = 0,
int signal = 0 );
protected:
virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal );
public:
QString type;
public:
//const QString& type() { return _type; };
const QString& essid() const;
const QString& macaddr() { return _macaddr; };
bool wep() { return _wep; };
int channel() { return _channel; };
int signal() { return _signal; };
int beacons() { return _beacons; };
void setSignal( int signal ) { /* TODO */ };
void receivedBeacon();
void setManufacturer( const QString& manufacturer );
+ void setLocation( const float& latitude, const float& longitude );
virtual OListViewItem* childFactory();
virtual void serializeTo( QDataStream& s ) const;
virtual void serializeFrom( QDataStream& s );
protected:
void playSound( const QString& ) const;
private:
QString _type;
QString _essid;
QString _macaddr;
bool _wep;
int _channel;
int _signal;
int _beacons;
};
//****************************** MScanListViewFactory ****************************************************************
/*
class MScanListViewFactory : public OListViewFactory
{
public:
virtual QListView* listViewFactory();
virtual QListViewItem* listViewItemFactory( QListView* lv );
virtual QListViewItem* listViewItemFactory( QListViewItem* lvi );
virtual void setColumnText( int depth, QListViewItem* lvi, int column, const QString& text );
virtual void setCustomData( int depth, QListViewItem* lvi, const QString& text );
}
*/
#endif
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
@@ -126,104 +126,106 @@ void Wellenreiter::channelHopped(int c)
void Wellenreiter::handleNotification( OPacket* p )
{
QObjectList* l = p->queryList();
QObjectListIt it( *l );
QObject* o;
while ( (o = it.current()) != 0 )
{
QString name = it.current()->name();
if ( configwindow->parsePackets->isProtocolChecked( name ) )
{
QString action = configwindow->parsePackets->protocolAction( name );
qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action );
doAction( action, name, p );
}
else
{
qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name );
}
++it;
}
}
void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon )
{
QString type;
if ( beacon->canIBSS() )
{
type = "adhoc";
}
else if ( beacon->canESS() )
{
type = "managed";
}
else
{
qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" );
return;
}
OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
QString essid = ssid ? ssid->ID() : QString("<unknown>");
OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
int channel = ds ? ds->channel() : -1;
OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
+ GpsLocation loc( 0, 0 );
if ( configwindow->enableGPS->isChecked() )
{
+ // TODO: add check if GPS is working!?
qDebug( "Wellenreiter::gathering GPS data..." );
- float lat = gps->latitude();
- qDebug( "Wellenreiter::GPS data received is ( %f , %f )", lat, 0.0 );
+ loc = gps->position();
+ qDebug( "Wellenreiter::GPS data received is ( %f , %f )", loc.latitude, loc.longitude );
}
- netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0 );
+ netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc );
// update graph window
if ( ds )
{
OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) );
if ( prism )
graphwindow->traffic( ds->channel(), prism->signalStrength() );
else
graphwindow->traffic( ds->channel(), 95 );
}
}
void Wellenreiter::handleData( OPacket* p, OWaveLanDataPacket* data )
{
OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" );
if ( wlan->fromDS() && !wlan->toDS() )
{
netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() );
}
else if ( !wlan->fromDS() && wlan->toDS() )
{
netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() );
}
else if ( wlan->fromDS() && wlan->toDS() )
{
netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() );
}
else
{
netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() );
}
OARPPacket* arp = (OARPPacket*) p->child( "ARP" );
if ( arp )
{
qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() );
if ( arp->type() == "REQUEST" )
{
netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() );
}
else if ( arp->type() == "REPLY" )
{
netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() );
netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() );
}
}
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
@@ -78,100 +78,100 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f
//--------- NETVIEW TAB --------------
netview = new MScanListView( ap );
apLayout->addWidget( netview );
//--------- GRAPH TAB --------------
graphwindow = new MGraphWindow( TabWidget, "Graph" );
//--------- LOG TAB --------------
logwindow = new MLogWindow( TabWidget, "Log" );
//--------- HEX TAB --------------
hexwindow = new MHexWindow( TabWidget, "Hex" );
//--------- STAT TAB --------------
statwindow = new MStatWindow( TabWidget, "Stat" );
//--------- ABOUT TAB --------------
about = new QWidget( TabWidget, "about" );
aboutLayout = new QGridLayout( about );
aboutLayout->setSpacing( 6 );
aboutLayout->setMargin( 11 );
PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" );
PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) );
PixmapLabel1_3_2->setFrameShape( QLabel::Panel );
PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken );
PixmapLabel1_3_2->setLineWidth( 2 );
PixmapLabel1_3_2->setMargin( 0 );
PixmapLabel1_3_2->setMidLineWidth( 0 );
PixmapLabel1_3_2->setPixmap( Resource::loadPixmap( "wellenreiter/logo" ) );
PixmapLabel1_3_2->setScaledContents( TRUE );
PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) );
aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 );
TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" );
QFont TextLabel1_4_2_font( TextLabel1_4_2->font() );
TextLabel1_4_2_font.setFamily( "adobe-helvetica" );
TextLabel1_4_2_font.setPointSize( 10 );
TextLabel1_4_2->setFont( TextLabel1_4_2_font );
TextLabel1_4_2->setText( tr( "<p align=center>\n"
"<hr>\n"
+"Michael 'Mickey' Lauer<br><hr>\n"
"Max Moser<br>\n"
"Martin J. Muench<br>\n"
-"Michael Lauer<br><hr>\n"
-"<b>www.remote-exploit.org</b>\n"
+"<b>www.wellenreiter.net</b>\n"
"</p>" ) );
TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) );
aboutLayout->addWidget( TextLabel1_4_2, 1, 0 );
#ifdef QWS
TabWidget->addTab( ap, "wellenreiter/networks", tr( "Nets" ) );
TabWidget->addTab( graphwindow, "wellenreiter/graph", tr( "Graph" ) );
TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) );
TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) );
TabWidget->addTab( statwindow, "wellenreiter/stat", tr( "Stat" ) );
TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) );
#else
TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) );
TabWidget->addTab( graphwindow, /* "wellenreiter/graph", */ tr( "Graph" ) );
TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) );
TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) );
TabWidget->addTab( statwindow, /* "wellenreiter/hex", */ tr( "Stat" ) );
TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) );
#endif
WellenreiterBaseLayout->addWidget( TabWidget );
#ifdef QWS
TabWidget->setCurrentTab( tr( "Nets" ) );
#endif
}
/*
* Destroys the object and frees any allocated resources
*/
WellenreiterBase::~WellenreiterBase()
{
// no need to delete child widgets, Qt does it all for us
}
/*
* Main event handler. Reimplemented to handle application
* font changes
*/
bool WellenreiterBase::event( QEvent* ev )
{
bool ret = QWidget::event( ev );
if ( ev->type() == QEvent::ApplicationFontChange ) {
//QFont Log_2_font( Log_2->font() );
//Log_2_font.setFamily( "adobe-courier" );
//Log_2_font.setPointSize( 8 );
//Log_2->setFont( Log_2_font );