summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp
index 6326ad0..607d8f1 100644
--- a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp
+++ b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp
@@ -1,79 +1,87 @@
1#include <opie2/onetwork.h> 1#include <opie2/onetwork.h>
2#include <opie2/omanufacturerdb.h> 2#include <opie2/omanufacturerdb.h>
3 3
4int main( int argc, char** argv ) 4int main( int argc, char** argv )
5{ 5{
6 qDebug( "OPIE Network Demo" ); 6 qDebug( "OPIE Network Demo" );
7 7
8 ONetwork* net = ONetwork::instance(); 8 ONetwork* net = ONetwork::instance();
9 9
10 ONetwork::InterfaceIterator it = net->iterator(); 10 ONetwork::InterfaceIterator it = net->iterator();
11 11
12 while ( it.current() ) 12 while ( it.current() )
13 { 13 {
14 qDebug( "DEMO: ONetwork contains Interface '%s'", (const char*) it.current()->name() ); 14 qDebug( "DEMO: ONetwork contains Interface '%s'", (const char*) it.current()->name() );
15 qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString() ); 15 qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString() );
16 qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString(true) ); 16 qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString(true) );
17 qDebug( "DEMO: MAC Manufacturer seems to be '%s'", (const char*) it.current()->macAddress().manufacturer() ); 17 qDebug( "DEMO: MAC Manufacturer seems to be '%s'", (const char*) it.current()->macAddress().manufacturer() );
18 qDebug( "DEMO: Manufacturertest1 = '%s'", (const char*) OManufacturerDB::instance()->lookupExt( "08:00:87" ) ); 18 qDebug( "DEMO: Manufacturertest1 = '%s'", (const char*) OManufacturerDB::instance()->lookupExt( "08:00:87" ) );
19 qDebug( "DEMO: Manufacturertest2 = '%s'", (const char*) OManufacturerDB::instance()->lookupExt( "E2:0C:0F" ) ); 19 qDebug( "DEMO: Manufacturertest2 = '%s'", (const char*) OManufacturerDB::instance()->lookupExt( "E2:0C:0F" ) );
20 qDebug( "Demo: IPv4 Address is '%s'", (const char*) it.current()->ipV4Address() ); 20 qDebug( "Demo: IPv4 Address is '%s'", (const char*) it.current()->ipV4Address() );
21 if ( it.current()->isWireless() ) 21 if ( it.current()->isWireless() )
22 { 22 {
23 OWirelessNetworkInterface* iface = static_cast<OWirelessNetworkInterface*>( it.current() ); 23 OWirelessNetworkInterface* iface = static_cast<OWirelessNetworkInterface*>( it.current() );
24 qDebug( "DEMO: '%s' seems to feature the wireless extensions.", (const char*) iface->name() ); 24 qDebug( "DEMO: '%s' seems to feature the wireless extensions.", (const char*) iface->name() );
25 qDebug( "DEMO: Current SSID is '%s'", (const char*) iface->SSID() ); 25 qDebug( "DEMO: Current SSID is '%s'", (const char*) iface->SSID() );
26 qDebug( "DEMO: Antenna is tuned to '%f', that is channel %d", iface->frequency(), iface->channel() ); 26 qDebug( "DEMO: Antenna is tuned to '%f', that is channel %d", iface->frequency(), iface->channel() );
27 27
28 //if ( iface->mode() == OWirelessNetworkInterface::adhoc ) 28 //if ( iface->mode() == OWirelessNetworkInterface::adhoc )
29 //{ 29 //{
30 qDebug( "DEMO: Associated AP has MAC Address '%s'", (const char*) iface->associatedAP() ); 30 qDebug( "DEMO: Associated AP has MAC Address '%s'", (const char*) iface->associatedAP() );
31 //} 31 //}
32 32
33 // nickname 33 // nickname
34 qDebug( "DEMO: Current NickName is '%s'", (const char*) iface->nickName() ); 34 qDebug( "DEMO: Current NickName is '%s'", (const char*) iface->nickName() );
35 iface->setNickName( "MyNickName" ); 35 iface->setNickName( "MyNickName" );
36 if ( iface->nickName() != "MyNickName" ) 36 if ( iface->nickName() != "MyNickName" )
37 qDebug( "DEMO: Warning! Can't change nickname" ); 37 qDebug( "DEMO: Warning! Can't change nickname" );
38 else 38 else
39 qDebug( "DEMO: Nickname change successful." ); 39 qDebug( "DEMO: Nickname change successful." );
40 40
41 // operation mode 41 // operation mode
42 qDebug( "DEMO: Current OperationMode is '%s'", (const char*) iface->mode() ); 42 qDebug( "DEMO: Current OperationMode is '%s'", (const char*) iface->mode() );
43 iface->setMode( "adhoc" ); 43 iface->setMode( "adhoc" );
44 if ( iface->mode() != "adhoc" ) 44 if ( iface->mode() != "adhoc" )
45 qDebug( "DEMO: Warning! Can't change operation mode" ); 45 qDebug( "DEMO: Warning! Can't change operation mode" );
46 else 46 else
47 qDebug( "DEMO: Operation Mode change successful." ); 47 qDebug( "DEMO: Operation Mode change successful." );
48 48
49 // RF channel
50 qDebug( "DEMO: Current Channel is '%d'", iface->channel() );
51 iface->setChannel( 1 );
52 if ( iface->channel() != 1 )
53 qDebug( "DEMO: Warning! Can't change RF channel" );
54 else
55 qDebug( "DEMO: RF channel change successful." );
56
49 iface->setMode( "managed" ); 57 iface->setMode( "managed" );
50 58
51 /* 59 /*
52 60
53 // first some wrong calls to check if this is working 61 // first some wrong calls to check if this is working
54 iface->setPrivate( "seppel", 10 ); 62 iface->setPrivate( "seppel", 10 );
55 iface->setPrivate( "monitor", 0 ); 63 iface->setPrivate( "monitor", 0 );
56 64
57 // now the real deal 65 // now the real deal
58 iface->setPrivate( "monitor", 2, 2, 3 ); 66 iface->setPrivate( "monitor", 2, 2, 3 );
59 67
60 // trying to set hw address to 12:34:56:AB:CD:EF 68 // trying to set hw address to 12:34:56:AB:CD:EF
61 69
62 /* 70 /*
63 71
64 OMacAddress addr = OMacAddress::fromString( "12:34:56:AB:CD:EF" ); 72 OMacAddress addr = OMacAddress::fromString( "12:34:56:AB:CD:EF" );
65 iface->setUp( false ); 73 iface->setUp( false );
66 iface->setMacAddress( addr ); 74 iface->setMacAddress( addr );
67 iface->setUp( true ); 75 iface->setUp( true );
68 qDebug( "DEMO: MAC Address now is '%s'", (const char*) iface->macAddress().toString() ); 76 qDebug( "DEMO: MAC Address now is '%s'", (const char*) iface->macAddress().toString() );
69 77
70 */ 78 */
71 79
72 80
73 } 81 }
74 ++it; 82 ++it;
75 } 83 }
76 84
77 return 0; 85 return 0;
78 86
79} 87}