summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--examples/config.in12
-rw-r--r--examples/opiecore/.cvsignore6
-rw-r--r--examples/opiedb/.cvsignore6
-rw-r--r--examples/opiedb/opiedb.pro3
-rw-r--r--examples/opiedb/sqltest/.cvsignore7
-rw-r--r--examples/opiedb/sqltest/main.cpp62
-rw-r--r--examples/opiedb/sqltest/spaltenweise.cpp43
-rw-r--r--examples/opiedb/sqltest/spaltenweise.pro13
-rw-r--r--examples/opiedb/sqltest/sqltest.pro17
-rw-r--r--examples/opiedb/sqltest/test.osql4
-rw-r--r--examples/opiedb/sqltest/test2.osql5
-rw-r--r--examples/opiedb/sqltest/zeilenweise.cpp86
-rw-r--r--examples/opiedb/sqltest/zeilenweise.pro13
-rw-r--r--examples/opiemm/.cvsignore6
-rw-r--r--examples/opienet/.cvsignore6
-rw-r--r--examples/opienet/miniwellenreiter/.cvsignore8
-rw-r--r--examples/opienet/miniwellenreiter/miniwellenreiter.cpp234
-rw-r--r--examples/opienet/miniwellenreiter/miniwellenreiter.pro19
-rw-r--r--examples/opienet/onetworkdemo/.cvsignore8
-rw-r--r--examples/opienet/onetworkdemo/onetworkdemo.cpp176
-rw-r--r--examples/opienet/onetworkdemo/onetworkdemo.pro12
-rw-r--r--examples/opienet/opienet.pro3
-rw-r--r--examples/opieui/.cvsignore6
23 files changed, 755 insertions, 0 deletions
diff --git a/examples/config.in b/examples/config.in
new file mode 100644
index 0000000..ccaf485
--- a/dev/null
+++ b/examples/config.in
@@ -0,0 +1,12 @@
1 source examples/applet/config.in
2 source examples/inputmethod/config.in
3 source examples/main-tab/config.in
4 source examples/menuapplet/config.in
5 source examples/networksettings/config.in
6 source examples/python/config.in
7 source examples/simple/config.in
8 source examples/simple-icon/config.in
9 source examples/simple-main/config.in
10 source examples/simple-pim/config.in
11 source examples/todayplugin/config.in
12
diff --git a/examples/opiecore/.cvsignore b/examples/opiecore/.cvsignore
new file mode 100644
index 0000000..8f7300c
--- a/dev/null
+++ b/examples/opiecore/.cvsignore
@@ -0,0 +1,6 @@
1Makefile*
2moc*
3*moc
4*.o
5~*
6
diff --git a/examples/opiedb/.cvsignore b/examples/opiedb/.cvsignore
new file mode 100644
index 0000000..972e959
--- a/dev/null
+++ b/examples/opiedb/.cvsignore
@@ -0,0 +1,6 @@
1Makefile*
2moc*
3*moc
4*.o
5~*
6obj
diff --git a/examples/opiedb/opiedb.pro b/examples/opiedb/opiedb.pro
new file mode 100644
index 0000000..85fa6db
--- a/dev/null
+++ b/examples/opiedb/opiedb.pro
@@ -0,0 +1,3 @@
1TEMPLATE = subdirs
2SUBDIRS = sqltest
3
diff --git a/examples/opiedb/sqltest/.cvsignore b/examples/opiedb/sqltest/.cvsignore
new file mode 100644
index 0000000..3290247
--- a/dev/null
+++ b/examples/opiedb/sqltest/.cvsignore
@@ -0,0 +1,7 @@
1sqltest
2Makefile*
3moc*
4*moc
5*.o
6~*
7obj
diff --git a/examples/opiedb/sqltest/main.cpp b/examples/opiedb/sqltest/main.cpp
new file mode 100644
index 0000000..f4338e9
--- a/dev/null
+++ b/examples/opiedb/sqltest/main.cpp
@@ -0,0 +1,62 @@
1/*
2 =. This file is part of the Opie Project
3 .=l. Copyright (C) 2004 Opie Team <opie-devel@handhelds.org>
4 .>+-=
5 _;:, .> :=|. This library is free software; you can
6.> <`_, > . <= redistribute it and/or modify it under
7:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
8.="- .-=="i, .._ License as published by the Free Software
9 - . .-<_> .<> Foundation; either version 2 of the License,
10 ._= =} : or (at your option) any later version.
11 .%`+i> _;_.
12 .i_,=:_. -<s. This library is distributed in the hope that
13 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
14 : .. .:, . . . without even the implied warranty of
15 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
16 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.= = ; Library General Public License for more
18++= -. .` .: details.
19 : = ...= . :.=-
20 -. .:....=;==+<; You should have received a copy of the GNU
21 -_. . . )=. = Library General Public License along with
22 -- :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
28
29/* OPIE */
30#include <opie2/osqlmanager.h>
31#include <opie2/osqlquery.h>
32#include <opie2/osqldriver.h>
33#include <opie2/osqlresult.h>
34#include <opie2/odebug.h>
35
36#include <qpe/qpeapplication.h>
37
38/* QT */
39#include <qdir.h>
40
41using namespace Opie::DB;
42int main( int argc, char* argv[] ) {
43
44QPEApplication app( argc, argv );
45OSQLManager man;
46man.registerPath( QDir::currentDirPath() );
47OSQLBackEnd::ValueList list = man.queryBackEnd();
48
49OSQLDriver *driver = man.standard();
50 owarn << "testmain" + driver->id() << oendl;
51 driver->setUrl("/home/ich/test2vhgytry");
52 if ( driver->open() ) {
53 owarn << "could open" << oendl;
54 }else
55 owarn << "wasn't able to open" << oendl;
56 OSQLRawQuery raw("select * from t2" );
57 OSQLResult res = driver->query( &raw );
58
59 OSQLRawQuery raw2( "insert into t2 VALUES(ROWID,'Meine Mutter') ");
60 res = driver->query(&raw2);
61
62};
diff --git a/examples/opiedb/sqltest/spaltenweise.cpp b/examples/opiedb/sqltest/spaltenweise.cpp
new file mode 100644
index 0000000..c11724c
--- a/dev/null
+++ b/examples/opiedb/sqltest/spaltenweise.cpp
@@ -0,0 +1,43 @@
1#include <qdir.h>
2
3#include <qpe/qpeapplication.h>
4#include <opie2/osqlmanager.h>
5#include <opie2/osqlquery.h>
6#include <opie2/osqldriver.h>
7#include <opie2/osqlresult.h>
8
9using namespace Opie::DB;
10
11int main( int argc, char* argv[] ) {
12
13 QPEApplication app( argc, argv );
14 OSQLManager man;
15 man.registerPath( QDir::currentDirPath() );
16 OSQLBackEnd::ValueList list = man.queryBackEnd();
17
18 OSQLDriver *driver = man.standard();
19 owarn << "testmain" + driver->id() << oendl;
20 driver->setUrl("/home/ich/spaltenweise");
21 if ( driver->open() ) {
22 owarn << "could open" << oendl;
23 }else
24 owarn << "wasn't able to open" << oendl;
25 OSQLRawQuery *raw = new OSQLRawQuery("create table todolist("
26 "uid,categories,completed,"
27 "progress,summary,HasDate,"
28 "DateDay,DateMonth,DateYear,"
29 "priority,description)" );
30
31 OSQLResult res = driver->query( raw );
32 delete raw;
33 for (int i = 0; i< 10000; i++ ) {
34 int uid = i;
35 OSQLRawQuery raw("insert into todolist VALUES("+
36 QString::number(uid)+ ",'-122324;-12132',1,100,"+
37 "'Summary234-"+QString::number(uid)+"',1,5,8,2002,1,"+
38 "'Description\n12344')");
39 OSQLResult res = driver->query( &raw );
40
41 }
42 return 0;
43};
diff --git a/examples/opiedb/sqltest/spaltenweise.pro b/examples/opiedb/sqltest/spaltenweise.pro
new file mode 100644
index 0000000..0335d16
--- a/dev/null
+++ b/examples/opiedb/sqltest/spaltenweise.pro
@@ -0,0 +1,13 @@
1 TEMPLATE= app
2 CONFIG = qt warn_on
3 HEADERS =
4 SOURCES = spaltenweise.cpp
5INCLUDEPATH += $(OPIEDIR)/include
6 DEPENDPATH+= $(OPIEDIR)/include
7LIBS += -lqpe -lopiedb2
8 TARGET = spaltenweise
9
10
11
12
13include( $(OPIEDIR)/include.pro )
diff --git a/examples/opiedb/sqltest/sqltest.pro b/examples/opiedb/sqltest/sqltest.pro
new file mode 100644
index 0000000..a4eee6b
--- a/dev/null
+++ b/examples/opiedb/sqltest/sqltest.pro
@@ -0,0 +1,17 @@
1TEMPLATE = app
2CONFIG = qt warn_on
3HEADERS =
4SOURCES = main.cpp
5INCLUDEPATH += $(OPIEDIR)/include
6DEPENDPATH += $(OPIEDIR)/include
7LIBS += -lqpe -lopiedb2 -lsqlite3
8TARGET = sqltest
9
10include( $(OPIEDIR)/include.pro )
11
12!isEmpty( LIBSQLITE_INC_DIR ) {
13 INCLUDEPATH = $$LIBSQLITE_INC_DIR $$INCLUDEPATH
14}
15!isEmpty( LIBSQLITE_LIB_DIR ) {
16 LIBS = -L$$LIBSQLITE_LIB_DIR $$LIBS
17}
diff --git a/examples/opiedb/sqltest/test.osql b/examples/opiedb/sqltest/test.osql
new file mode 100644
index 0000000..340e4f2
--- a/dev/null
+++ b/examples/opiedb/sqltest/test.osql
@@ -0,0 +1,4 @@
1Name = Test1
2Vendor = Zecke
3License = ZPL
4Preference = 15
diff --git a/examples/opiedb/sqltest/test2.osql b/examples/opiedb/sqltest/test2.osql
new file mode 100644
index 0000000..952c99b
--- a/dev/null
+++ b/examples/opiedb/sqltest/test2.osql
@@ -0,0 +1,5 @@
1Name = Test2
2Vendor = Schaf
3License = SPL
4Preference = 15
5Default = 0
diff --git a/examples/opiedb/sqltest/zeilenweise.cpp b/examples/opiedb/sqltest/zeilenweise.cpp
new file mode 100644
index 0000000..126e797
--- a/dev/null
+++ b/examples/opiedb/sqltest/zeilenweise.cpp
@@ -0,0 +1,86 @@
1#include <qdir.h>
2
3#include <qpe/qpeapplication.h>
4#include <opie2/osqlmanager.h>
5#include <opie2/osqlquery.h>
6#include <opie2/osqldriver.h>
7#include <opie2/osqlresult.h>
8
9using namespace Opie::DB;
10
11int main( int argc, char* argv[] ) {
12
13QPEApplication app( argc, argv );
14OSQLManager man;
15man.registerPath( QDir::currentDirPath() );
16OSQLBackEnd::ValueList list = man.queryBackEnd();
17
18OSQLDriver *driver = man.standard();
19 owarn << "testmain" + driver->id() << oendl;
20 driver->setUrl("/home/ich/zeilenweise");
21 if ( driver->open() ) {
22 owarn << "could open" << oendl;
23 }else
24 owarn << "wasn't able to open" << oendl;
25 OSQLRawQuery raw2("BEGIN TRANSACTION");
26 OSQLRawQuery *raw = new OSQLRawQuery("create table todolist(uid,key,value)");
27 OSQLResult res = driver->query( &raw2 );
28 res = driver->query( raw );
29 delete raw;
30 for (int i = 0; i< 10000; i++ ) {
31 int uid = i;
32 OSQLRawQuery *raw;
33 raw = new OSQLRawQuery("insert into todolist VALUES("+QString::number(uid)+",'Categories',"+"'-122324;-12132')");
34 OSQLResult res = driver->query(raw );
35 delete raw;
36
37 raw = new OSQLRawQuery("insert into todolist VALUES("+QString::number(uid) +
38 ",'Completed',1)" );
39 res = driver->query(raw );
40 delete raw;
41
42 raw = new OSQLRawQuery("insert into todolist VALUES("+
43 QString::number(uid)+",'Progress',100)" );
44 res = driver->query( raw );
45 delete raw;
46
47 raw = new OSQLRawQuery("insert into todolist VALUES("+
48 QString::number(uid)+",'Summary',"+
49 "'Summary234-"+ QString::number(uid) + "')");
50 res = driver->query( raw );
51 delete raw;
52
53 raw = new OSQLRawQuery("insert into todolist VALUES("+
54 QString::number(uid)+",'HasDate',1)");
55 res = driver->query( raw );
56 delete raw;
57
58 raw = new OSQLRawQuery("insert into todolist VALUES("+
59 QString::number(uid)+",'DateDay',5)");
60 res = driver->query( raw );
61 delete raw;
62
63 raw = new OSQLRawQuery("insert into todolist VALUES("+
64 QString::number(uid)+",'DateMonth',8)");
65 res = driver->query( raw );
66 delete raw;
67
68 raw = new OSQLRawQuery("insert into todolist VALUES("+
69 QString::number(uid)+",'DateYear',2002)");
70 res = driver->query( raw );
71 delete raw;
72
73 raw = new OSQLRawQuery("insert into todolist VALUES("+
74 QString::number(uid)+",'Priority',1)");
75 res = driver->query( raw );
76 delete raw;
77
78 raw = new OSQLRawQuery("insert into todolist VALUES("+
79 QString::number(uid)+",'Description','" +
80 QString::number(uid) + "Description\n12344')");
81 res = driver->query( raw );
82 delete raw;
83 }
84 OSQLRawQuery raw3("COMMIT");
85 res = driver->query(&raw3 );
86};
diff --git a/examples/opiedb/sqltest/zeilenweise.pro b/examples/opiedb/sqltest/zeilenweise.pro
new file mode 100644
index 0000000..1fa17cd
--- a/dev/null
+++ b/examples/opiedb/sqltest/zeilenweise.pro
@@ -0,0 +1,13 @@
1 TEMPLATE= app
2 CONFIG = qt warn_on
3 HEADERS =
4 SOURCES = zeilenweise.cpp
5INCLUDEPATH += $(OPIEDIR)/include
6 DEPENDPATH+= $(OPIEDIR)/include
7LIBS += -lqpe -lopiedb2
8 TARGET = zeilenweise
9
10
11
12
13include( $(OPIEDIR)/include.pro )
diff --git a/examples/opiemm/.cvsignore b/examples/opiemm/.cvsignore
new file mode 100644
index 0000000..8f7300c
--- a/dev/null
+++ b/examples/opiemm/.cvsignore
@@ -0,0 +1,6 @@
1Makefile*
2moc*
3*moc
4*.o
5~*
6
diff --git a/examples/opienet/.cvsignore b/examples/opienet/.cvsignore
new file mode 100644
index 0000000..8f7300c
--- a/dev/null
+++ b/examples/opienet/.cvsignore
@@ -0,0 +1,6 @@
1Makefile*
2moc*
3*moc
4*.o
5~*
6
diff --git a/examples/opienet/miniwellenreiter/.cvsignore b/examples/opienet/miniwellenreiter/.cvsignore
new file mode 100644
index 0000000..e0e629a
--- a/dev/null
+++ b/examples/opienet/miniwellenreiter/.cvsignore
@@ -0,0 +1,8 @@
1miniwellenreiter
2Makefile*
3obj
4moc*
5*moc
6*.o
7~*
8
diff --git a/examples/opienet/miniwellenreiter/miniwellenreiter.cpp b/examples/opienet/miniwellenreiter/miniwellenreiter.cpp
new file mode 100644
index 0000000..ebd3b5f
--- a/dev/null
+++ b/examples/opienet/miniwellenreiter/miniwellenreiter.cpp
@@ -0,0 +1,234 @@
1#include <qdict.h>
2#include <qsocketnotifier.h>
3#include <qstring.h>
4#include <opie2/onetwork.h>
5#include <qapplication.h>
6#include <opie2/opcap.h>
7#include <cerrno>
8#include <cstdio>
9#include <cstdlib>
10#include <cstring>
11
12
13using namespace Opie::Net;
14//======================== Station help class ===============================
15
16class Station
17{
18 public:
19 Station( QString t, int c, bool w ) : type(t), channel(c), wep(w), beacons(1) {};
20 ~Station() {};
21
22 QString type;
23 int channel;
24 bool wep;
25 int beacons;
26};
27
28QDict<Station> stations;
29
30//======================== Application class ===============================
31
32class Wellenreiter : public QApplication
33{
34Q_OBJECT
35public:
36 Wellenreiter( int argc, char** argv ) : QApplication( argc, argv ), channel( 1 )
37 {
38
39 ONetwork* net = ONetwork::instance();
40
41 if ( argc < 3 )
42 {
43 printf( "Usage: ./%s <interface> <driver> <interval>\n", argv[0] );
44 printf( "\n" );
45 printf( "Valid wireless interfaces (detected) are:\n" );
46
47 ONetwork::InterfaceIterator it = net->iterator();
48 while ( it.current() )
49 {
50 if ( it.current()->isWireless() )
51 {
52 printf( " - '%s' (MAC=%s) (IPv4=%s)\n", (const char*) it.current()->name(),
53 (const char*) it.current()->macAddress().toString(),
54 (const char*) it.current()->ipV4Address() );
55 }
56 ++it;
57 }
58 exit( -1 );
59 }
60
61 printf( "*******************************************************************\n" );
62 printf( "* Wellenreiter mini edition 1.0.0 (C) 2003 Michael 'Mickey' Lauer *\n" );
63 printf( "*******************************************************************\n" );
64 printf( "\n\n" );
65
66 QString interface( argv[1] );
67 QString driver( argv[2] );
68
69 printf( "Trying to use '%s' as %s-controlled device...\n", (const char*) interface, (const char*) driver );
70
71 // sanity checks before downcasting
72 ONetworkInterface* iface = net->interface( interface );
73 if ( !iface )
74 {
75 printf( "Interface '%s' doesn't exist. Exiting.\n", (const char*) interface );
76 exit( -1 );
77 }
78 if ( !iface->isWireless() )
79 {
80 printf( "Interface '%s' doesn't support wireless extensions. Exiting.\n", (const char*) interface );
81 exit( -1 );
82 }
83
84 // downcast should be safe now
85 wiface = (OWirelessNetworkInterface*) iface;
86 printf( "Using wireless interface '%s' for scanning (current SSID is '%s')...\n", (const char*) interface, (const char*) wiface->SSID() );
87
88 // ifconfig +promisc the interface to receive all packets
89 if ( !wiface->promiscuousMode() )
90 {
91 printf( "Interface status is not promisc... switching to promisc... " );
92 wiface->setPromiscuousMode( true );
93 if ( !wiface->promiscuousMode() )
94 {
95 printf( "failed (%s). Exiting.\n", strerror( errno ) );
96 exit( -1 );
97 }
98 else
99 {
100 printf( "ok.\n" );
101 }
102 }
103 else
104 printf( "Interface status is already promisc - good.\n" );
105
106 // connect a monitoring strategy to the interface
107 if ( driver == "orinoco" )
108 new OOrinocoMonitoringInterface( wiface, false );
109 else
110 if ( driver == "hostap" )
111 new OHostAPMonitoringInterface( wiface, false );
112 else
113 if ( driver == "wlan-ng" )
114 new OWlanNGMonitoringInterface( wiface, false );
115 else
116 {
117 printf( "Unknown driver. Exiting\n" );
118 exit( -1 );
119 }
120
121 // enable monitoring mode
122 printf( "Enabling monitor mode...\n" );
123 wiface->setMode( "monitor" );
124
125 // open a packet capturer
126 cap = new OPacketCapturer();
127 cap->open( interface );
128 if ( !cap->isOpen() )
129 {
130 printf( "Unable to open libpcap (%s). Exiting.\n", strerror( errno ) );
131 exit( -1 );
132 }
133
134 // set capturer to non-blocking mode
135 cap->setBlocking( false );
136
137 // start channel hopper
138 //wiface->setChannelHopping( 1000 );
139
140 // connect
141 connect( cap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
142 // timer
143 startTimer( 1000 );
144
145 }
146
147 ~Wellenreiter() {};
148
149public slots:
150 virtual void timerEvent(QTimerEvent* e)
151 {
152 wiface->setChannel( channel++ );
153 if ( channel == 14 ) channel = 1;
154 }
155
156 void receivePacket(OPacket* p)
157 {
158 if (!p)
159 {
160 printf( "(empty packet received)\n" );
161 return;
162 }
163
164 OWaveLanManagementPacket* beacon = (OWaveLanManagementPacket*) p->child( "802.11 Management" );
165 if ( beacon )
166 {
167 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
168 QString essid = ssid ? ssid->ID() : QString::fromLatin1( "<unknown>" );
169
170 if ( stations.find( essid ) )
171 stations[essid]->beacons++;
172 else
173 {
174 printf( "found new network @ channel %d, SSID = '%s'\n", wiface->channel(), (const char*) essid );
175 stations.insert( essid, new Station( "unknown", wiface->channel(),
176 ((OWaveLanPacket*) beacon->parent())->usesWep() ) );
177 }
178 return;
179 }
180
181 OWaveLanDataPacket* data = (OWaveLanDataPacket*) p->child( "802.11 Data" );
182 if ( data )
183 {
184 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" );
185 if ( wlan->fromDS() && !wlan->toDS() )
186 {
187 printf( "FromDS: '%s' -> '%s' via '%s'\n",
188 (const char*) wlan->macAddress3().toString(true),
189 (const char*) wlan->macAddress1().toString(true),
190 (const char*) wlan->macAddress2().toString(true) );
191 }
192 else
193 if ( !wlan->fromDS() && wlan->toDS() )
194 {
195 printf( "ToDS: '%s' -> '%s' via '%s'\n",
196 (const char*) wlan->macAddress2().toString(true),
197 (const char*) wlan->macAddress3().toString(true),
198 (const char*) wlan->macAddress1().toString(true) );
199 }
200 else
201 if ( wlan->fromDS() && wlan->toDS() )
202 {
203 printf( "WSD(bridge): '%s' -> '%s' via '%s' and '%s'\n",
204 (const char*) wlan->macAddress4().toString(true),
205 (const char*) wlan->macAddress3().toString(true),
206 (const char*) wlan->macAddress1().toString(true),
207 (const char*) wlan->macAddress2().toString(true) );
208 }
209 else
210 {
211 printf( "IBSS(AdHoc): '%s' -> '%s' (Cell: '%s')'\n",
212 (const char*) wlan->macAddress2().toString(true),
213 (const char*) wlan->macAddress1().toString(true),
214 (const char*) wlan->macAddress3().toString(true) );
215 }
216 return;
217 }
218 }
219private:
220 OPacketCapturer* cap;
221 OWirelessNetworkInterface* wiface;
222 int channel;
223};
224
225
226int main( int argc, char** argv )
227{
228 Wellenreiter w( argc, argv );
229 w.exec();
230 return 0;
231}
232
233#include "miniwellenreiter.moc"
234
diff --git a/examples/opienet/miniwellenreiter/miniwellenreiter.pro b/examples/opienet/miniwellenreiter/miniwellenreiter.pro
new file mode 100644
index 0000000..d7c1fc2
--- a/dev/null
+++ b/examples/opienet/miniwellenreiter/miniwellenreiter.pro
@@ -0,0 +1,19 @@
1TEMPLATE = app
2CONFIG = qt warn_on
3HEADERS =
4SOURCES = miniwellenreiter.cpp
5INCLUDEPATH += $(OPIEDIR)/include
6DEPENDPATH += $(OPIEDIR)/include
7LIBS += -lopiecore2 -lopienet2
8TARGET = miniwellenreiter
9MOC_DIR = moc
10OBJECTS_DIR = obj
11
12include( $(OPIEDIR)/include.pro )
13
14!isEmpty( LIBPCAP_INC_DIR ) {
15 INCLUDEPATH = $$LIBPCAP_INC_DIR $$INCLUDEPATH
16}
17!isEmpty( LIBPCAP_LIB_DIR ) {
18 LIBS = -L$$LIBPCAP_LIB_DIR $$LIBS
19}
diff --git a/examples/opienet/onetworkdemo/.cvsignore b/examples/opienet/onetworkdemo/.cvsignore
new file mode 100644
index 0000000..c2638e5
--- a/dev/null
+++ b/examples/opienet/onetworkdemo/.cvsignore
@@ -0,0 +1,8 @@
1onetworkdemo
2Makefile*
3obj
4moc*
5*moc
6*.o
7~*
8
diff --git a/examples/opienet/onetworkdemo/onetworkdemo.cpp b/examples/opienet/onetworkdemo/onetworkdemo.cpp
new file mode 100644
index 0000000..e0c93a2
--- a/dev/null
+++ b/examples/opienet/onetworkdemo/onetworkdemo.cpp
@@ -0,0 +1,176 @@
1/*
2 =. This file is part of the Opie Project
3 .=l. Copyright (C) 2004 Opie Team <opie-devel@handhelds.org>
4 .>+-=
5 _;:, .> :=|. This library is free software; you can
6.> <`_, > . <= redistribute it and/or modify it under
7:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
8.="- .-=="i, .._ License as published by the Free Software
9 - . .-<_> .<> Foundation; either version 2 of the License,
10 ._= =} : or (at your option) any later version.
11 .%`+i> _;_.
12 .i_,=:_. -<s. This library is distributed in the hope that
13 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
14 : .. .:, . . . without even the implied warranty of
15 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
16 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.= = ; Library General Public License for more
18++= -. .` .: details.
19 : = ...= . :.=-
20 -. .:....=;==+<; You should have received a copy of the GNU
21 -_. . . )=. = Library General Public License along with
22 -- :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
28
29/* OPIE */
30#include <opie2/onetwork.h>
31#include <opie2/ostation.h>
32#include <opie2/omanufacturerdb.h>
33#include <opie2/odebug.h>
34
35/* STD */
36#include <unistd.h>
37
38using namespace Opie::Net;
39
40int main( int argc, char** argv )
41{
42 odebug << "OPIE Network Demo" << oendl;
43
44 ONetwork* net = ONetwork::instance();
45
46 ONetwork::InterfaceIterator it = net->iterator();
47
48 while ( it.current() )
49 {
50 odebug << "DEMO: ONetwork contains Interface '" << it.current()->name() << "'" << oendl;
51 odebug << "DEMO: Datalink code is '" << it.current()->dataLinkType() << "'" << oendl;
52 odebug << "DEMO: MAC Address is '" << it.current()->macAddress().toString() << "'" << oendl;
53 odebug << "DEMO: MAC Address is '" << it.current()->macAddress().toString(true) << "'" << oendl;
54 odebug << "DEMO: MAC Manufacturer seems to be '" << it.current()->macAddress().manufacturer() << "'" << oendl;
55 odebug << "DEMO: Manufacturertest1 = '" << OManufacturerDB::instance()->lookupExt( "08:00:87" ) << "'" << oendl;
56 odebug << "DEMO: Manufacturertest2 = '" << OManufacturerDB::instance()->lookupExt( "E2:0C:0F" ) << "'" << oendl;
57 odebug << "Demo: IPv4 Address is '" << it.current()->ipV4Address() << "'" << oendl;
58 if ( it.current()->isWireless() )
59 {
60 OWirelessNetworkInterface* iface = static_cast<OWirelessNetworkInterface*>( it.current() );
61 odebug << "DEMO: '" << iface->name() << "' seems to feature the wireless extensions." << oendl;
62 odebug << "DEMO: Current SSID is '" << iface->SSID() << "'" << oendl;
63 odebug << "DEMO: Antenna is tuned to '" << iface->frequency() << "', that is channel " << iface->channel() << "" << oendl;
64
65 //if ( iface->mode() == OWirelessNetworkInterface::adhoc )
66 //{
67 //odebug << "DEMO: Associated AP has MAC Address '" << iface->associatedAP().toString() << "'" << oendl;
68 //}
69
70 /*
71
72 // nickname
73 odebug << "DEMO: Current NickName is '" << iface->nickName() << "'" << oendl;
74 iface->setNickName( "MyNickName" );
75 if ( iface->nickName() != "MyNickName" )
76 odebug << "DEMO: Warning! Can't change nickname" << oendl;
77 else
78 odebug << "DEMO: Nickname change successful." << oendl;
79
80 /*
81
82 // operation mode
83 odebug << "DEMO: Current OperationMode is '" << iface->mode() << "'" << oendl;
84 iface->setMode( "adhoc" );
85 if ( iface->mode() != "adhoc" )
86 odebug << "DEMO: Warning! Can't change operation mode" << oendl;
87 else
88 odebug << "DEMO: Operation Mode change successful." << oendl;
89
90 // RF channel
91 odebug << "DEMO: Current Channel is '" << iface->channel() << "'" << oendl;
92 iface->setChannel( 1 );
93 if ( iface->channel() != 1 )
94 odebug << "DEMO: Warning! Can't change RF channel" << oendl;
95 else
96 odebug << "DEMO: RF channel change successful." << oendl;
97
98 iface->setMode( "managed" );
99
100 */
101
102 /*
103
104 // network scan
105
106 OStationList* stations = iface->scanNetwork();
107 if ( stations )
108 {
109 odebug << "DEMO: # of stations around = " << stations->count() << "" << oendl;
110 OStation* station;
111 for ( station = stations->first(); station != 0; station = stations->next() )
112 {
113 odebug << "DEMO: station dump following..." << oendl;
114 station->dump();
115 }
116 }
117
118 else
119 {
120 odebug << "DEMO: Warning! Scan didn't work!" << oendl;
121 }
122
123 /*
124
125 // first some wrong calls to check if this is working
126 iface->setPrivate( "seppel", 10 );
127 iface->setPrivate( "monitor", 0 );
128
129 // now the real deal
130 iface->setPrivate( "monitor", 2, 2, 3 );
131
132 // trying to set hw address to 12:34:56:AB:CD:EF
133
134 /*
135
136 OMacAddress addr = OMacAddress::fromString( "12:34:56:AB:CD:EF" );
137 iface->setUp( false );
138 iface->setMacAddress( addr );
139 iface->setUp( true );
140 odebug << "DEMO: MAC Address now is '" << iface->macAddress().toString() << "'" << oendl;
141
142 */
143
144 // monitor test
145
146
147
148 odebug << "DEMO: current interface mode is '" << iface->mode() << "'" << oendl;
149 iface->setMode( "monitor" );
150 odebug << "DEMO: current interface mode is '" << iface->mode() << "'" << oendl;
151
152 sleep( 1 );
153
154 iface->setChannel( 1 );
155 iface->setMode( "managed" );
156
157 //sleep( 1 );
158 odebug << "DEMO: current interface mode is '" << iface->mode() << "'" << oendl;
159
160 /*iface->setMode( "adhoc" );
161 sleep( 1 );
162 odebug << "DEMO: current interface mode is '" << iface->mode() << "'" << oendl;
163 iface->setMode( "managed" );
164 sleep( 1 );
165 odebug << "DEMO: current interface mode is '" << iface->mode() << "'" << oendl;
166 iface->setMode( "master" );
167 sleep( 1 );
168 odebug << "DEMO: current interface mode is '" << iface->mode() << "'" << oendl; */
169
170 }
171 ++it;
172 }
173
174 return 0;
175
176}
diff --git a/examples/opienet/onetworkdemo/onetworkdemo.pro b/examples/opienet/onetworkdemo/onetworkdemo.pro
new file mode 100644
index 0000000..cf293b5
--- a/dev/null
+++ b/examples/opienet/onetworkdemo/onetworkdemo.pro
@@ -0,0 +1,12 @@
1TEMPLATE = app
2CONFIG = qt warn_on
3HEADERS =
4SOURCES = onetworkdemo.cpp
5INCLUDEPATH += $(OPIEDIR)/include
6DEPENDPATH += $(OPIEDIR)/include
7LIBS += -lopiecore2 -lopienet2
8TARGET = onetworkdemo
9MOC_DIR = moc
10OBJECTS_DIR = obj
11
12include( $(OPIEDIR)/include.pro )
diff --git a/examples/opienet/opienet.pro b/examples/opienet/opienet.pro
new file mode 100644
index 0000000..c7800a9
--- a/dev/null
+++ b/examples/opienet/opienet.pro
@@ -0,0 +1,3 @@
1TEMPLATE = subdirs
2SUBDIRS = miniwellenreiter onetworkdemo
3
diff --git a/examples/opieui/.cvsignore b/examples/opieui/.cvsignore
new file mode 100644
index 0000000..8f7300c
--- a/dev/null
+++ b/examples/opieui/.cvsignore
@@ -0,0 +1,6 @@
1Makefile*
2moc*
3*moc
4*.o
5~*
6