summaryrefslogtreecommitdiff
path: root/libopie2/examples
authormickeyl <mickeyl>2003-10-28 16:38:55 (UTC)
committer mickeyl <mickeyl>2003-10-28 16:38:55 (UTC)
commit877bc5c756d94db71a745596dd7e48104a2ec9a1 (patch) (side-by-side diff)
treedf4de5f085b55e812488b0db2be1d66f63b67945 /libopie2/examples
parent1fed961e25a6afd4070d8873b431aba8342406c3 (diff)
downloadopie-877bc5c756d94db71a745596dd7e48104a2ec9a1.zip
opie-877bc5c756d94db71a745596dd7e48104a2ec9a1.tar.gz
opie-877bc5c756d94db71a745596dd7e48104a2ec9a1.tar.bz2
- remove deprecated setMonitorMode() API. Use setMode( "monitor" ) now.
- monitor mode now tries to use the standard IW_MODE_MONITOR first. If that doesn't work, it falls back to using proprietary iwpriv commands
Diffstat (limited to 'libopie2/examples') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/examples/opiecore/odebugdemo/odebugdemo.pro3
-rw-r--r--libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp37
2 files changed, 38 insertions, 2 deletions
diff --git a/libopie2/examples/opiecore/odebugdemo/odebugdemo.pro b/libopie2/examples/opiecore/odebugdemo/odebugdemo.pro
index c52cd02..aa37394 100644
--- a/libopie2/examples/opiecore/odebugdemo/odebugdemo.pro
+++ b/libopie2/examples/opiecore/odebugdemo/odebugdemo.pro
@@ -1,19 +1,20 @@
TEMPLATE = app
CONFIG = qt warn_on debug
HEADERS =
SOURCES = odebugdemo.cpp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lopiecore2
TARGET = odebugdemo
-MOC_DIR = moc
OBJECTS_DIR = obj
!contains( platform, x11 ) {
include ( $(OPIEDIR)/include.pro )
}
contains( platform, x11 ) {
LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
}
+
+MOC_DIR = moc
diff --git a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp
index 21026e1..06b8b19 100644
--- a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp
+++ b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp
@@ -1,107 +1,142 @@
#include <opie2/onetwork.h>
#include <opie2/ostation.h>
#include <opie2/omanufacturerdb.h>
+#include <unistd.h>
+
int main( int argc, char** argv )
{
qDebug( "OPIE Network Demo" );
ONetwork* net = ONetwork::instance();
ONetwork::InterfaceIterator it = net->iterator();
while ( it.current() )
{
qDebug( "DEMO: ONetwork contains Interface '%s'", (const char*) it.current()->name() );
+ qDebug( "DEMO: Datalink code is '%d'", it.current()->dataLinkType() );
qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString() );
qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString(true) );
qDebug( "DEMO: MAC Manufacturer seems to be '%s'", (const char*) it.current()->macAddress().manufacturer() );
qDebug( "DEMO: Manufacturertest1 = '%s'", (const char*) OManufacturerDB::instance()->lookupExt( "08:00:87" ) );
qDebug( "DEMO: Manufacturertest2 = '%s'", (const char*) OManufacturerDB::instance()->lookupExt( "E2:0C:0F" ) );
qDebug( "Demo: IPv4 Address is '%s'", (const char*) it.current()->ipV4Address() );
if ( it.current()->isWireless() )
{
OWirelessNetworkInterface* iface = static_cast<OWirelessNetworkInterface*>( it.current() );
qDebug( "DEMO: '%s' seems to feature the wireless extensions.", (const char*) iface->name() );
qDebug( "DEMO: Current SSID is '%s'", (const char*) iface->SSID() );
qDebug( "DEMO: Antenna is tuned to '%f', that is channel %d", iface->frequency(), iface->channel() );
//if ( iface->mode() == OWirelessNetworkInterface::adhoc )
//{
- qDebug( "DEMO: Associated AP has MAC Address '%s'", (const char*) iface->associatedAP().toString() );
+ //qDebug( "DEMO: Associated AP has MAC Address '%s'", (const char*) iface->associatedAP().toString() );
//}
+ /*
+
// nickname
qDebug( "DEMO: Current NickName is '%s'", (const char*) iface->nickName() );
iface->setNickName( "MyNickName" );
if ( iface->nickName() != "MyNickName" )
qDebug( "DEMO: Warning! Can't change nickname" );
else
qDebug( "DEMO: Nickname change successful." );
+ /*
+
// operation mode
qDebug( "DEMO: Current OperationMode is '%s'", (const char*) iface->mode() );
iface->setMode( "adhoc" );
if ( iface->mode() != "adhoc" )
qDebug( "DEMO: Warning! Can't change operation mode" );
else
qDebug( "DEMO: Operation Mode change successful." );
// RF channel
qDebug( "DEMO: Current Channel is '%d'", iface->channel() );
iface->setChannel( 1 );
if ( iface->channel() != 1 )
qDebug( "DEMO: Warning! Can't change RF channel" );
else
qDebug( "DEMO: RF channel change successful." );
iface->setMode( "managed" );
+ */
+
+ /*
+
// network scan
OStationList* stations = iface->scanNetwork();
if ( stations )
{
qDebug( "DEMO: # of stations around = %d", stations->count() );
OStation* station;
for ( station = stations->first(); station != 0; station = stations->next() )
{
qDebug( "DEMO: station dump following..." );
station->dump();
}
}
else
{
qDebug( "DEMO: Warning! Scan didn't work!" );
}
/*
// first some wrong calls to check if this is working
iface->setPrivate( "seppel", 10 );
iface->setPrivate( "monitor", 0 );
// now the real deal
iface->setPrivate( "monitor", 2, 2, 3 );
// trying to set hw address to 12:34:56:AB:CD:EF
/*
OMacAddress addr = OMacAddress::fromString( "12:34:56:AB:CD:EF" );
iface->setUp( false );
iface->setMacAddress( addr );
iface->setUp( true );
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 ); */
+
+ iface->setMode( "master" );
+
+ //sleep( 1 );
+ qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() );
+
+ /*iface->setMode( "adhoc" );
+ sleep( 1 );
+ qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() );
+ iface->setMode( "managed" );
+ sleep( 1 );
+ qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() );
+ iface->setMode( "master" );
+ sleep( 1 );
+ qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() );*/
}
++it;
}
return 0;
}