summaryrefslogtreecommitdiff
path: root/libopie2/examples
Unidiff
Diffstat (limited to 'libopie2/examples') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp4
-rw-r--r--libopie2/examples/opieui/opieui.pro4
2 files changed, 6 insertions, 2 deletions
diff --git a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp
index fd68772..6326ad0 100644
--- a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp
+++ b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp
@@ -1,75 +1,79 @@
1#include <opie2/onetwork.h> 1#include <opie2/onetwork.h>
2#include <opie2/omanufacturerdb.h>
2 3
3int main( int argc, char** argv ) 4int main( int argc, char** argv )
4{ 5{
5 qDebug( "OPIE Network Demo" ); 6 qDebug( "OPIE Network Demo" );
6 7
7 ONetwork* net = ONetwork::instance(); 8 ONetwork* net = ONetwork::instance();
8 9
9 ONetwork::InterfaceIterator it = net->iterator(); 10 ONetwork::InterfaceIterator it = net->iterator();
10 11
11 while ( it.current() ) 12 while ( it.current() )
12 { 13 {
13 qDebug( "DEMO: ONetwork contains Interface '%s'", (const char*) it.current()->name() ); 14 qDebug( "DEMO: ONetwork contains Interface '%s'", (const char*) it.current()->name() );
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() );
15 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() );
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" ) );
16 qDebug( "Demo: IPv4 Address is '%s'", (const char*) it.current()->ipV4Address() ); 20 qDebug( "Demo: IPv4 Address is '%s'", (const char*) it.current()->ipV4Address() );
17 if ( it.current()->isWireless() ) 21 if ( it.current()->isWireless() )
18 { 22 {
19 OWirelessNetworkInterface* iface = static_cast<OWirelessNetworkInterface*>( it.current() ); 23 OWirelessNetworkInterface* iface = static_cast<OWirelessNetworkInterface*>( it.current() );
20 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() );
21 qDebug( "DEMO: Current SSID is '%s'", (const char*) iface->SSID() ); 25 qDebug( "DEMO: Current SSID is '%s'", (const char*) iface->SSID() );
22 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() );
23 27
24 //if ( iface->mode() == OWirelessNetworkInterface::adhoc ) 28 //if ( iface->mode() == OWirelessNetworkInterface::adhoc )
25 //{ 29 //{
26 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() );
27 //} 31 //}
28 32
29 // nickname 33 // nickname
30 qDebug( "DEMO: Current NickName is '%s'", (const char*) iface->nickName() ); 34 qDebug( "DEMO: Current NickName is '%s'", (const char*) iface->nickName() );
31 iface->setNickName( "MyNickName" ); 35 iface->setNickName( "MyNickName" );
32 if ( iface->nickName() != "MyNickName" ) 36 if ( iface->nickName() != "MyNickName" )
33 qDebug( "DEMO: Warning! Can't change nickname" ); 37 qDebug( "DEMO: Warning! Can't change nickname" );
34 else 38 else
35 qDebug( "DEMO: Nickname change successful." ); 39 qDebug( "DEMO: Nickname change successful." );
36 40
37 // operation mode 41 // operation mode
38 qDebug( "DEMO: Current OperationMode is '%s'", (const char*) iface->mode() ); 42 qDebug( "DEMO: Current OperationMode is '%s'", (const char*) iface->mode() );
39 iface->setMode( "adhoc" ); 43 iface->setMode( "adhoc" );
40 if ( iface->mode() != "adhoc" ) 44 if ( iface->mode() != "adhoc" )
41 qDebug( "DEMO: Warning! Can't change operation mode" ); 45 qDebug( "DEMO: Warning! Can't change operation mode" );
42 else 46 else
43 qDebug( "DEMO: Operation Mode change successful." ); 47 qDebug( "DEMO: Operation Mode change successful." );
44 48
45 iface->setMode( "managed" ); 49 iface->setMode( "managed" );
46 50
47 /* 51 /*
48 52
49 // first some wrong calls to check if this is working 53 // first some wrong calls to check if this is working
50 iface->setPrivate( "seppel", 10 ); 54 iface->setPrivate( "seppel", 10 );
51 iface->setPrivate( "monitor", 0 ); 55 iface->setPrivate( "monitor", 0 );
52 56
53 // now the real deal 57 // now the real deal
54 iface->setPrivate( "monitor", 2, 2, 3 ); 58 iface->setPrivate( "monitor", 2, 2, 3 );
55 59
56 // trying to set hw address to 12:34:56:AB:CD:EF 60 // trying to set hw address to 12:34:56:AB:CD:EF
57 61
58 /* 62 /*
59 63
60 OMacAddress addr = OMacAddress::fromString( "12:34:56:AB:CD:EF" ); 64 OMacAddress addr = OMacAddress::fromString( "12:34:56:AB:CD:EF" );
61 iface->setUp( false ); 65 iface->setUp( false );
62 iface->setMacAddress( addr ); 66 iface->setMacAddress( addr );
63 iface->setUp( true ); 67 iface->setUp( true );
64 qDebug( "DEMO: MAC Address now is '%s'", (const char*) iface->macAddress().toString() ); 68 qDebug( "DEMO: MAC Address now is '%s'", (const char*) iface->macAddress().toString() );
65 69
66 */ 70 */
67 71
68 72
69 } 73 }
70 ++it; 74 ++it;
71 } 75 }
72 76
73 return 0; 77 return 0;
74 78
75} 79}
diff --git a/libopie2/examples/opieui/opieui.pro b/libopie2/examples/opieui/opieui.pro
index b52f013..ad66f47 100644
--- a/libopie2/examples/opieui/opieui.pro
+++ b/libopie2/examples/opieui/opieui.pro
@@ -1,3 +1,3 @@
1TEMPLATE = subdirs 1TEMPLATE = subdirs
2SUBDIRS = olistviewdemo oversatileviewdemo 2SUBDIRS = olistviewdemo
3 3