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
@@ -14,8 +14,11 @@
**********************************************************************/
#include "gps.h"
#include <unistd.h>
+
+#include <qtextstream.h>
+
GPS::GPS( QObject* parent, const char * name )
:QObject( parent, name )
{
qDebug( "GPS::GPS()" );
@@ -34,9 +37,9 @@ 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 );
@@ -46,21 +49,21 @@ float GPS::latitude() const
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
@@ -18,8 +18,17 @@
#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
@@ -27,10 +36,9 @@ class GPS : public QObject
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;
};
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
@@ -13,8 +13,9 @@
**
**********************************************************************/
#include "configwindow.h"
+#include "gps.h"
#include "logwindow.h"
#include "hexwindow.h"
#include "mainwindow.h"
#include "wellenreiter.h"
@@ -217,13 +218,13 @@ WellenreiterMainWindow::~WellenreiterMainWindow()
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 )
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
@@ -46,8 +46,9 @@ 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 )
{
@@ -74,8 +75,10 @@ MScanListView::MScanListView( QWidget* parent, const char* name )
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) ),
@@ -112,9 +115,15 @@ void MScanListView::serializeFrom( QDataStream& s)
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
@@ -178,8 +187,9 @@ void MScanListView::addNewItem( const QString& type, const QString& essid, const
#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 );
@@ -467,8 +477,17 @@ 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;
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
@@ -15,8 +15,10 @@
#ifndef SCANLIST_H
#define SCANLIST_H
+#include "gps.h"
+
/* OPIE */
#include <opie2/olistview.h>
#include <opie2/onetutils.h>
@@ -38,9 +40,10 @@ class MScanListView: public OListView
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 );
@@ -98,8 +101,9 @@ class MScanListItem: public OListViewItem
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 );
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
@@ -170,16 +170,18 @@ void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon )
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 )
{
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
@@ -122,12 +122,12 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f
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 );