-rw-r--r-- | libopie2/examples/opiecore/odebugdemo/odebugdemo.pro | 3 | ||||
-rw-r--r-- | libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp | 37 |
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 | |||
@@ -4,16 +4,17 @@ HEADERS = | |||
4 | SOURCES = odebugdemo.cpp | 4 | SOURCES = odebugdemo.cpp |
5 | INCLUDEPATH += $(OPIEDIR)/include | 5 | INCLUDEPATH += $(OPIEDIR)/include |
6 | DEPENDPATH += $(OPIEDIR)/include | 6 | DEPENDPATH += $(OPIEDIR)/include |
7 | LIBS += -lopiecore2 | 7 | LIBS += -lopiecore2 |
8 | TARGET = odebugdemo | 8 | TARGET = odebugdemo |
9 | 9 | ||
10 | MOC_DIR = moc | ||
11 | OBJECTS_DIR = obj | 10 | OBJECTS_DIR = obj |
12 | 11 | ||
13 | !contains( platform, x11 ) { | 12 | !contains( platform, x11 ) { |
14 | include ( $(OPIEDIR)/include.pro ) | 13 | include ( $(OPIEDIR)/include.pro ) |
15 | } | 14 | } |
16 | 15 | ||
17 | contains( platform, x11 ) { | 16 | contains( platform, x11 ) { |
18 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | 17 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib |
19 | } | 18 | } |
19 | |||
20 | 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,21 +1,24 @@ | |||
1 | #include <opie2/onetwork.h> | 1 | #include <opie2/onetwork.h> |
2 | #include <opie2/ostation.h> | 2 | #include <opie2/ostation.h> |
3 | #include <opie2/omanufacturerdb.h> | 3 | #include <opie2/omanufacturerdb.h> |
4 | 4 | ||
5 | #include <unistd.h> | ||
6 | |||
5 | int main( int argc, char** argv ) | 7 | int main( int argc, char** argv ) |
6 | { | 8 | { |
7 | qDebug( "OPIE Network Demo" ); | 9 | qDebug( "OPIE Network Demo" ); |
8 | 10 | ||
9 | ONetwork* net = ONetwork::instance(); | 11 | ONetwork* net = ONetwork::instance(); |
10 | 12 | ||
11 | ONetwork::InterfaceIterator it = net->iterator(); | 13 | ONetwork::InterfaceIterator it = net->iterator(); |
12 | 14 | ||
13 | while ( it.current() ) | 15 | while ( it.current() ) |
14 | { | 16 | { |
15 | qDebug( "DEMO: ONetwork contains Interface '%s'", (const char*) it.current()->name() ); | 17 | qDebug( "DEMO: ONetwork contains Interface '%s'", (const char*) it.current()->name() ); |
18 | qDebug( "DEMO: Datalink code is '%d'", it.current()->dataLinkType() ); | ||
16 | qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString() ); | 19 | qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString() ); |
17 | qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString(true) ); | 20 | qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString(true) ); |
18 | qDebug( "DEMO: MAC Manufacturer seems to be '%s'", (const char*) it.current()->macAddress().manufacturer() ); | 21 | qDebug( "DEMO: MAC Manufacturer seems to be '%s'", (const char*) it.current()->macAddress().manufacturer() ); |
19 | qDebug( "DEMO: Manufacturertest1 = '%s'", (const char*) OManufacturerDB::instance()->lookupExt( "08:00:87" ) ); | 22 | qDebug( "DEMO: Manufacturertest1 = '%s'", (const char*) OManufacturerDB::instance()->lookupExt( "08:00:87" ) ); |
20 | qDebug( "DEMO: Manufacturertest2 = '%s'", (const char*) OManufacturerDB::instance()->lookupExt( "E2:0C:0F" ) ); | 23 | qDebug( "DEMO: Manufacturertest2 = '%s'", (const char*) OManufacturerDB::instance()->lookupExt( "E2:0C:0F" ) ); |
21 | qDebug( "Demo: IPv4 Address is '%s'", (const char*) it.current()->ipV4Address() ); | 24 | qDebug( "Demo: IPv4 Address is '%s'", (const char*) it.current()->ipV4Address() ); |
@@ -25,23 +28,27 @@ int main( int argc, char** argv ) | |||
25 | qDebug( "DEMO: '%s' seems to feature the wireless extensions.", (const char*) iface->name() ); | 28 | qDebug( "DEMO: '%s' seems to feature the wireless extensions.", (const char*) iface->name() ); |
26 | qDebug( "DEMO: Current SSID is '%s'", (const char*) iface->SSID() ); | 29 | qDebug( "DEMO: Current SSID is '%s'", (const char*) iface->SSID() ); |
27 | qDebug( "DEMO: Antenna is tuned to '%f', that is channel %d", iface->frequency(), iface->channel() ); | 30 | qDebug( "DEMO: Antenna is tuned to '%f', that is channel %d", iface->frequency(), iface->channel() ); |
28 | 31 | ||
29 | //if ( iface->mode() == OWirelessNetworkInterface::adhoc ) | 32 | //if ( iface->mode() == OWirelessNetworkInterface::adhoc ) |
30 | //{ | 33 | //{ |
31 | qDebug( "DEMO: Associated AP has MAC Address '%s'", (const char*) iface->associatedAP().toString() ); | 34 | //qDebug( "DEMO: Associated AP has MAC Address '%s'", (const char*) iface->associatedAP().toString() ); |
32 | //} | 35 | //} |
33 | 36 | ||
37 | /* | ||
38 | |||
34 | // nickname | 39 | // nickname |
35 | qDebug( "DEMO: Current NickName is '%s'", (const char*) iface->nickName() ); | 40 | qDebug( "DEMO: Current NickName is '%s'", (const char*) iface->nickName() ); |
36 | iface->setNickName( "MyNickName" ); | 41 | iface->setNickName( "MyNickName" ); |
37 | if ( iface->nickName() != "MyNickName" ) | 42 | if ( iface->nickName() != "MyNickName" ) |
38 | qDebug( "DEMO: Warning! Can't change nickname" ); | 43 | qDebug( "DEMO: Warning! Can't change nickname" ); |
39 | else | 44 | else |
40 | qDebug( "DEMO: Nickname change successful." ); | 45 | qDebug( "DEMO: Nickname change successful." ); |
41 | 46 | ||
47 | /* | ||
48 | |||
42 | // operation mode | 49 | // operation mode |
43 | qDebug( "DEMO: Current OperationMode is '%s'", (const char*) iface->mode() ); | 50 | qDebug( "DEMO: Current OperationMode is '%s'", (const char*) iface->mode() ); |
44 | iface->setMode( "adhoc" ); | 51 | iface->setMode( "adhoc" ); |
45 | if ( iface->mode() != "adhoc" ) | 52 | if ( iface->mode() != "adhoc" ) |
46 | qDebug( "DEMO: Warning! Can't change operation mode" ); | 53 | qDebug( "DEMO: Warning! Can't change operation mode" ); |
47 | else | 54 | else |
@@ -54,12 +61,16 @@ int main( int argc, char** argv ) | |||
54 | qDebug( "DEMO: Warning! Can't change RF channel" ); | 61 | qDebug( "DEMO: Warning! Can't change RF channel" ); |
55 | else | 62 | else |
56 | qDebug( "DEMO: RF channel change successful." ); | 63 | qDebug( "DEMO: RF channel change successful." ); |
57 | 64 | ||
58 | iface->setMode( "managed" ); | 65 | iface->setMode( "managed" ); |
59 | 66 | ||
67 | */ | ||
68 | |||
69 | /* | ||
70 | |||
60 | // network scan | 71 | // network scan |
61 | 72 | ||
62 | OStationList* stations = iface->scanNetwork(); | 73 | OStationList* stations = iface->scanNetwork(); |
63 | if ( stations ) | 74 | if ( stations ) |
64 | { | 75 | { |
65 | qDebug( "DEMO: # of stations around = %d", stations->count() ); | 76 | qDebug( "DEMO: # of stations around = %d", stations->count() ); |
@@ -94,12 +105,36 @@ int main( int argc, char** argv ) | |||
94 | iface->setMacAddress( addr ); | 105 | iface->setMacAddress( addr ); |
95 | iface->setUp( true ); | 106 | iface->setUp( true ); |
96 | qDebug( "DEMO: MAC Address now is '%s'", (const char*) iface->macAddress().toString() ); | 107 | qDebug( "DEMO: MAC Address now is '%s'", (const char*) iface->macAddress().toString() ); |
97 | 108 | ||
98 | */ | 109 | */ |
99 | 110 | ||
111 | // monitor test | ||
112 | |||
113 | /* | ||
114 | |||
115 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); | ||
116 | iface->setMode( "monitor" ); | ||
117 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); | ||
118 | |||
119 | sleep( 1 ); */ | ||
120 | |||
121 | iface->setMode( "master" ); | ||
122 | |||
123 | //sleep( 1 ); | ||
124 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); | ||
125 | |||
126 | /*iface->setMode( "adhoc" ); | ||
127 | sleep( 1 ); | ||
128 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); | ||
129 | iface->setMode( "managed" ); | ||
130 | sleep( 1 ); | ||
131 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); | ||
132 | iface->setMode( "master" ); | ||
133 | sleep( 1 ); | ||
134 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() );*/ | ||
100 | 135 | ||
101 | } | 136 | } |
102 | ++it; | 137 | ++it; |
103 | } | 138 | } |
104 | 139 | ||
105 | return 0; | 140 | return 0; |