author | mickeyl <mickeyl> | 2003-12-01 22:44:38 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-12-01 22:44:38 (UTC) |
commit | 7a7683d435cfbb4fa2d6ed99fd4a94d388402aec (patch) (side-by-side diff) | |
tree | 1a34de131d935f34dd2622e3606ba664a7783e24 /libopie2/examples | |
parent | a4a47fca8badeca2b1aae51b39295ccdc8782c4f (diff) | |
download | opie-7a7683d435cfbb4fa2d6ed99fd4a94d388402aec.zip opie-7a7683d435cfbb4fa2d6ed99fd4a94d388402aec.tar.gz opie-7a7683d435cfbb4fa2d6ed99fd4a94d388402aec.tar.bz2 |
slowly start to refactor & cleanup libopie2 before merging it with libopie1
4 files changed, 26 insertions, 8 deletions
diff --git a/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp b/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp index 74886fa..e8bf04f 100644 --- a/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp +++ b/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp @@ -89,18 +89,20 @@ public slots: m = method; qDebug( "choosing method: %d", method ); OConfig* g = OGlobal::config(); g->setGroup( "General" ); g->writeEntry( "debugMode", m ); e->setText( OGlobalSettings::debugOutput() ); + g->write(); } void updateDebugOutput() { OConfig* g = OGlobal::config(); g->setGroup( "General" ); g->writeEntry( "debugOutput"+QString::number(OGlobalSettings::debugMode()), e->text() ); + g->write(); } void emitInfoOutput() { odebug << "This is a debug message" << oendl; } void emitWarningOutput() diff --git a/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp index c49daa0..eb2e8e8 100644 --- a/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp +++ b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp @@ -28,13 +28,13 @@ QDict<Station> stations; //======================== Application class =============================== class Wellenreiter : public QApplication { Q_OBJECT public: - Wellenreiter( int argc, char** argv ) : QApplication( argc, argv ) + Wellenreiter( int argc, char** argv ) : QApplication( argc, argv ), channel( 1 ) { ONetwork* net = ONetwork::instance(); if ( argc < 3 ) { @@ -53,15 +53,15 @@ public: } ++it; } exit( -1 ); } - printf( "****************************************************\n" ); - printf( "* Wellenreiter mini edition 1.0 (C) 2003 M-M-M *\n" ); - printf( "****************************************************\n" ); + printf( "*******************************************************************\n" ); + printf( "* Wellenreiter mini edition 1.0.0 (C) 2003 Michael 'Mickey' Lauer *\n" ); + printf( "*******************************************************************\n" ); printf( "\n\n" ); QString interface( argv[1] ); QString driver( argv[2] ); printf( "Trying to use '%s' as %s-controlled device...\n", (const char*) interface, (const char*) driver ); @@ -102,20 +102,26 @@ public: printf( "Interface status is already promisc - good.\n" ); // connect a monitoring strategy to the interface if ( driver == "orinoco" ) new OOrinocoMonitoringInterface( wiface, false ); else + if ( driver == "hostap" ) + new OHostAPMonitoringInterface( wiface, false ); + else + if ( driver == "wlan-ng" ) + new OWlanNGMonitoringInterface( wiface, false ); + else { printf( "Unknown driver. Exiting\n" ); exit( -1 ); } // enable monitoring mode printf( "Enabling monitor mode...\n" ); - //wiface->setMonitorMode( true ); + wiface->setMode( "monitor" ); // open a packet capturer cap = new OPacketCapturer(); cap->open( interface ); if ( !cap->isOpen() ) { @@ -128,18 +134,26 @@ public: // start channel hopper //wiface->setChannelHopping( 1000 ); // connect connect( cap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); + // timer + startTimer( 1000 ); } ~Wellenreiter() {}; public slots: + virtual void timerEvent(QTimerEvent* e) + { + wiface->setChannel( channel++ ); + if ( channel == 14 ) channel = 1; + } + void receivePacket(OPacket* p) { if (!p) { printf( "(empty packet received)\n" ); return; @@ -200,12 +214,13 @@ public slots: return; } } private: OPacketCapturer* cap; OWirelessNetworkInterface* wiface; + int channel; }; int main( int argc, char** argv ) { Wellenreiter w( argc, argv ); diff --git a/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.pro b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.pro index 7ce535c..b2c5c14 100644 --- a/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.pro +++ b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.pro diff --git a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp index 06b8b19..4763316 100644 --- a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp +++ b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp @@ -107,21 +107,22 @@ int main( int argc, char** argv ) qDebug( "DEMO: MAC Address now is '%s'", (const char*) iface->macAddress().toString() ); */ // monitor test - /* + qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); iface->setMode( "monitor" ); qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); - sleep( 1 ); */ + sleep( 1 ); - iface->setMode( "master" ); + iface->setChannel( 1 ); + iface->setMode( "managed" ); //sleep( 1 ); qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); /*iface->setMode( "adhoc" ); sleep( 1 ); |