Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 74 |
1 files changed, 33 insertions, 41 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index fff7c35..fad6efd 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -12,6 +12,4 @@ | |||
12 | ***********************************************************************/ | 12 | ***********************************************************************/ |
13 | 13 | ||
14 | // Local | ||
15 | |||
16 | #include "gps.h" | 14 | #include "gps.h" |
17 | #include "wellenreiter.h" | 15 | #include "wellenreiter.h" |
@@ -24,8 +22,8 @@ | |||
24 | #include "protolistview.h" | 22 | #include "protolistview.h" |
25 | 23 | ||
26 | // Opie | 24 | /* OPIE */ |
27 | |||
28 | #ifdef QWS | 25 | #ifdef QWS |
29 | #include <opie2/oapplication.h> | 26 | #include <opie2/oapplication.h> |
27 | #include <opie2/odebug.h> | ||
30 | #include <opie2/odevice.h> | 28 | #include <opie2/odevice.h> |
31 | #else | 29 | #else |
@@ -36,8 +34,9 @@ | |||
36 | #include <opie2/opcap.h> | 34 | #include <opie2/opcap.h> |
37 | #include <qpe/qcopenvelope_qws.h> | 35 | #include <qpe/qcopenvelope_qws.h> |
38 | using namespace Opie; | 36 | using namespace Opie::Core; |
39 | 37 | using namespace Opie::Net; | |
40 | // Qt | 38 | using namespace Opie::Ui; |
41 | 39 | ||
40 | /* QT */ | ||
42 | #include <qcheckbox.h> | 41 | #include <qcheckbox.h> |
43 | #include <qcombobox.h> | 42 | #include <qcombobox.h> |
@@ -53,6 +52,5 @@ using namespace Opie; | |||
53 | #include <qmainwindow.h> | 52 | #include <qmainwindow.h> |
54 | 53 | ||
55 | // Standard | 54 | /* STD */ |
56 | |||
57 | #include <assert.h> | 55 | #include <assert.h> |
58 | #include <errno.h> | 56 | #include <errno.h> |
@@ -62,10 +60,4 @@ using namespace Opie; | |||
62 | #include <stdlib.h> | 60 | #include <stdlib.h> |
63 | 61 | ||
64 | using namespace Opie::Core; | ||
65 | using namespace Opie::Net; | ||
66 | using namespace Opie::Net; | ||
67 | using namespace Opie::Core; | ||
68 | using namespace Opie::Net; | ||
69 | using namespace Opie::Core; | ||
70 | Wellenreiter::Wellenreiter( QWidget* parent ) | 62 | Wellenreiter::Wellenreiter( QWidget* parent ) |
71 | : WellenreiterBase( parent, 0, 0 ), | 63 | : WellenreiterBase( parent, 0, 0 ), |
@@ -107,5 +99,5 @@ Wellenreiter::~Wellenreiter() | |||
107 | void Wellenreiter::initialTimer() | 99 | void Wellenreiter::initialTimer() |
108 | { | 100 | { |
109 | qDebug( "Wellenreiter::preloading manufacturer database..." ); | 101 | odebug << "Wellenreiter::preloading manufacturer database..." << oendl; |
110 | OManufacturerDB::instance(); | 102 | OManufacturerDB::instance(); |
111 | } | 103 | } |
@@ -150,10 +142,10 @@ void Wellenreiter::handleNotification( OPacket* p ) | |||
150 | { | 142 | { |
151 | QString action = configwindow->parsePackets->protocolAction( name ); | 143 | QString action = configwindow->parsePackets->protocolAction( name ); |
152 | qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); | 144 | odebug << "parsePacket-action for '" << (const char*) name << "' seems to be '" << (const char*) action << "'" << oendl; |
153 | doAction( action, name, p ); | 145 | doAction( action, name, p ); |
154 | } | 146 | } |
155 | else | 147 | else |
156 | { | 148 | { |
157 | qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); | 149 | odebug << "protocol '" << (const char*) name << "' not checked in parsePackets." << oendl; |
158 | } | 150 | } |
159 | ++it; | 151 | ++it; |
@@ -167,5 +159,5 @@ void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* | |||
167 | else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage ); | 159 | else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage ); |
168 | else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage ); | 160 | else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage ); |
169 | else qWarning( "Wellenreiter::handleManagementFrame(): '%s' - please handle me!", (const char*) manage->managementType() ); | 161 | else owarn << "Wellenreiter::handleManagementFrame(): '" << (const char*) manage->managementType() << "' - please handle me!" << oendl; |
170 | } | 162 | } |
171 | 163 | ||
@@ -183,12 +175,12 @@ void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManage | |||
183 | { | 175 | { |
184 | // TODO: add check if GPS is working!? | 176 | // TODO: add check if GPS is working!? |
185 | qDebug( "Wellenreiter::gathering GPS data..." ); | 177 | odebug << "Wellenreiter::gathering GPS data..." << oendl; |
186 | loc = gps->position(); | 178 | loc = gps->position(); |
187 | qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); | 179 | odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl; |
188 | } | 180 | } |
189 | 181 | ||
190 | if ( essid.length() ) | 182 | if ( essid.length() ) |
191 | netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ ); | 183 | netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ ); |
192 | qDebug( "Wellenreiter::invalid frame [possibly noise] detected!" ); | 184 | odebug << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl; |
193 | } | 185 | } |
194 | 186 | ||
@@ -212,5 +204,5 @@ void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPa | |||
212 | else | 204 | else |
213 | { | 205 | { |
214 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); | 206 | owarn << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl; |
215 | return; | 207 | return; |
216 | } | 208 | } |
@@ -227,7 +219,7 @@ void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPa | |||
227 | { | 219 | { |
228 | // TODO: add check if GPS is working!? | 220 | // TODO: add check if GPS is working!? |
229 | qDebug( "Wellenreiter::gathering GPS data..." ); | 221 | odebug << "Wellenreiter::gathering GPS data..." << oendl; |
230 | loc = gps->position(); | 222 | loc = gps->position(); |
231 | qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); | 223 | odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl; |
232 | } | 224 | } |
233 | 225 | ||
@@ -256,5 +248,5 @@ void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* contro | |||
256 | else | 248 | else |
257 | { | 249 | { |
258 | qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() ); | 250 | odebug << "Wellenreiter::handleControlFrame - please handle " << (const char*) control->controlType() << " in a future version! :D" << oendl; |
259 | } | 251 | } |
260 | } | 252 | } |
@@ -305,5 +297,5 @@ void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, | |||
305 | if ( arp ) | 297 | if ( arp ) |
306 | { | 298 | { |
307 | qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); | 299 | odebug << "Received ARP traffic (type '" << (const char*) arp->type() << "'): " << oendl; |
308 | if ( arp->type() == "REQUEST" ) | 300 | if ( arp->type() == "REQUEST" ) |
309 | { | 301 | { |
@@ -326,8 +318,8 @@ void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, | |||
326 | if ( dhcp ) | 318 | if ( dhcp ) |
327 | { | 319 | { |
328 | qDebug( "Received DHCP '%s' packet", (const char*) dhcp->type() ); | 320 | odebug << "Received DHCP '" << (const char*) dhcp->type() << "' packet" << oendl; |
329 | if ( dhcp->type() == "OFFER" ) | 321 | if ( dhcp->type() == "OFFER" ) |
330 | { | 322 | { |
331 | qDebug( "DHCP: '%s' ('%s') seems to be a DHCP server.", (const char*) source.toString(), (const char*) dhcp->serverAddress().toString() ); | 323 | odebug << "DHCP: '" << (const char*) source.toString() << "' ('" << (const char*) dhcp->serverAddress().toString() << "') seems to be a DHCP server." << oendl; |
332 | netView()->identify( source, dhcp->serverAddress().toString() ); | 324 | netView()->identify( source, dhcp->serverAddress().toString() ); |
333 | netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); | 325 | netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); |
@@ -335,5 +327,5 @@ void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, | |||
335 | else if ( dhcp->type() == "ACK" ) | 327 | else if ( dhcp->type() == "ACK" ) |
336 | { | 328 | { |
337 | qDebug( "DHCP: '%s' ('%s') accepted the offered DHCP address.", (const char*) dhcp->clientMacAddress().toString(), (const char*) dhcp->yourAddress().toString() ); | 329 | odebug << "DHCP: '" << (const char*) dhcp->clientMacAddress().toString() << "' ('" << (const char*) dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl; |
338 | netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); | 330 | netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); |
339 | } | 331 | } |
@@ -369,5 +361,5 @@ bool Wellenreiter::checkDumpPacket( OPacket* p ) | |||
369 | { | 361 | { |
370 | QString action = configwindow->capturePackets->protocolAction( name ); | 362 | QString action = configwindow->capturePackets->protocolAction( name ); |
371 | qDebug( "capturePackets-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); | 363 | odebug << "capturePackets-action for '" << (const char*) name << "' seems to be '" << (const char*) action << "'" << oendl; |
372 | if ( action == "Discard" ) | 364 | if ( action == "Discard" ) |
373 | { | 365 | { |
@@ -378,5 +370,5 @@ bool Wellenreiter::checkDumpPacket( OPacket* p ) | |||
378 | else | 370 | else |
379 | { | 371 | { |
380 | qDebug( "protocol '%s' not checked in capturePackets.", (const char*) name ); | 372 | odebug << "protocol '" << (const char*) name << "' not checked in capturePackets." << oendl; |
381 | } | 373 | } |
382 | ++it; | 374 | ++it; |
@@ -552,5 +544,5 @@ void Wellenreiter::startClicked() | |||
552 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; | 544 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; |
553 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; | 545 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; |
554 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; | 546 | case DEVTYPE_FILE: odebug << "Wellenreiter: Capturing from file '" << (const char*) interface << "'" << oendl; break; |
555 | default: assert( 0 ); // shouldn't reach this | 547 | default: assert( 0 ); // shouldn't reach this |
556 | } | 548 | } |
@@ -573,5 +565,5 @@ void Wellenreiter::startClicked() | |||
573 | if ( configwindow->enableGPS->isChecked() ) | 565 | if ( configwindow->enableGPS->isChecked() ) |
574 | { | 566 | { |
575 | qDebug( "Wellenreiter:GPS enabled @ %s:%d", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); | 567 | odebug << "Wellenreiter:GPS enabled @ " << (const char*) configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "" << oendl; |
576 | gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); | 568 | gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); |
577 | } | 569 | } |
@@ -597,5 +589,5 @@ void Wellenreiter::startClicked() | |||
597 | pcap->open( QFile( interface ) ); | 589 | pcap->open( QFile( interface ) ); |
598 | 590 | ||
599 | qDebug( "Wellenreiter:: dumping to %s", (const char*) dumpname ); | 591 | odebug << "Wellenreiter:: dumping to " << (const char*) dumpname << "" << oendl; |
600 | pcap->openDumpFile( dumpname ); | 592 | pcap->openDumpFile( dumpname ); |
601 | 593 | ||
@@ -653,5 +645,5 @@ void Wellenreiter::startClicked() | |||
653 | void Wellenreiter::timerEvent( QTimerEvent* ) | 645 | void Wellenreiter::timerEvent( QTimerEvent* ) |
654 | { | 646 | { |
655 | qDebug( "Wellenreiter::timerEvent()" ); | 647 | odebug << "Wellenreiter::timerEvent()" << oendl; |
656 | OPacket* p = pcap->next(); | 648 | OPacket* p = pcap->next(); |
657 | if ( !p ) // no more packets available | 649 | if ( !p ) // no more packets available |
@@ -716,13 +708,13 @@ void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int ch | |||
716 | QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); | 708 | QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); |
717 | int count = 3; | 709 | int count = 3; |
718 | qDebug("sending %d messages",count); | 710 | odebug << "sending " << count << " messages" << oendl; |
719 | msg << QString("count") << QString::number(count); | 711 | msg << QString("count") << QString::number(count); |
720 | qDebug("msg >%s< Mode >%s<", iface->name(),type.latin1() ); | 712 | odebug << "msg >" << iface->name() << "< Mode >" << type.latin1() << "<" << oendl; |
721 | msg << QString(iface->name()) << QString("Mode") << type; | 713 | msg << QString(iface->name()) << QString("Mode") << type; |
722 | qDebug("msg >%s< essid >%s<", iface->name(),essid.latin1()); | 714 | odebug << "msg >" << iface->name() << "< essid >" << essid.latin1() << "<" << oendl; |
723 | msg << QString(iface->name()) << QString("ESSID") << essid; | 715 | msg << QString(iface->name()) << QString("ESSID") << essid; |
724 | qDebug("msg >%s< channel >%d<", iface->name(),channel); | 716 | odebug << "msg >" << iface->name() << "< channel >" << channel << "<" << oendl; |
725 | msg << QString(iface->name()) << QString("Channel") << channel; | 717 | msg << QString(iface->name()) << QString("Channel") << channel; |
726 | // qDebug("msg >%s< mac >%s<", iface->name(),macaddr); | 718 | // odebug << "msg >" << iface->name() << "< mac >" << macaddr << "<" << oendl; |
727 | // msg << QString(iface->name()) << QString("MacAddr") << macaddr; | 719 | // msg << QString(iface->name()) << QString("MacAddr") << macaddr; |
728 | #else | 720 | #else |