author | mickeyl <mickeyl> | 2003-05-01 00:59:20 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-05-01 00:59:20 (UTC) |
commit | 1d721ddb247e9000e29fba3150e0cce5f59f543e (patch) (unidiff) | |
tree | 70b659b209395c8aff25442afaa4fc57c29679e6 /libopie2/examples | |
parent | 30c685f9da06d19c993e9bdb74f349dabbde063e (diff) | |
download | opie-1d721ddb247e9000e29fba3150e0cce5f59f543e.zip opie-1d721ddb247e9000e29fba3150e0cce5f59f543e.tar.gz opie-1d721ddb247e9000e29fba3150e0cce5f59f543e.tar.bz2 |
implement and document a bunch of missing methods
-rw-r--r-- | libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp index f801b15..fd68772 100644 --- a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp +++ b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp | |||
@@ -1,62 +1,75 @@ | |||
1 | #include <opie2/onetwork.h> | 1 | #include <opie2/onetwork.h> |
2 | 2 | ||
3 | int main( int argc, char** argv ) | 3 | int main( int argc, char** argv ) |
4 | { | 4 | { |
5 | qDebug( "OPIE Network Demo" ); | 5 | qDebug( "OPIE Network Demo" ); |
6 | 6 | ||
7 | ONetwork* net = ONetwork::instance(); | 7 | ONetwork* net = ONetwork::instance(); |
8 | 8 | ||
9 | ONetwork::InterfaceIterator it = net->iterator(); | 9 | ONetwork::InterfaceIterator it = net->iterator(); |
10 | 10 | ||
11 | while ( it.current() ) | 11 | while ( it.current() ) |
12 | { | 12 | { |
13 | qDebug( "DEMO: ONetwork contains Interface '%s'", (const char*) it.current()->name() ); | 13 | qDebug( "DEMO: ONetwork contains Interface '%s'", (const char*) it.current()->name() ); |
14 | qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString() ); | 14 | 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(true) ); | 15 | qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString(true) ); |
16 | qDebug( "Demo: IPv4 Address is '%s'", (const char*) it.current()->ipV4Address() ); | 16 | qDebug( "Demo: IPv4 Address is '%s'", (const char*) it.current()->ipV4Address() ); |
17 | if ( it.current()->isWireless() ) | 17 | if ( it.current()->isWireless() ) |
18 | { | 18 | { |
19 | OWirelessNetworkInterface* iface = static_cast<OWirelessNetworkInterface*>( it.current() ); | 19 | OWirelessNetworkInterface* iface = static_cast<OWirelessNetworkInterface*>( it.current() ); |
20 | qDebug( "DEMO: '%s' seems to feature the wireless extensions.", (const char*) iface->name() ); | 20 | qDebug( "DEMO: '%s' seems to feature the wireless extensions.", (const char*) iface->name() ); |
21 | qDebug( "DEMO: Current SSID is '%s'", (const char*) iface->SSID() ); | 21 | qDebug( "DEMO: Current SSID is '%s'", (const char*) iface->SSID() ); |
22 | qDebug( "DEMO: Current NickName is '%s'", (const char*) iface->nickName() ); | ||
23 | qDebug( "DEMO: Antenna is tuned to '%f', that is channel %d", iface->frequency(), iface->channel() ); | 22 | qDebug( "DEMO: Antenna is tuned to '%f', that is channel %d", iface->frequency(), iface->channel() ); |
24 | 23 | ||
25 | //if ( iface->mode() == OWirelessNetworkInterface::adhoc ) | 24 | //if ( iface->mode() == OWirelessNetworkInterface::adhoc ) |
26 | //{ | 25 | //{ |
27 | qDebug( "DEMO: Associated AP has MAC Address '%s'", (const char*) iface->associatedAP() ); | 26 | qDebug( "DEMO: Associated AP has MAC Address '%s'", (const char*) iface->associatedAP() ); |
28 | //} | 27 | //} |
29 | 28 | ||
30 | // try to set monitor mode | 29 | // nickname |
30 | qDebug( "DEMO: Current NickName is '%s'", (const char*) iface->nickName() ); | ||
31 | iface->setNickName( "MyNickName" ); | ||
32 | if ( iface->nickName() != "MyNickName" ) | ||
33 | qDebug( "DEMO: Warning! Can't change nickname" ); | ||
34 | else | ||
35 | qDebug( "DEMO: Nickname change successful." ); | ||
36 | |||
37 | // operation mode | ||
38 | qDebug( "DEMO: Current OperationMode is '%s'", (const char*) iface->mode() ); | ||
39 | iface->setMode( "adhoc" ); | ||
40 | if ( iface->mode() != "adhoc" ) | ||
41 | qDebug( "DEMO: Warning! Can't change operation mode" ); | ||
42 | else | ||
43 | qDebug( "DEMO: Operation Mode change successful." ); | ||
44 | |||
45 | iface->setMode( "managed" ); | ||
31 | 46 | ||
32 | /* | 47 | /* |
33 | 48 | ||
34 | // first some wrong calls to check if this is working | 49 | // first some wrong calls to check if this is working |
35 | iface->setPrivate( "seppel", 10 ); | 50 | iface->setPrivate( "seppel", 10 ); |
36 | iface->setPrivate( "monitor", 0 ); | 51 | iface->setPrivate( "monitor", 0 ); |
37 | 52 | ||
38 | // now the real deal | 53 | // now the real deal |
39 | iface->setPrivate( "monitor", 2, 2, 3 ); | 54 | iface->setPrivate( "monitor", 2, 2, 3 ); |
40 | 55 | ||
41 | */ | ||
42 | |||
43 | // trying to set hw address to 12:34:56:AB:CD:EF | 56 | // trying to set hw address to 12:34:56:AB:CD:EF |
44 | 57 | ||
45 | /* | 58 | /* |
46 | 59 | ||
47 | OMacAddress addr = OMacAddress::fromString( "12:34:56:AB:CD:EF" ); | 60 | OMacAddress addr = OMacAddress::fromString( "12:34:56:AB:CD:EF" ); |
48 | iface->setUp( false ); | 61 | iface->setUp( false ); |
49 | iface->setMacAddress( addr ); | 62 | iface->setMacAddress( addr ); |
50 | iface->setUp( true ); | 63 | iface->setUp( true ); |
51 | qDebug( "DEMO: MAC Address now is '%s'", (const char*) iface->macAddress().toString() ); | 64 | qDebug( "DEMO: MAC Address now is '%s'", (const char*) iface->macAddress().toString() ); |
52 | 65 | ||
53 | */ | 66 | */ |
54 | 67 | ||
55 | 68 | ||
56 | } | 69 | } |
57 | ++it; | 70 | ++it; |
58 | } | 71 | } |
59 | 72 | ||
60 | return 0; | 73 | return 0; |
61 | 74 | ||
62 | } | 75 | } |