summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show 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
@@ -12,12 +12,15 @@
** 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" );
}
@@ -32,35 +35,35 @@ 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
@@ -16,23 +16,31 @@
#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
@@ -11,12 +11,13 @@
** 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"
@@ -215,17 +216,17 @@ 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 )
{
QMap<QString, QStringList> map;
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
@@ -44,12 +44,13 @@ 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 );
@@ -72,12 +73,14 @@ MScanListView::MScanListView( QWidget* parent, const char* name )
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) ) );
@@ -110,13 +113,19 @@ 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 );
@@ -176,12 +185,13 @@ void MScanListView::addNewItem( const QString& type, const QString& essid, const
#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
@@ -465,12 +475,21 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr,
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();
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
@@ -13,12 +13,14 @@
**
**********************************************************************/
#ifndef SCANLIST_H
#define SCANLIST_H
+#include "gps.h"
+
/* OPIE */
#include <opie2/olistview.h>
#include <opie2/onetutils.h>
/* QT */
#include <qtextstream.h>
@@ -36,13 +38,14 @@ class MScanListView: public OListView
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 );
@@ -96,12 +99,13 @@ class MScanListItem: public OListViewItem
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:
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
@@ -168,20 +168,22 @@ void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon )
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 )
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
@@ -120,16 +120,16 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f
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