summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetooth.pro2
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NN.cpp16
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp4
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h5
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h5
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp4
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h5
-rw-r--r--noncore/settings/networksettings2/cable/cable.pro2
-rw-r--r--noncore/settings/networksettings2/cable/cable_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/gprs/GPRS.pro2
-rw-r--r--noncore/settings/networksettings2/gprs/GPRS_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/irda/irda.pro2
-rw-r--r--noncore/settings/networksettings2/irda/irda_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/lancard/lancard.pro2
-rw-r--r--noncore/settings/networksettings2/lancard/lancard_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/modem/modem.pro2
-rw-r--r--noncore/settings/networksettings2/modem/modem_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/network/network.pro2
-rw-r--r--noncore/settings/networksettings2/network/network_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/networksettings2/netnodeinterface.h139
-rw-r--r--noncore/settings/networksettings2/networksettings2/resources.cpp179
-rw-r--r--noncore/settings/networksettings2/networksettings2/resources.h65
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTDevice.h6
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTDeviceAddress.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTDriver.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTGateway.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTHCISocket.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTIcons.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTInquiry.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTPeer.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTSDPAttribute.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTSDPService.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTUUID.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/Opietooth.h14
-rw-r--r--noncore/settings/networksettings2/ppp/ppp.pro2
-rw-r--r--noncore/settings/networksettings2/ppp/ppp_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/profile/profile.pro2
-rw-r--r--noncore/settings/networksettings2/profile/profile_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/usb/usb.pro2
-rw-r--r--noncore/settings/networksettings2/usb/usb_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/usb/usb_NNI.cpp2
-rw-r--r--noncore/settings/networksettings2/vpn/vpn.pro2
-rw-r--r--noncore/settings/networksettings2/vpn/vpn_NN.cpp15
-rw-r--r--noncore/settings/networksettings2/wlan/wlan.pro2
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NN.cpp15
45 files changed, 576 insertions, 77 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth.pro b/noncore/settings/networksettings2/bluetooth/bluetooth.pro
index 2e3b5bb..053a6cb 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetooth.pro
+++ b/noncore/settings/networksettings2/bluetooth/bluetooth.pro
@@ -1,26 +1,26 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release plugin
3DESTDIR = $(OPIEDIR)/plugins/networksettings2 3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = bluetoothBNEP_NN.h \ 4 HEADERS = bluetoothBNEP_NN.h \
5 bluetoothBNEP_NNI.h \ 5 bluetoothBNEP_NNI.h \
6 bluetoothRFCOMM_NN.h \ 6 bluetoothRFCOMM_NN.h \
7 bluetoothRFCOMM_NNI.h \ 7 bluetoothRFCOMM_NNI.h \
8 bluetoothBNEPedit.h \ 8 bluetoothBNEPedit.h \
9 bluetoothRFCOMMrun.h \ 9 bluetoothRFCOMMrun.h \
10 bluetoothRFCOMMedit.h 10 bluetoothRFCOMMedit.h
11 SOURCES = bluetoothBNEP_NN.cpp \ 11 SOURCES = bluetoothBNEP_NN.cpp \
12 bluetoothBNEP_NNI.cpp \ 12 bluetoothBNEP_NNI.cpp \
13 bluetoothRFCOMM_NN.cpp \ 13 bluetoothRFCOMM_NN.cpp \
14 bluetoothRFCOMM_NNI.cpp \ 14 bluetoothRFCOMM_NNI.cpp \
15 bluetoothBNEPedit.cpp \ 15 bluetoothBNEPedit.cpp \
16 bluetoothBNEPrun.cpp \ 16 bluetoothBNEPrun.cpp \
17 bluetoothRFCOMMrun.cpp \ 17 bluetoothRFCOMMrun.cpp \
18 bluetoothRFCOMMedit.cpp 18 bluetoothRFCOMMedit.cpp
19 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 ../opietooth2 19 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 ../opietooth2
20 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 ../opietooth2 20 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 ../opietooth2
21LIBS += -lqpe -lopietooth2 21LIBS += -lqpe -lopietooth2
22 INTERFACES= bluetoothBNEPGUI.ui bluetoothRFCOMMGUI.ui 22 INTERFACES= bluetoothBNEPGUI.ui bluetoothRFCOMMGUI.ui
23 TARGET = bluetooth 23 TARGET = bluetooth
24 VERSION = 1.0.0 24 VERSION = 1.0.0
25 25
26include( $(OPIEDIR)/include.pro ) 26include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NN.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NN.cpp
index ee3e92b..5e4d951 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NN.cpp
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NN.cpp
@@ -1,78 +1,94 @@
1#include "bluetoothBNEP_NN.h" 1#include "bluetoothBNEP_NN.h"
2#include "bluetoothBNEP_NNI.h" 2#include "bluetoothBNEP_NNI.h"
3#include "bluetoothRFCOMM_NNI.h" 3#include "bluetoothRFCOMM_NNI.h"
4 4
5#ifndef MYPLUGIN
6
7#include "netnodeinterface.h"
8
9#endif
10
5// 11//
6// 12//
7// BLUETOOTH PAN/NAP node 13// BLUETOOTH PAN/NAP node
8// 14//
9// 15//
10 16
11static const char * BluetoothBNEPNeeds[] = 17static const char * BluetoothBNEPNeeds[] =
12 { 0 18 { 0
13 }; 19 };
14 20
15static const char * BluetoothBNEPProvides[] = 21static const char * BluetoothBNEPProvides[] =
16 { "device", 22 { "device",
17 0 23 0
18 }; 24 };
19 25
20/** 26/**
21 * Constructor, find all of the possible interfaces 27 * Constructor, find all of the possible interfaces
22 */ 28 */
23BluetoothBNEPNetNode::BluetoothBNEPNetNode() : 29BluetoothBNEPNetNode::BluetoothBNEPNetNode() :
24 ANetNode(tr("Bluetooth PAN/NAP")) { 30 ANetNode(tr("Bluetooth PAN/NAP")) {
25 InstanceCount = 7; // default 31 InstanceCount = 7; // default
26} 32}
27 33
28/** 34/**
29 * Delete any interfaces that we own. 35 * Delete any interfaces that we own.
30 */ 36 */
31BluetoothBNEPNetNode::~BluetoothBNEPNetNode(){ 37BluetoothBNEPNetNode::~BluetoothBNEPNetNode(){
32} 38}
33 39
34const QString BluetoothBNEPNetNode::nodeDescription(){ 40const QString BluetoothBNEPNetNode::nodeDescription(){
35 return tr("\ 41 return tr("\
36<p>Sets up a bluetooth link using the bluetooth Network profile.</p>\ 42<p>Sets up a bluetooth link using the bluetooth Network profile.</p>\
37<p>Use this to connect two computing devices.</p>\ 43<p>Use this to connect two computing devices.</p>\
38" 44"
39); 45);
40} 46}
41 47
42ANetNodeInstance * BluetoothBNEPNetNode::createInstance( void ) { 48ANetNodeInstance * BluetoothBNEPNetNode::createInstance( void ) {
43 return new ABluetoothBNEP( this ); 49 return new ABluetoothBNEP( this );
44} 50}
45 51
46const char ** BluetoothBNEPNetNode::needs( void ) { 52const char ** BluetoothBNEPNetNode::needs( void ) {
47 return BluetoothBNEPNeeds; 53 return BluetoothBNEPNeeds;
48} 54}
49 55
50const char ** BluetoothBNEPNetNode::provides( void ) { 56const char ** BluetoothBNEPNetNode::provides( void ) {
51 return BluetoothBNEPProvides; 57 return BluetoothBNEPProvides;
52} 58}
53 59
54QString BluetoothBNEPNetNode::genNic( long nr ) { 60QString BluetoothBNEPNetNode::genNic( long nr ) {
55 QString S; 61 QString S;
56 return S.sprintf( "bnep%ld", nr ); 62 return S.sprintf( "bnep%ld", nr );
57} 63}
58 64
59 65
60void BluetoothBNEPNetNode::setSpecificAttribute( QString & A, QString & V ) { 66void BluetoothBNEPNetNode::setSpecificAttribute( QString & A, QString & V ) {
61 if( A == "interfacecount" ) { 67 if( A == "interfacecount" ) {
62 InstanceCount = V.toLong(); 68 InstanceCount = V.toLong();
63 } 69 }
64} 70}
65 71
66void BluetoothBNEPNetNode::saveSpecificAttribute( QTextStream & TS) { 72void BluetoothBNEPNetNode::saveSpecificAttribute( QTextStream & TS) {
67 TS << "interfacecount=" 73 TS << "interfacecount="
68 << InstanceCount 74 << InstanceCount
69 << endl; 75 << endl;
70} 76}
71 77
78#ifndef MYPLUGIN
79
72extern "C" { 80extern "C" {
73// create plugin registers both BT functions 81// create plugin registers both BT functions
74void create_plugin( QList<ANetNode> & PNN ) { 82void create_plugin( QList<ANetNode> & PNN ) {
75 PNN.append( new BluetoothBNEPNetNode() ); 83 PNN.append( new BluetoothBNEPNetNode() );
76 PNN.append( new BluetoothRFCOMMNetNode() ); 84 PNN.append( new BluetoothRFCOMMNetNode() );
77} 85}
86
87#else
88
89typedef Opie::Core::MakeTypelist<BluetoothBNEPNetNode, BluetoothRFCOMMNetNode>::Result BluetoothTypes;
90OPIE_NS2_PLUGIN( NetNodeInterface<BluetoothTypes> )
91
92#endif
93
78} 94}
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp
index 9d4ae97..5c937a1 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp
@@ -1,161 +1,165 @@
1#include <qfile.h> 1#include <qfile.h>
2#include <qfileinfo.h> 2#include <qfileinfo.h>
3#include <qtextstream.h> 3#include <qtextstream.h>
4#include <resources.h> 4#include <resources.h>
5#include "bluetoothBNEPrun.h" 5#include "bluetoothBNEPrun.h"
6 6
7using Opietooth2::OTGateway;
8using Opietooth2::OTPANConnection;
9using Opietooth2::PANConnectionVector;
10
7BluetoothBNEPRun::BluetoothBNEPRun( ANetNodeInstance * NNI, 11BluetoothBNEPRun::BluetoothBNEPRun( ANetNodeInstance * NNI,
8 BluetoothBNEPData & D ) : 12 BluetoothBNEPData & D ) :
9 RuntimeInfo( NNI ), 13 RuntimeInfo( NNI ),
10 Data( D), 14 Data( D),
11 Pat( "bnep[0-6]" ) { 15 Pat( "bnep[0-6]" ) {
12 OT = 0; 16 OT = 0;
13} 17}
14 18
15BluetoothBNEPRun::~BluetoothBNEPRun( void ) { 19BluetoothBNEPRun::~BluetoothBNEPRun( void ) {
16 if( OT ) { 20 if( OT ) {
17 OTGateway::releaseOTGateway(); 21 OTGateway::releaseOTGateway();
18 } 22 }
19} 23}
20 24
21State_t BluetoothBNEPRun::detectState( void ) { 25State_t BluetoothBNEPRun::detectState( void ) {
22 26
23 /* 27 /*
24 28
25 need to detect 29 need to detect
26 30
27 1. for any PAN connection that is found if that 31 1. for any PAN connection that is found if that
28 PAN is connected. 32 PAN is connected.
29 33
30 if it is connected it is not available (since we do 34 if it is connected it is not available (since we do
31 not manage IP settings and we are called to detect 35 not manage IP settings and we are called to detect
32 the state we knwo that we do not have an UP connection) 36 the state we knwo that we do not have an UP connection)
33 37
34 2. if it not connected and we allow any connection we 38 2. if it not connected and we allow any connection we
35 are available or if that PAN connection is to a device 39 are available or if that PAN connection is to a device
36 with a correct address 40 with a correct address
37 41
38 3. if it is not connected and the address do not match or 42 3. if it is not connected and the address do not match or
39 we do not accept any address, we are Unavailable but 43 we do not accept any address, we are Unavailable but
40 not DOWN. I.e a new connection could perhaps be created 44 not DOWN. I.e a new connection could perhaps be created
41 45
42 */ 46 */
43 47
44 if( ! OT ) { 48 if( ! OT ) {
45 OT = OTGateway::getOTGateway(); 49 OT = OTGateway::getOTGateway();
46 } 50 }
47 51
48 if( ! OT->isEnabled() ) { 52 if( ! OT->isEnabled() ) {
49 return Unavailable; 53 return Unavailable;
50 } 54 }
51 55
52 // if there is a PAN connection that is UP but not 56 // if there is a PAN connection that is UP but not
53 // yet configured (no ifup) the we are available 57 // yet configured (no ifup) the we are available
54 return ( hasFreePANConnection() ) ? Available : Unknown; 58 return ( hasFreePANConnection() ) ? Available : Unknown;
55} 59}
56 60
57QString BluetoothBNEPRun::setMyState( NodeCollection * NC, Action_t A, bool ) { 61QString BluetoothBNEPRun::setMyState( NodeCollection * NC, Action_t A, bool ) {
58 62
59 if( A == Activate ) { 63 if( A == Activate ) {
60 if( hasFreePANConnection( 1 ) ) { 64 if( hasFreePANConnection( 1 ) ) {
61 // we have now an assignedinterface 65 // we have now an assignedinterface
62 } else { 66 } else {
63 return QString("TODO : Start PAND"); 67 return QString("TODO : Start PAND");
64 } 68 }
65 69
66 Log(( "Assigned interface" )); 70 Log(( "Assigned interface" ));
67 NC->setCurrentState( Available ); 71 NC->setCurrentState( Available );
68 72
69 return QString(); 73 return QString();
70 } 74 }
71 75
72 if( A == Deactivate ) { 76 if( A == Deactivate ) {
73 // nothing to do 77 // nothing to do
74 NC->setCurrentState( Off ); 78 NC->setCurrentState( Off );
75 return QString(); 79 return QString();
76 } 80 }
77 return QString(); 81 return QString();
78} 82}
79 83
80bool BluetoothBNEPRun::handlesInterface( const QString & S ) { 84bool BluetoothBNEPRun::handlesInterface( const QString & S ) {
81 return Pat.match( S ) >= 0; 85 return Pat.match( S ) >= 0;
82} 86}
83 87
84bool BluetoothBNEPRun::handlesInterface( InterfaceInfo * I ) { 88bool BluetoothBNEPRun::handlesInterface( InterfaceInfo * I ) {
85 return handlesInterface( I->Name ); 89 return handlesInterface( I->Name );
86} 90}
87 91
88bool BluetoothBNEPRun::hasFreePANConnection( bool Grab ) { 92bool BluetoothBNEPRun::hasFreePANConnection( bool Grab ) {
89 93
90 if( ! OT ) { 94 if( ! OT ) {
91 OT = OTGateway::getOTGateway(); 95 OT = OTGateway::getOTGateway();
92 } 96 }
93 97
94 // load PAN connections 98 // load PAN connections
95 OTPANConnection * C; 99 OTPANConnection * C;
96 InterfaceInfo * Run; 100 InterfaceInfo * Run;
97 InterfaceInfo * Candidate = 0; // reuse this interface 101 InterfaceInfo * Candidate = 0; // reuse this interface
98 PANConnectionVector Conns = OT->getPANConnections(); 102 PANConnectionVector Conns = OT->getPANConnections();
99 System & Sys = NSResources->system(); 103 System & Sys = NSResources->system();
100 bool IsValid; 104 bool IsValid;
101 105
102 for( unsigned int i = 0; 106 for( unsigned int i = 0;
103 i < Conns.count(); 107 i < Conns.count();
104 i ++ ) { 108 i ++ ) {
105 C = Conns[i]; 109 C = Conns[i];
106 110
107 if( Data.AllowAll ) { 111 if( Data.AllowAll ) {
108 // we allow all 112 // we allow all
109 IsValid = 1; 113 IsValid = 1;
110 } else { 114 } else {
111 // is this PAN connection connecting to a Peer 115 // is this PAN connection connecting to a Peer
112 // we allow ? 116 // we allow ?
113 IsValid = 0; 117 IsValid = 0;
114 for ( QStringList::Iterator it = Data.BDAddress.begin(); 118 for ( QStringList::Iterator it = Data.BDAddress.begin();
115 it != Data.BDAddress.end(); 119 it != Data.BDAddress.end();
116 ++ it ) { 120 ++ it ) {
117 if( C->ConnectedTo == (*it) ) { 121 if( C->ConnectedTo == (*it) ) {
118 // this is a connection we could accept 122 // this is a connection we could accept
119 IsValid = 1; 123 IsValid = 1;
120 break; 124 break;
121 } 125 }
122 } 126 }
123 } 127 }
124 128
125 if( ! IsValid ) { 129 if( ! IsValid ) {
126 Log(("%s to %s not acceptable\n", 130 Log(("%s to %s not acceptable\n",
127 C->Device.latin1(), 131 C->Device.latin1(),
128 C->ConnectedTo.latin1() )); 132 C->ConnectedTo.latin1() ));
129 // don't bother checking this address 133 // don't bother checking this address
130 // it is not acceptable 134 // it is not acceptable
131 continue; 135 continue;
132 } 136 }
133 137
134 // is this PAN connection available to us ? 138 // is this PAN connection available to us ?
135 Run = Sys.findInterface( C->Device ); 139 Run = Sys.findInterface( C->Device );
136 140
137 if( Run && Run->IsUp ) { 141 if( Run && Run->IsUp ) {
138 // this PAN connection is up 142 // this PAN connection is up
139 Log(("%s acceptable but unavailable\n", 143 Log(("%s acceptable but unavailable\n",
140 C->Device.latin1() )); 144 C->Device.latin1() ));
141 // find others 145 // find others
142 continue; 146 continue;
143 } 147 }
144 148
145 // we at least have a possible interface 149 // we at least have a possible interface
146 if( ! Candidate ) { 150 if( ! Candidate ) {
147 Candidate = Run; 151 Candidate = Run;
148 } 152 }
149 } 153 }
150 154
151 if( Candidate ) { 155 if( Candidate ) {
152 if ( Grab ) { 156 if ( Grab ) {
153 netNode()->connection()->assignInterface( Candidate ); 157 netNode()->connection()->assignInterface( Candidate );
154 } 158 }
155 return 1; 159 return 1;
156 } 160 }
157 161
158 // no free PAN 162 // no free PAN
159 return 0; 163 return 0;
160} 164}
161 165
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h
index a05a7a2..8551a2e 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h
@@ -1,35 +1,34 @@
1#include <netnode.h> 1#include <netnode.h>
2#include "bluetoothBNEPdata.h" 2#include "bluetoothBNEPdata.h"
3 3
4#include <OTGateway.h> 4#include <OTGateway.h>
5using namespace Opietooth2;
6 5
7class BluetoothBNEPRun : public RuntimeInfo { 6class BluetoothBNEPRun : public RuntimeInfo {
8 7
9public : 8public :
10 9
11 BluetoothBNEPRun( ANetNodeInstance * NNI, 10 BluetoothBNEPRun( ANetNodeInstance * NNI,
12 BluetoothBNEPData & D ); 11 BluetoothBNEPData & D );
13 virtual ~BluetoothBNEPRun( void ); 12 virtual ~BluetoothBNEPRun( void );
14 13
15 // i am a device 14 // i am a device
16 virtual RuntimeInfo * device( void ) 15 virtual RuntimeInfo * device( void )
17 { return this; } 16 { return this; }
18 17
19 bool handlesInterface( const QString & ); 18 bool handlesInterface( const QString & );
20 bool handlesInterface( InterfaceInfo * ); 19 bool handlesInterface( InterfaceInfo * );
21 20
22 State_t detectState( void ); 21 State_t detectState( void );
23 22
24protected : 23protected :
25 24
26 QString setMyState( NodeCollection * , Action_t, bool ); 25 QString setMyState( NodeCollection * , Action_t, bool );
27 26
28private : 27private :
29 28
30 bool hasFreePANConnection( bool Grab = 0 ); 29 bool hasFreePANConnection( bool Grab = 0 );
31 30
32 BluetoothBNEPData & Data; 31 BluetoothBNEPData & Data;
33 OTGateway * OT; 32 Opietooth2::OTGateway * OT;
34 QRegExp Pat; 33 QRegExp Pat;
35}; 34};
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h
index 9ad8f2a..fe474fc 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h
@@ -1,27 +1,26 @@
1#include "bluetoothRFCOMMdata.h" 1#include "bluetoothRFCOMMdata.h"
2#include "bluetoothRFCOMMGUI.h" 2#include "bluetoothRFCOMMGUI.h"
3 3
4#include <Opietooth.h> 4#include <Opietooth.h>
5using namespace Opietooth2;
6 5
7class BluetoothRFCOMMEdit : public BluetoothRFCOMMGUI { 6class BluetoothRFCOMMEdit : public BluetoothRFCOMMGUI {
8 7
9public : 8public :
10 9
11 BluetoothRFCOMMEdit( QWidget * parent ); 10 BluetoothRFCOMMEdit( QWidget * parent );
12 virtual ~BluetoothRFCOMMEdit( void ); 11 virtual ~BluetoothRFCOMMEdit( void );
13 12
14 QString acceptable( void ); 13 QString acceptable( void );
15 void showData( BluetoothRFCOMMData & Data ); 14 void showData( BluetoothRFCOMMData & Data );
16 bool commit( BluetoothRFCOMMData & Data ); 15 bool commit( BluetoothRFCOMMData & Data );
17 16
18 bool Modified; 17 bool Modified;
19 OTGateway * OT; 18 Opietooth2::OTGateway * OT;
20 19
21public slots : 20public slots :
22 21
23 void SLOT_AddServer( void ); 22 void SLOT_AddServer( void );
24 void SLOT_RemoveServer( void ); 23 void SLOT_RemoveServer( void );
25 void SLOT_FindDevice( void ); 24 void SLOT_FindDevice( void );
26 25
27}; 26};
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp
index 1e91ed1..ef6878a 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp
@@ -1,162 +1,164 @@
1#include <qapplication.h> 1#include <qapplication.h>
2#include <resources.h> 2#include <resources.h>
3#include <OTDevice.h> 3#include <OTDevice.h>
4#include <OTGateway.h> 4#include <OTGateway.h>
5#include "bluetoothRFCOMMrun.h" 5#include "bluetoothRFCOMMrun.h"
6 6
7using namespace Opietooth2; 7using Opietooth2::OTGateway;
8using Opietooth2::OTDevice;
9using Opietooth2::OTDeviceAddress;
8 10
9BluetoothRFCOMMRun::~BluetoothRFCOMMRun( void ) { 11BluetoothRFCOMMRun::~BluetoothRFCOMMRun( void ) {
10 if( OT ) { 12 if( OT ) {
11 OTGateway::releaseOTGateway(); 13 OTGateway::releaseOTGateway();
12 } 14 }
13} 15}
14 16
15State_t BluetoothRFCOMMRun::detectState( void ) { 17State_t BluetoothRFCOMMRun::detectState( void ) {
16 18
17 if( ! OT ) { 19 if( ! OT ) {
18 OT = OTGateway::getOTGateway(); 20 OT = OTGateway::getOTGateway();
19 } 21 }
20 22
21 if( deviceNrOfConnection() >= 0 ) { 23 if( deviceNrOfConnection() >= 0 ) {
22 return Available; 24 return Available;
23 } 25 }
24 26
25 owarn << "Bluetooth " 27 owarn << "Bluetooth "
26 << OT->isEnabled() 28 << OT->isEnabled()
27 << oendl; 29 << oendl;
28 30
29 return ( OT->isEnabled() ) ? Off : Unavailable; 31 return ( OT->isEnabled() ) ? Off : Unavailable;
30} 32}
31 33
32QString BluetoothRFCOMMRun::setMyState( NodeCollection *, 34QString BluetoothRFCOMMRun::setMyState( NodeCollection *,
33 Action_t A, 35 Action_t A,
34 bool ) { 36 bool ) {
35 37
36 if( OT ) { 38 if( OT ) {
37 OTGateway::getOTGateway(); 39 OTGateway::getOTGateway();
38 } 40 }
39 41
40 if( A == Activate ) { 42 if( A == Activate ) {
41 // from OFF to Available 43 // from OFF to Available
42 RFCOMMChannel * Ch = getChannel( ); 44 RFCOMMChannel * Ch = getChannel( );
43 System & Sys = NSResources->system(); 45 System & Sys = NSResources->system();
44 46
45 if( Ch ) { 47 if( Ch ) {
46 // connect to this peer 48 // connect to this peer
47 DeviceNr = OT->getFreeRFCommDevice(); 49 DeviceNr = OT->getFreeRFCommDevice();
48 QStringList S; 50 QStringList S;
49 51
50 S << "rfcomm" 52 S << "rfcomm"
51 << "bind" 53 << "bind"
52 << QString().setNum( DeviceNr ) 54 << QString().setNum( DeviceNr )
53 << Ch->BDAddress 55 << Ch->BDAddress
54 << QString().setNum( Ch->Channel ); 56 << QString().setNum( Ch->Channel );
55 57
56 if( Sys.runAsRoot( S ) ) { 58 if( Sys.runAsRoot( S ) ) {
57 return QString( "Error starting %1").arg(S.join(" ")); 59 return QString( "Error starting %1").arg(S.join(" "));
58 } 60 }
59 61
60 // here rfcomm should be running -> we will detect state later 62 // here rfcomm should be running -> we will detect state later
61 return QString(); 63 return QString();
62 } else { 64 } else {
63 Log(( "No channel selected -> cancel\n" )); 65 Log(( "No channel selected -> cancel\n" ));
64 return QString( "No channel selected. Operation cancelled" ); 66 return QString( "No channel selected. Operation cancelled" );
65 } 67 }
66 } 68 }
67 69
68 if( A == Deactivate ) { 70 if( A == Deactivate ) {
69 if( DeviceNr >= 0 ) { 71 if( DeviceNr >= 0 ) {
70 if( OT->releaseRFCommDevice( DeviceNr ) ) { 72 if( OT->releaseRFCommDevice( DeviceNr ) ) {
71 return QString( "Cannot release RFCOMM connection" ); 73 return QString( "Cannot release RFCOMM connection" );
72 } 74 }
73 DeviceNr = -1; 75 DeviceNr = -1;
74 } 76 }
75 } 77 }
76 return QString(); 78 return QString();
77} 79}
78 80
79#include <qlistbox.h> 81#include <qlistbox.h>
80#include <qframe.h> 82#include <qframe.h>
81#include <qlabel.h> 83#include <qlabel.h>
82#include <qlayout.h> 84#include <qlayout.h>
83#include <qdialog.h> 85#include <qdialog.h>
84 86
85RFCOMMChannel * BluetoothRFCOMMRun::getChannel( void ) { 87RFCOMMChannel * BluetoothRFCOMMRun::getChannel( void ) {
86 88
87 if( Data->Devices.count() == 1 ) { 89 if( Data->Devices.count() == 1 ) {
88 // only one device -> return channel 90 // only one device -> return channel
89 return Data->Devices[0]; 91 return Data->Devices[0];
90 } 92 }
91 93
92 RFCOMMChannel * Ch = 0; 94 RFCOMMChannel * Ch = 0;
93 QDialog * Dlg = new QDialog( qApp->mainWidget(), 0, TRUE ); 95 QDialog * Dlg = new QDialog( qApp->mainWidget(), 0, TRUE );
94 QVBoxLayout * V = new QVBoxLayout( Dlg ); 96 QVBoxLayout * V = new QVBoxLayout( Dlg );
95 97
96 QLabel * L = new QLabel( 98 QLabel * L = new QLabel(
97 qApp->translate( "BluetoothRFCOMMRun", 99 qApp->translate( "BluetoothRFCOMMRun",
98 "Select device to connect to"), 100 "Select device to connect to"),
99 Dlg ); 101 Dlg );
100 QListBox * LB = new QListBox( Dlg ); 102 QListBox * LB = new QListBox( Dlg );
101 103
102 for( unsigned int i = 0; i < Data->Devices.count(); i ++ ) { 104 for( unsigned int i = 0; i < Data->Devices.count(); i ++ ) {
103 LB->insertItem( QString( "%1 (%2 Chnl %3)" ). 105 LB->insertItem( QString( "%1 (%2 Chnl %3)" ).
104 arg( Data->Devices[i]->Name ). 106 arg( Data->Devices[i]->Name ).
105 arg( Data->Devices[i]->BDAddress ). 107 arg( Data->Devices[i]->BDAddress ).
106 arg( Data->Devices[i]->Channel ) ); 108 arg( Data->Devices[i]->Channel ) );
107 } 109 }
108 110
109 V->addWidget( L ); 111 V->addWidget( L );
110 V->addWidget( LB ); 112 V->addWidget( LB );
111 113
112 Dlg->resize( 100, 100 ); 114 Dlg->resize( 100, 100 );
113 Dlg->move( 20, 115 Dlg->move( 20,
114 (qApp->desktop()->height()-100)/2 ); 116 (qApp->desktop()->height()-100)/2 );
115 117
116 if( Dlg->exec() == QDialog::Accepted ) { 118 if( Dlg->exec() == QDialog::Accepted ) {
117 unsigned int i = 0; 119 unsigned int i = 0;
118 for( i = 0; i < Data->Devices.count(); i ++ ) { 120 for( i = 0; i < Data->Devices.count(); i ++ ) {
119 if( LB->isSelected(i) ) { 121 if( LB->isSelected(i) ) {
120 owarn << "Selected " << Data->Devices[i]->Name << oendl; 122 owarn << "Selected " << Data->Devices[i]->Name << oendl;
121 Ch = Data->Devices[i]; 123 Ch = Data->Devices[i];
122 break; 124 break;
123 } 125 }
124 } 126 }
125 } 127 }
126 128
127 delete Dlg; 129 delete Dlg;
128 return Ch; 130 return Ch;
129} 131}
130 132
131QString BluetoothRFCOMMRun::deviceFile( void ) { 133QString BluetoothRFCOMMRun::deviceFile( void ) {
132 if( deviceNrOfConnection() >= 0 ) { 134 if( deviceNrOfConnection() >= 0 ) {
133 OTDevice * OTD = OT->getOTDevice(); 135 OTDevice * OTD = OT->getOTDevice();
134 // there is a connection 136 // there is a connection
135 return OTD->getRFCommDevicePattern().arg(DeviceNr); 137 return OTD->getRFCommDevicePattern().arg(DeviceNr);
136 } 138 }
137 return QString(); 139 return QString();
138} 140}
139 141
140int BluetoothRFCOMMRun::deviceNrOfConnection( void ) { 142int BluetoothRFCOMMRun::deviceNrOfConnection( void ) {
141 143
142 if( ! OT ) { 144 if( ! OT ) {
143 OT = OTGateway::getOTGateway(); 145 OT = OTGateway::getOTGateway();
144 } 146 }
145 147
146 DeviceNr = -1; 148 DeviceNr = -1;
147 for( unsigned int i = 0; i < Data->Devices.count(); i ++ ) { 149 for( unsigned int i = 0; i < Data->Devices.count(); i ++ ) {
148 owarn << "Check for rfcomm on " 150 owarn << "Check for rfcomm on "
149 << Data->Devices[i]->BDAddress 151 << Data->Devices[i]->BDAddress
150 << " " 152 << " "
151 << Data->Devices[i]->Channel 153 << Data->Devices[i]->Channel
152 << oendl; 154 << oendl;
153 if( ( DeviceNr = OT->connectedToRFCommChannel( 155 if( ( DeviceNr = OT->connectedToRFCommChannel(
154 OTDeviceAddress( Data->Devices[i]->BDAddress ), 156 OTDeviceAddress( Data->Devices[i]->BDAddress ),
155 Data->Devices[i]->Channel ) ) >= 0 ) { 157 Data->Devices[i]->Channel ) ) >= 0 ) {
156 owarn << "Up " 158 owarn << "Up "
157 << oendl; 159 << oendl;
158 break; 160 break;
159 } 161 }
160 } 162 }
161 return DeviceNr; 163 return DeviceNr;
162} 164}
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h
index 24e3dae..5a31a94 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h
@@ -1,33 +1,32 @@
1#include <netnode.h> 1#include <netnode.h>
2#include "bluetoothRFCOMMdata.h" 2#include "bluetoothRFCOMMdata.h"
3 3
4#include <OTGateway.h> 4#include <OTGateway.h>
5using namespace Opietooth2;
6 5
7class BluetoothRFCOMMRun : public RuntimeInfo { 6class BluetoothRFCOMMRun : public RuntimeInfo {
8 7
9public : 8public :
10 9
11 BluetoothRFCOMMRun( ANetNodeInstance * NNI, 10 BluetoothRFCOMMRun( ANetNodeInstance * NNI,
12 BluetoothRFCOMMData & D ) : RuntimeInfo( NNI ) 11 BluetoothRFCOMMData & D ) : RuntimeInfo( NNI )
13 { DeviceNr = -1; Data = &D; OT = 0; } 12 { DeviceNr = -1; Data = &D; OT = 0; }
14 virtual ~BluetoothRFCOMMRun( void ); 13 virtual ~BluetoothRFCOMMRun( void );
15 14
16 virtual RuntimeInfo * line( void ) 15 virtual RuntimeInfo * line( void )
17 { return this; } 16 { return this; }
18 virtual QString deviceFile( void ); 17 virtual QString deviceFile( void );
19 18
20 State_t detectState( void ); 19 State_t detectState( void );
21 20
22protected : 21protected :
23 22
24 QString setMyState( NodeCollection * , Action_t, bool ); 23 QString setMyState( NodeCollection * , Action_t, bool );
25 24
26private : 25private :
27 26
28 int deviceNrOfConnection( void ); 27 int deviceNrOfConnection( void );
29 RFCOMMChannel * getChannel( void ); 28 RFCOMMChannel * getChannel( void );
30 BluetoothRFCOMMData * Data; 29 BluetoothRFCOMMData * Data;
31 Opietooth2::OTGateway * OT; 30 Opietooth2::OTGateway * OT;
32 int DeviceNr; // cached from detection 31 int DeviceNr; // cached from detection
33}; 32};
diff --git a/noncore/settings/networksettings2/cable/cable.pro b/noncore/settings/networksettings2/cable/cable.pro
index 8a046b7..660f95e 100644
--- a/noncore/settings/networksettings2/cable/cable.pro
+++ b/noncore/settings/networksettings2/cable/cable.pro
@@ -1,18 +1,18 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release plugin
3DESTDIR = $(OPIEDIR)/plugins/networksettings2 3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = cable_NN.h \ 4 HEADERS = cable_NN.h \
5 cable_NNI.h \ 5 cable_NNI.h \
6 cableedit.h 6 cableedit.h
7 SOURCES = cable_NN.cpp \ 7 SOURCES = cable_NN.cpp \
8 cable_NNI.cpp \ 8 cable_NNI.cpp \
9 cableedit.cpp \ 9 cableedit.cpp \
10 cablerun.cpp 10 cablerun.cpp
11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2
12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2
13LIBS += -lqpe 13LIBS += -lqpe
14 INTERFACES= cableGUI.ui 14 INTERFACES= cableGUI.ui
15 TARGET = cable 15 TARGET = cable
16 VERSION = 1.0.0 16 VERSION = 1.0.0
17 17
18include( $(OPIEDIR)/include.pro ) 18include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp
index dc4205c..20299e4 100644
--- a/noncore/settings/networksettings2/cable/cable_NN.cpp
+++ b/noncore/settings/networksettings2/cable/cable_NN.cpp
@@ -1,54 +1,69 @@
1#include "cable_NN.h" 1#include "cable_NN.h"
2#include "cable_NNI.h" 2#include "cable_NNI.h"
3 3
4#ifndef MYPLUGIN
5
6#include "netnodeinterface.h"
7
8#endif
9
4static const char * CableNeeds[] = 10static const char * CableNeeds[] =
5 { 0 11 { 0
6 }; 12 };
7 13
8static const char * CableProvides[] = 14static const char * CableProvides[] =
9 { "line", 15 { "line",
10 0 16 0
11 }; 17 };
12 18
13/** 19/**
14 * Constructor, find all of the possible interfaces 20 * Constructor, find all of the possible interfaces
15 */ 21 */
16CableNetNode::CableNetNode() : ANetNode(tr("Cable Connection")) { 22CableNetNode::CableNetNode() : ANetNode(tr("Cable Connection")) {
17} 23}
18 24
19/** 25/**
20 * Delete any interfaces that we own. 26 * Delete any interfaces that we own.
21 */ 27 */
22CableNetNode::~CableNetNode(){ 28CableNetNode::~CableNetNode(){
23} 29}
24 30
25const QString CableNetNode::nodeDescription(){ 31const QString CableNetNode::nodeDescription(){
26 return tr("\ 32 return tr("\
27<p>Sets up a wired serial or parallel.</p>\ 33<p>Sets up a wired serial or parallel.</p>\
28" 34"
29); 35);
30} 36}
31 37
32ANetNodeInstance * CableNetNode::createInstance( void ) { 38ANetNodeInstance * CableNetNode::createInstance( void ) {
33 return new ACable( this ); 39 return new ACable( this );
34} 40}
35 41
36const char ** CableNetNode::needs( void ) { 42const char ** CableNetNode::needs( void ) {
37 return CableNeeds; 43 return CableNeeds;
38} 44}
39 45
40const char ** CableNetNode::provides( void ) { 46const char ** CableNetNode::provides( void ) {
41 return CableProvides; 47 return CableProvides;
42} 48}
43 49
44void CableNetNode::setSpecificAttribute( QString & , QString & ) { 50void CableNetNode::setSpecificAttribute( QString & , QString & ) {
45} 51}
46 52
47void CableNetNode::saveSpecificAttribute( QTextStream & ) { 53void CableNetNode::saveSpecificAttribute( QTextStream & ) {
48} 54}
49 55
56#ifdef MYPLUGIN
57
50extern "C" { 58extern "C" {
51void create_plugin( QList<ANetNode> & PNN ) { 59void create_plugin( QList<ANetNode> & PNN ) {
52 PNN.append( new CableNetNode() ); 60 PNN.append( new CableNetNode() );
53} 61}
62
63#else
64
65OPIE_NS2_PLUGIN( NetNodeInterface<CableNetNode> )
66
67#endif
68
54} 69}
diff --git a/noncore/settings/networksettings2/gprs/GPRS.pro b/noncore/settings/networksettings2/gprs/GPRS.pro
index 7818415..480c872 100644
--- a/noncore/settings/networksettings2/gprs/GPRS.pro
+++ b/noncore/settings/networksettings2/gprs/GPRS.pro
@@ -1,18 +1,18 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release plugin
3DESTDIR = $(OPIEDIR)/plugins/networksettings2 3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = GPRS_NN.h \ 4 HEADERS = GPRS_NN.h \
5 GPRS_NNI.h \ 5 GPRS_NNI.h \
6 GPRSedit.h 6 GPRSedit.h
7 SOURCES = GPRS_NN.cpp \ 7 SOURCES = GPRS_NN.cpp \
8 GPRS_NNI.cpp \ 8 GPRS_NNI.cpp \
9 GPRSedit.cpp \ 9 GPRSedit.cpp \
10 GPRSrun.cpp 10 GPRSrun.cpp
11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2
12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2
13LIBS += -lqpe 13LIBS += -lqpe
14 INTERFACES= GPRSGUI.ui 14 INTERFACES= GPRSGUI.ui
15 TARGET = GPRS 15 TARGET = GPRS
16 VERSION = 1.0.0 16 VERSION = 1.0.0
17 17
18include ( $(OPIEDIR)/include.pro ) 18include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/gprs/GPRS_NN.cpp b/noncore/settings/networksettings2/gprs/GPRS_NN.cpp
index 5393324..4415739 100644
--- a/noncore/settings/networksettings2/gprs/GPRS_NN.cpp
+++ b/noncore/settings/networksettings2/gprs/GPRS_NN.cpp
@@ -1,80 +1,95 @@
1#include <resources.h> 1#include <resources.h>
2#include <qpe/qpeapplication.h> 2#include <qpe/qpeapplication.h>
3#include <netnode.h> 3#include <netnode.h>
4#include "GPRS_NN.h" 4#include "GPRS_NN.h"
5#include "GPRS_NNI.h" 5#include "GPRS_NNI.h"
6 6
7#ifndef MYPLUGIN
8
9#include "netnodeinterface.h"
10
11#endif
12
7static const char * GPRSNeeds[] = 13static const char * GPRSNeeds[] =
8 { "GPRS", 14 { "GPRS",
9 0 15 0
10 }; 16 };
11 17
12static const char * GPRSProvides[] = 18static const char * GPRSProvides[] =
13 { "connection", 19 { "connection",
14 0 20 0
15 }; 21 };
16 22
17/** 23/**
18 * Constructor, find all of the possible interfaces 24 * Constructor, find all of the possible interfaces
19 */ 25 */
20GPRSNetNode::GPRSNetNode() : ANetNode(tr("GPRS capable device")) { 26GPRSNetNode::GPRSNetNode() : ANetNode(tr("GPRS capable device")) {
21 NSResources->addSystemFile( 27 NSResources->addSystemFile(
22 "pap-secrets", "/etc/ppp/pap-secrets", 0 ); 28 "pap-secrets", "/etc/ppp/pap-secrets", 0 );
23} 29}
24 30
25/** 31/**
26 * Delete any interfaces that we own. 32 * Delete any interfaces that we own.
27 */ 33 */
28GPRSNetNode::~GPRSNetNode(){ 34GPRSNetNode::~GPRSNetNode(){
29} 35}
30 36
31const QString GPRSNetNode::nodeDescription(){ 37const QString GPRSNetNode::nodeDescription(){
32 return tr("\ 38 return tr("\
33<p>provides access to a GPRS capable device.</p>\ 39<p>provides access to a GPRS capable device.</p>\
34" 40"
35); 41);
36} 42}
37 43
38ANetNodeInstance * GPRSNetNode::createInstance( void ) { 44ANetNodeInstance * GPRSNetNode::createInstance( void ) {
39 return new AGPRSDevice( this ); 45 return new AGPRSDevice( this );
40} 46}
41 47
42bool GPRSNetNode::hasDataForFile( SystemFile & S ) { 48bool GPRSNetNode::hasDataForFile( SystemFile & S ) {
43 return S.name() == "pap-secrets"; 49 return S.name() == "pap-secrets";
44} 50}
45 51
46short GPRSNetNode::generateFile( SystemFile & , 52short GPRSNetNode::generateFile( SystemFile & ,
47 ANetNodeInstance * , 53 ANetNodeInstance * ,
48 long ) { 54 long ) {
49 55
50 return 0; 56 return 0;
51} 57}
52 58
53const char ** GPRSNetNode::needs( void ) { 59const char ** GPRSNetNode::needs( void ) {
54 return GPRSNeeds; 60 return GPRSNeeds;
55} 61}
56 62
57const char ** GPRSNetNode::provides( void ) { 63const char ** GPRSNetNode::provides( void ) {
58 return GPRSProvides; 64 return GPRSProvides;
59} 65}
60 66
61void GPRSNetNode::setSpecificAttribute( QString & , QString & ) { 67void GPRSNetNode::setSpecificAttribute( QString & , QString & ) {
62} 68}
63 69
64void GPRSNetNode::saveSpecificAttribute( QTextStream & ) { 70void GPRSNetNode::saveSpecificAttribute( QTextStream & ) {
65} 71}
66 72
67QStringList GPRSNetNode::properFiles( void ) { 73QStringList GPRSNetNode::properFiles( void ) {
68 QStringList SL; 74 QStringList SL;
69 75
70 SL << "peers"; 76 SL << "peers";
71 SL << "chatscripts"; 77 SL << "chatscripts";
72 SL << "extra"; 78 SL << "extra";
73 return SL; 79 return SL;
74} 80}
75 81
82#ifdef MYPLUGIN
83
76extern "C" { 84extern "C" {
77void create_plugin( QList<ANetNode> & PNN ) { 85void create_plugin( QList<ANetNode> & PNN ) {
78 PNN.append( new GPRSNetNode() ); 86 PNN.append( new GPRSNetNode() );
79} 87}
88
89#else
90
91OPIE_NS2_PLUGIN( NetNodeInterface<GPRSNetNode> )
92
93#endif
94
80} 95}
diff --git a/noncore/settings/networksettings2/irda/irda.pro b/noncore/settings/networksettings2/irda/irda.pro
index 4613abe..87f7a62 100644
--- a/noncore/settings/networksettings2/irda/irda.pro
+++ b/noncore/settings/networksettings2/irda/irda.pro
@@ -1,17 +1,17 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release plugin
3DESTDIR = $(OPIEDIR)/plugins/networksettings2 3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = irda_NN.h \ 4 HEADERS = irda_NN.h \
5 irda_NNI.h \ 5 irda_NNI.h \
6 irdaedit.h 6 irdaedit.h
7 SOURCES = irda_NN.cpp \ 7 SOURCES = irda_NN.cpp \
8 irda_NNI.cpp \ 8 irda_NNI.cpp \
9 irdaedit.cpp 9 irdaedit.cpp
10 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 10 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2
11 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 11 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2
12LIBS += -lqpe 12LIBS += -lqpe
13 INTERFACES= irdaGUI.ui 13 INTERFACES= irdaGUI.ui
14 TARGET = irda 14 TARGET = irda
15 VERSION = 1.0.0 15 VERSION = 1.0.0
16 16
17include( $(OPIEDIR)/include.pro ) 17include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/irda/irda_NN.cpp b/noncore/settings/networksettings2/irda/irda_NN.cpp
index 485cad3..6858157 100644
--- a/noncore/settings/networksettings2/irda/irda_NN.cpp
+++ b/noncore/settings/networksettings2/irda/irda_NN.cpp
@@ -1,54 +1,69 @@
1#include "irda_NN.h" 1#include "irda_NN.h"
2#include "irda_NNI.h" 2#include "irda_NNI.h"
3 3
4#ifndef MYPLUGIN
5
6#include "netnodeinterface.h"
7
8#endif
9
4static const char * IRDANeeds[] = 10static const char * IRDANeeds[] =
5 { 0 11 { 0
6 }; 12 };
7 13
8static const char * IRDAProvides[] = 14static const char * IRDAProvides[] =
9 { "line", 15 { "line",
10 0 16 0
11 }; 17 };
12 18
13/** 19/**
14 * Constructor, find all of the possible interfaces 20 * Constructor, find all of the possible interfaces
15 */ 21 */
16IRDANetNode::IRDANetNode() : ANetNode(tr("Infrared link")) { 22IRDANetNode::IRDANetNode() : ANetNode(tr("Infrared link")) {
17} 23}
18 24
19/** 25/**
20 * Delete any interfaces that we own. 26 * Delete any interfaces that we own.
21 */ 27 */
22IRDANetNode::~IRDANetNode(){ 28IRDANetNode::~IRDANetNode(){
23} 29}
24 30
25const QString IRDANetNode::nodeDescription(){ 31const QString IRDANetNode::nodeDescription(){
26 return tr("\ 32 return tr("\
27<p>Sets up a infra red serial link.</p>\ 33<p>Sets up a infra red serial link.</p>\
28" 34"
29); 35);
30} 36}
31 37
32ANetNodeInstance * IRDANetNode::createInstance( void ) { 38ANetNodeInstance * IRDANetNode::createInstance( void ) {
33 return new AIRDA( this ); 39 return new AIRDA( this );
34} 40}
35 41
36const char ** IRDANetNode::needs( void ) { 42const char ** IRDANetNode::needs( void ) {
37 return IRDANeeds; 43 return IRDANeeds;
38} 44}
39 45
40const char ** IRDANetNode::provides( void ) { 46const char ** IRDANetNode::provides( void ) {
41 return IRDAProvides; 47 return IRDAProvides;
42} 48}
43 49
44void IRDANetNode::setSpecificAttribute( QString & , QString & ) { 50void IRDANetNode::setSpecificAttribute( QString & , QString & ) {
45} 51}
46 52
47void IRDANetNode::saveSpecificAttribute( QTextStream & ) { 53void IRDANetNode::saveSpecificAttribute( QTextStream & ) {
48} 54}
49 55
56#ifdef MYPLUGIN
57
50extern "C" { 58extern "C" {
51void create_plugin( QList<ANetNode> & PNN ) { 59void create_plugin( QList<ANetNode> & PNN ) {
52 PNN.append( new IRDANetNode() ); 60 PNN.append( new IRDANetNode() );
53} 61}
62
63#else
64
65OPIE_NS2_PLUGIN( NetNodeInterface<IRDANetNode> )
66
67#endif
68
54} 69}
diff --git a/noncore/settings/networksettings2/lancard/lancard.pro b/noncore/settings/networksettings2/lancard/lancard.pro
index 6f04e01..05f0fa0 100644
--- a/noncore/settings/networksettings2/lancard/lancard.pro
+++ b/noncore/settings/networksettings2/lancard/lancard.pro
@@ -1,18 +1,18 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release plugin
3DESTDIR = $(OPIEDIR)/plugins/networksettings2 3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = lancard_NN.h \ 4 HEADERS = lancard_NN.h \
5 lancard_NNI.h \ 5 lancard_NNI.h \
6 lancardedit.h 6 lancardedit.h
7 SOURCES = lancard_NN.cpp \ 7 SOURCES = lancard_NN.cpp \
8 lancard_NNI.cpp \ 8 lancard_NNI.cpp \
9 lancardedit.cpp \ 9 lancardedit.cpp \
10 lancardrun.cpp 10 lancardrun.cpp
11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2
12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2
13LIBS += -lqpe 13LIBS += -lqpe
14 INTERFACES= lancardGUI.ui 14 INTERFACES= lancardGUI.ui
15 TARGET = lancard 15 TARGET = lancard
16 VERSION = 1.0.0 16 VERSION = 1.0.0
17 17
18include( $(OPIEDIR)/include.pro ) 18include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.cpp b/noncore/settings/networksettings2/lancard/lancard_NN.cpp
index e36f757..fce3d29 100644
--- a/noncore/settings/networksettings2/lancard/lancard_NN.cpp
+++ b/noncore/settings/networksettings2/lancard/lancard_NN.cpp
@@ -1,77 +1,92 @@
1#include "lancard_NN.h" 1#include "lancard_NN.h"
2#include "lancard_NNI.h" 2#include "lancard_NNI.h"
3 3
4#ifndef MYPLUGIN
5
6#include "netnodeinterface.h"
7
8#endif
9
4static const char * LanCardNeeds[] = 10static const char * LanCardNeeds[] =
5 { 0 11 { 0
6 }; 12 };
7 13
8static const char * LanCardProvides[] = 14static const char * LanCardProvides[] =
9 { "device", 15 { "device",
10 0 16 0
11 }; 17 };
12 18
13/** 19/**
14 * Constructor, find all of the possible interfaces 20 * Constructor, find all of the possible interfaces
15 */ 21 */
16LanCardNetNode::LanCardNetNode() : ANetNode(tr("LAN card")), NICMACAddresses() { 22LanCardNetNode::LanCardNetNode() : ANetNode(tr("LAN card")), NICMACAddresses() {
17 InstanceCount = 2; 23 InstanceCount = 2;
18} 24}
19 25
20/** 26/**
21 * Delete any interfaces that we own. 27 * Delete any interfaces that we own.
22 */ 28 */
23LanCardNetNode::~LanCardNetNode(){ 29LanCardNetNode::~LanCardNetNode(){
24} 30}
25 31
26const QString LanCardNetNode::nodeDescription(){ 32const QString LanCardNetNode::nodeDescription(){
27 return tr("\ 33 return tr("\
28<p>Sets up a wired regular LAN card.</p>\ 34<p>Sets up a wired regular LAN card.</p>\
29<p>Use this to set up 10/100/1000 MBit LAN cards.</p>\ 35<p>Use this to set up 10/100/1000 MBit LAN cards.</p>\
30" 36"
31); 37);
32} 38}
33 39
34ANetNodeInstance * LanCardNetNode::createInstance( void ) { 40ANetNodeInstance * LanCardNetNode::createInstance( void ) {
35 return new ALanCard( this ); 41 return new ALanCard( this );
36} 42}
37 43
38 44
39const char ** LanCardNetNode::needs( void ) { 45const char ** LanCardNetNode::needs( void ) {
40 return LanCardNeeds; 46 return LanCardNeeds;
41} 47}
42 48
43const char ** LanCardNetNode::provides( void ) { 49const char ** LanCardNetNode::provides( void ) {
44 return LanCardProvides; 50 return LanCardProvides;
45} 51}
46 52
47QString LanCardNetNode::genNic( long nr ) { 53QString LanCardNetNode::genNic( long nr ) {
48 QString S; 54 QString S;
49 return S.sprintf( "eth%ld", nr ); 55 return S.sprintf( "eth%ld", nr );
50} 56}
51 57
52void LanCardNetNode::setSpecificAttribute( QString & A, QString & V ) { 58void LanCardNetNode::setSpecificAttribute( QString & A, QString & V ) {
53 if( A == "interfacecount" ) { 59 if( A == "interfacecount" ) {
54 InstanceCount = V.toLong(); 60 InstanceCount = V.toLong();
55 } else if ( A == "macaddress" ) { 61 } else if ( A == "macaddress" ) {
56 NICMACAddresses.append( V ); 62 NICMACAddresses.append( V );
57 } 63 }
58} 64}
59 65
60void LanCardNetNode::saveSpecificAttribute( QTextStream & TS) { 66void LanCardNetNode::saveSpecificAttribute( QTextStream & TS) {
61 TS << "interfacecount=" 67 TS << "interfacecount="
62 << InstanceCount 68 << InstanceCount
63 << endl; 69 << endl;
64 for( QStringList::Iterator it = NICMACAddresses.begin(); 70 for( QStringList::Iterator it = NICMACAddresses.begin();
65 it != NICMACAddresses.end(); 71 it != NICMACAddresses.end();
66 ++it ) { 72 ++it ) {
67 TS << "macaddress=" 73 TS << "macaddress="
68 << (*it) 74 << (*it)
69 << endl; 75 << endl;
70 } 76 }
71} 77}
72 78
79#ifdef MYPLUGIN
80
73extern "C" { 81extern "C" {
74void create_plugin( QList<ANetNode> & PNN ) { 82void create_plugin( QList<ANetNode> & PNN ) {
75 PNN.append( new LanCardNetNode() ); 83 PNN.append( new LanCardNetNode() );
76} 84}
85
86#else
87
88OPIE_NS2_PLUGIN( NetNodeInterface<LanCardNetNode> )
89
90#endif
91
77} 92}
diff --git a/noncore/settings/networksettings2/modem/modem.pro b/noncore/settings/networksettings2/modem/modem.pro
index 25e29d4..4511e07 100644
--- a/noncore/settings/networksettings2/modem/modem.pro
+++ b/noncore/settings/networksettings2/modem/modem.pro
@@ -1,17 +1,17 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release plugin
3DESTDIR = $(OPIEDIR)/plugins/networksettings2 3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = modem_NN.h \ 4 HEADERS = modem_NN.h \
5 modem_NNI.h \ 5 modem_NNI.h \
6 modemedit.h 6 modemedit.h
7 SOURCES = modem_NN.cpp \ 7 SOURCES = modem_NN.cpp \
8 modem_NNI.cpp \ 8 modem_NNI.cpp \
9 modemedit.cpp 9 modemedit.cpp
10 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 10 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2
11 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 11 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2
12LIBS += -lqpe 12LIBS += -lqpe
13 INTERFACES= modemGUI.ui 13 INTERFACES= modemGUI.ui
14 TARGET = modem 14 TARGET = modem
15 VERSION = 1.0.0 15 VERSION = 1.0.0
16 16
17include( $(OPIEDIR)/include.pro ) 17include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/modem/modem_NN.cpp b/noncore/settings/networksettings2/modem/modem_NN.cpp
index 06f417c..c7f6e78 100644
--- a/noncore/settings/networksettings2/modem/modem_NN.cpp
+++ b/noncore/settings/networksettings2/modem/modem_NN.cpp
@@ -1,55 +1,70 @@
1#include "modem_NN.h" 1#include "modem_NN.h"
2#include "modem_NNI.h" 2#include "modem_NNI.h"
3 3
4#ifndef MYPLUGIN
5
6#include "netnodeinterface.h"
7
8#endif
9
4static const char * ModemNeeds[] = 10static const char * ModemNeeds[] =
5 { "line", 11 { "line",
6 0 12 0
7 }; 13 };
8static const char * ModemProvides[] = 14static const char * ModemProvides[] =
9 { "modem", 15 { "modem",
10 0 16 0
11 }; 17 };
12 18
13/** 19/**
14 * Constructor, find all of the possible interfaces 20 * Constructor, find all of the possible interfaces
15 */ 21 */
16ModemNetNode::ModemNetNode() : ANetNode(tr("Dialup modem")) { 22ModemNetNode::ModemNetNode() : ANetNode(tr("Dialup modem")) {
17} 23}
18 24
19/** 25/**
20 * Delete any interfaces that we own. 26 * Delete any interfaces that we own.
21 */ 27 */
22ModemNetNode::~ModemNetNode(){ 28ModemNetNode::~ModemNetNode(){
23} 29}
24 30
25const QString ModemNetNode::nodeDescription(){ 31const QString ModemNetNode::nodeDescription(){
26 return tr("\ 32 return tr("\
27<p>Sets up a dialing procedures.</p>\ 33<p>Sets up a dialing procedures.</p>\
28<p>Use this to dial up over modems, ISDN, GSM, ...</p>\ 34<p>Use this to dial up over modems, ISDN, GSM, ...</p>\
29" 35"
30); 36);
31} 37}
32 38
33ANetNodeInstance * ModemNetNode::createInstance( void ) { 39ANetNodeInstance * ModemNetNode::createInstance( void ) {
34 return new AModem( this ); 40 return new AModem( this );
35} 41}
36 42
37const char ** ModemNetNode::needs( void ) { 43const char ** ModemNetNode::needs( void ) {
38 return ModemNeeds; 44 return ModemNeeds;
39} 45}
40 46
41const char ** ModemNetNode::provides( void ) { 47const char ** ModemNetNode::provides( void ) {
42 return ModemProvides; 48 return ModemProvides;
43} 49}
44 50
45void ModemNetNode::setSpecificAttribute( QString & , QString & ) { 51void ModemNetNode::setSpecificAttribute( QString & , QString & ) {
46} 52}
47 53
48void ModemNetNode::saveSpecificAttribute( QTextStream & ) { 54void ModemNetNode::saveSpecificAttribute( QTextStream & ) {
49} 55}
50 56
57#ifdef MYPLUGIN
58
51extern "C" { 59extern "C" {
52void create_plugin( QList<ANetNode> & PNN ) { 60void create_plugin( QList<ANetNode> & PNN ) {
53 PNN.append( new ModemNetNode() ); 61 PNN.append( new ModemNetNode() );
54} 62}
63
64#else
65
66OPIE_NS2_PLUGIN( NetNodeInterface<ModemNetNode> )
67
68#endif
69
55} 70}
diff --git a/noncore/settings/networksettings2/network/network.pro b/noncore/settings/networksettings2/network/network.pro
index 05df007..5ca78b9 100644
--- a/noncore/settings/networksettings2/network/network.pro
+++ b/noncore/settings/networksettings2/network/network.pro
@@ -1,18 +1,18 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release plugin
3DESTDIR = $(OPIEDIR)/plugins/networksettings2 3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = network_NN.h \ 4 HEADERS = network_NN.h \
5 network_NNI.h \ 5 network_NNI.h \
6 networkedit.h 6 networkedit.h
7 SOURCES = network_NN.cpp \ 7 SOURCES = network_NN.cpp \
8 network_NNI.cpp \ 8 network_NNI.cpp \
9 networkedit.cpp \ 9 networkedit.cpp \
10 networkrun.cpp 10 networkrun.cpp
11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2
12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2
13LIBS += -lqpe 13LIBS += -lqpe
14 INTERFACES= networkGUI.ui 14 INTERFACES= networkGUI.ui
15 TARGET = network 15 TARGET = network
16 VERSION = 1.0.0 16 VERSION = 1.0.0
17 17
18include( $(OPIEDIR)/include.pro ) 18include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/network/network_NN.cpp b/noncore/settings/networksettings2/network/network_NN.cpp
index 23b3d44..82d0c29 100644
--- a/noncore/settings/networksettings2/network/network_NN.cpp
+++ b/noncore/settings/networksettings2/network/network_NN.cpp
@@ -1,97 +1,112 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include <resources.h> 2#include <resources.h>
3#include <netnode.h> 3#include <netnode.h>
4#include "network_NN.h" 4#include "network_NN.h"
5#include "network_NNI.h" 5#include "network_NNI.h"
6 6
7#ifndef MYPLUGIN
8
9#include "netnodeinterface.h"
10
11#endif
12
7static const char * NetworkNeeds[] = 13static const char * NetworkNeeds[] =
8 { "device", 14 { "device",
9 0 15 0
10 }; 16 };
11 17
12static const char * NetworkProvides[] = 18static const char * NetworkProvides[] =
13 { "connection", 19 { "connection",
14 0 20 0
15 }; 21 };
16 22
17/** 23/**
18 * Constructor, find all of the possible interfaces 24 * Constructor, find all of the possible interfaces
19 */ 25 */
20NetworkNetNode::NetworkNetNode() : ANetNode(tr("IP Configuration")) { 26NetworkNetNode::NetworkNetNode() : ANetNode(tr("IP Configuration")) {
21 27
22 NSResources->addSystemFile( 28 NSResources->addSystemFile(
23 "interfaces", "/etc/network/interfaces", 1 ); 29 "interfaces", "/etc/network/interfaces", 1 );
24} 30}
25 31
26/** 32/**
27 * Delete any interfaces that we own. 33 * Delete any interfaces that we own.
28 */ 34 */
29NetworkNetNode::~NetworkNetNode(){ 35NetworkNetNode::~NetworkNetNode(){
30} 36}
31 37
32const QString NetworkNetNode::nodeDescription(){ 38const QString NetworkNetNode::nodeDescription(){
33 return tr("\ 39 return tr("\
34<p>Sets up TCP/IP options.</p>\ 40<p>Sets up TCP/IP options.</p>\
35<p>Use this to configure the TCP/IP protocol</p>\ 41<p>Use this to configure the TCP/IP protocol</p>\
36" 42"
37); 43);
38} 44}
39 45
40ANetNodeInstance * NetworkNetNode::createInstance( void ) { 46ANetNodeInstance * NetworkNetNode::createInstance( void ) {
41 return new ANetwork( this ); 47 return new ANetwork( this );
42} 48}
43 49
44bool NetworkNetNode::hasDataForFile( SystemFile & S ) { 50bool NetworkNetNode::hasDataForFile( SystemFile & S ) {
45 return S.name() == "interfaces"; 51 return S.name() == "interfaces";
46} 52}
47 53
48short NetworkNetNode::generateFile( SystemFile & SF, 54short NetworkNetNode::generateFile( SystemFile & SF,
49 ANetNodeInstance * NNI, 55 ANetNodeInstance * NNI,
50 long DevNr ) { 56 long DevNr ) {
51 57
52 if( DevNr < 0 ) { 58 if( DevNr < 0 ) {
53 // generate device specific but common part 59 // generate device specific but common part
54 return 1; 60 return 1;
55 } 61 }
56 62
57 QString NIC = NNI->runtime()->device()->netNode()->nodeClass()->genNic( DevNr ); 63 QString NIC = NNI->runtime()->device()->netNode()->nodeClass()->genNic( DevNr );
58 64
59 if( SF.name() == "interfaces" ) { 65 if( SF.name() == "interfaces" ) {
60 Log(("Generate entry for %s in %s\n", NIC.latin1(), SF.name().latin1() )); 66 Log(("Generate entry for %s in %s\n", NIC.latin1(), SF.name().latin1() ));
61 // generate mapping stanza for this interface 67 // generate mapping stanza for this interface
62 SF << "# check if " 68 SF << "# check if "
63 << NIC 69 << NIC
64 << " can be brought UP" 70 << " can be brought UP"
65 << endl; 71 << endl;
66 SF << "mapping " 72 SF << "mapping "
67 << NIC 73 << NIC
68 << endl; 74 << endl;
69 SF << " script " 75 SF << " script "
70 << QPEApplication::qpeDir() 76 << QPEApplication::qpeDir()
71 << "bin/networksettings2-request" 77 << "bin/networksettings2-request"
72 << endl 78 << endl
73 << endl; 79 << endl;
74 return 0; 80 return 0;
75 } 81 }
76 return 1; 82 return 1;
77} 83}
78 84
79const char ** NetworkNetNode::needs( void ) { 85const char ** NetworkNetNode::needs( void ) {
80 return NetworkNeeds; 86 return NetworkNeeds;
81} 87}
82 88
83const char ** NetworkNetNode::provides( void ) { 89const char ** NetworkNetNode::provides( void ) {
84 return NetworkProvides; 90 return NetworkProvides;
85} 91}
86 92
87void NetworkNetNode::setSpecificAttribute( QString & , QString & ) { 93void NetworkNetNode::setSpecificAttribute( QString & , QString & ) {
88} 94}
89 95
90void NetworkNetNode::saveSpecificAttribute( QTextStream & ) { 96void NetworkNetNode::saveSpecificAttribute( QTextStream & ) {
91} 97}
92 98
99#ifdef MYPLUGIN
100
93extern "C" { 101extern "C" {
94void create_plugin( QList<ANetNode> & PNN ) { 102void create_plugin( QList<ANetNode> & PNN ) {
95 PNN.append( new NetworkNetNode() ); 103 PNN.append( new NetworkNetNode() );
96} 104}
105
106#else
107
108OPIE_NS2_PLUGIN( NetNodeInterface<NetworkNetNode> )
109
110#endif
111
97} 112}
diff --git a/noncore/settings/networksettings2/networksettings2/netnodeinterface.h b/noncore/settings/networksettings2/networksettings2/netnodeinterface.h
new file mode 100644
index 0000000..34f3bb5
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings2/netnodeinterface.h
@@ -0,0 +1,139 @@
1/*
2                 This file is part of the Opie Project
3
4 Copyright (C) 2005 Holger Hans Peter Freyther <freyther@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29
30*/
31
32#ifndef ANET_NODE_INTERFACE_H
33#define ANET_NODE_INTERFACE_H
34
35#include <opie2/oapplicationfactory.h>
36#include <qpe/qcom.h>
37
38// {A215A785-FB73-4F74-84B0-053BCC77DB87}
39#ifndef IID_NetworkSettings2
40
41#define IID_NetworkSettings2 QUuid( 0xa215a785, 0xfb73, 0x4f74, 0x84, 0xb0, 0x05, 0x3b, 0xcc, 0x77, 0xdb, 0x87)
42
43#endif
44
45
46
47/**
48 * Multiple Types
49 */
50template <class Node >
51struct NS2PrivateFactory {
52
53 inline static void createPlugins( QList<ANetNode> & PNN) {
54 PNN.append( new Node());
55 }
56
57};
58
59/*
60 * Stop recursion here
61 */
62template <>
63struct NS2PrivateFactory<Opie::Core::NullType> {
64
65 inline static void createPlugins( QList<ANetNode> &) {
66
67 }
68
69};
70
71template <class Node, class Tail>
72struct NS2PrivateFactory<Opie::Core::Typelist<Node, Tail> > {
73
74 inline static void createPlugins( QList<ANetNode> & PNN ) {
75 NS2PrivateFactory<Node>::createPlugins(PNN);
76 NS2PrivateFactory<Tail>::createPlugins(PNN);
77 }
78
79};
80
81template<class Node>
82struct NetNodeInterface : public QUnknownInterface {
83
84 QRESULT queryInterface(const QUuid& uuid, QUnknownInterface **iface) {
85 *iface = 0;
86
87 if( uuid == IID_QUnknown )
88 *iface = this;
89 else if( uuid == IID_NetworkSettings2 )
90 *iface = this;
91 else
92 return QS_FALSE;
93
94 (*iface)->addRef();
95
96 return QS_OK;
97
98 }
99
100 void create_plugin( QList<ANetNode> & PNN ) {
101
102 PNN.append( new Node());
103
104 }
105
106 Q_REFCOUNT
107};
108
109template<class Node, class Tail>
110struct NetNodeInterface<Opie::Core::Typelist<Node, Tail> >
111 : public QUnknownInterface {
112
113 QRESULT queryInterface( const QUuid& uuid,
114 QUnknownInterface **iface) {
115
116 *iface = 0;
117
118 if( uuid == IID_QUnknown ) *iface = this;
119 else if( uuid == IID_NetworkSettings2 ) *iface = this;
120 else return QS_FALSE;
121
122 (*iface)->addRef();
123 return QS_OK;
124
125 }
126
127 void create_plugin( QList<ANetNode> & PNN ) {
128 NS2PrivateFactory<Opie::Core::Typelist<Node,Tail> >::createPlugin( PNN );
129 }
130
131 Q_REFCOUNT
132
133};
134
135#define OPIE_NS2_PLUGIN( factory ) \
136 Q_EXPORT_INTERFACE() { Q_CREATE_INSTANCE( factory) }
137
138#endif
139
diff --git a/noncore/settings/networksettings2/networksettings2/resources.cpp b/noncore/settings/networksettings2/networksettings2/resources.cpp
index 50fb15a..79d41ea 100644
--- a/noncore/settings/networksettings2/networksettings2/resources.cpp
+++ b/noncore/settings/networksettings2/networksettings2/resources.cpp
@@ -1,421 +1,558 @@
1#include <unistd.h> 1#include <unistd.h>
2#include <errno.h> 2#include <errno.h>
3#include <fcntl.h> 3#include <fcntl.h>
4#include <pwd.h> 4#include <pwd.h>
5#include <qpixmap.h> 5#include <qpixmap.h>
6#include <qdir.h> 6#include <qdir.h>
7#include <qmessagebox.h>
8
7#include <qpe/qlibrary.h> 9#include <qpe/qlibrary.h>
8#include <qpe/qpeapplication.h> 10#include <qpe/qpeapplication.h>
11
9#include <opie2/odebug.h> 12#include <opie2/odebug.h>
13#include <opie2/opluginloader.h>
14
10#include <qtopia/resource.h> 15#include <qtopia/resource.h>
11 16
12#include "netnode.h" 17#include "netnode.h"
13#include "resources.h" 18#include "resources.h"
19#include "netnodeinterface.h"
14 20
15#define PLUGINDIR "plugins/networksettings2" 21#define PLUGINDIR "plugins/networksettings2"
16#define ICONDIR "/pics/networksettings2/" 22#define ICONDIR "/pics/networksettings2/"
17 23
18// single resources instance 24// single resources instance
19TheNSResources * _NSResources = 0; 25TheNSResources * _NSResources = 0;
20 26
21TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), 27TheNSResources::TheNSResources( void ) : NodeTypeNameMap(),
22 ConnectionsMap() { 28 ConnectionsMap() {
23 29
24 _NSResources = this; 30 _NSResources = this;
25 31
26 detectCurrentUser(); 32 detectCurrentUser();
27 33
28 // load available netnodes 34 // load available netnodes
35
36#ifdef MYPLUGIN
37
29 findAvailableNetNodes(QPEApplication::qpeDir() + PLUGINDIR ); 38 findAvailableNetNodes(QPEApplication::qpeDir() + PLUGINDIR );
30 39
31 // compile provides and needs lists 40 // compile provides and needs lists
32 { const char ** NeedsRun; 41 { const char ** NeedsRun;
33 QDictIterator<NetNode_t> OuterIt( AllNodeTypes ); 42 QDictIterator<NetNode_t> OuterIt( AllNodeTypes );
34 bool Done; 43 bool Done;
35 44
36 for ( ; OuterIt.current(); ++OuterIt ) { 45 for ( ; OuterIt.current(); ++OuterIt ) {
37 // find needs list 46 // find needs list
38 ANetNode::NetNodeList * NNLP = new ANetNode::NetNodeList; 47 ANetNode::NetNodeList * NNLP = new ANetNode::NetNodeList;
39 ANetNode::NetNodeList & NNL = *(NNLP); 48 ANetNode::NetNodeList & NNL = *(NNLP);
40 49
41 // must iterate this way to avoid duplication pointers 50 // must iterate this way to avoid duplication pointers
42 for ( QDictIterator<NetNode_t> InnerIt( AllNodeTypes ); 51 for ( QDictIterator<NetNode_t> InnerIt( AllNodeTypes );
43 InnerIt.current(); ++InnerIt ) { 52 InnerIt.current(); ++InnerIt ) {
44 if( InnerIt.current() == OuterIt.current() ) 53 if( InnerIt.current() == OuterIt.current() )
45 // avoid recursive 54 // avoid recursive
46 continue; 55 continue;
47 56
48 const char ** Provides = InnerIt.current()->NetNode->provides(); 57 const char ** Provides = InnerIt.current()->NetNode->provides();
49 NeedsRun = OuterIt.current()->NetNode->needs(); 58 NeedsRun = OuterIt.current()->NetNode->needs();
50 59
51 for( ; *NeedsRun; NeedsRun ++ ) { 60 for( ; *NeedsRun; NeedsRun ++ ) {
52 const char ** PRun; 61 const char ** PRun;
53 PRun = Provides; 62 PRun = Provides;
54 for( ; *PRun; PRun ++ ) { 63 for( ; *PRun; PRun ++ ) {
55 if( strcmp( *PRun, *NeedsRun ) == 0 ) { 64 if( strcmp( *PRun, *NeedsRun ) == 0 ) {
56 // inner provides what outer needs 65 // inner provides what outer needs
57 NNL.resize( NNL.size() + 1 ); 66 NNL.resize( NNL.size() + 1 );
58 NNL[NNL.size()-1] = InnerIt.current()->NetNode; 67 NNL[NNL.size()-1] = InnerIt.current()->NetNode;
59 Done = 1; // break from 2 loops 68 Done = 1; // break from 2 loops
60 break; 69 break;
61 } 70 }
62 } 71 }
63 } 72 }
64 } 73 }
65 OuterIt.current()->NetNode->setAlternatives( NNLP ); 74 OuterIt.current()->NetNode->setAlternatives( NNLP );
66 } 75 }
67 } 76 }
68 77
78#else
79
80 Plugins = 0;
81 findAvailableNetNodes();
82
83 // compile provides and needs lists
84 { const char ** NeedsRun;
85 QDictIterator<ANetNode> OuterIt( AllNodeTypes );
86 bool Done;
87
88 for ( ; OuterIt.current(); ++OuterIt ) {
89 // find needs list
90 ANetNode::NetNodeList * NNLP = new ANetNode::NetNodeList;
91 ANetNode::NetNodeList & NNL = *(NNLP);
92
93 // must iterate this way to avoid duplication pointers
94 for ( QDictIterator<ANetNode> InnerIt( AllNodeTypes );
95 InnerIt.current(); ++InnerIt ) {
96
97 if( InnerIt.current() == OuterIt.current() )
98 // avoid recursive
99 continue;
100
101 const char ** Provides = InnerIt.current()->provides();
102 NeedsRun = OuterIt.current()->needs();
103
104 for( ; *NeedsRun; NeedsRun ++ ) {
105 const char ** PRun;
106 PRun = Provides;
107 for( ; *PRun; PRun ++ ) {
108 if( strcmp( *PRun, *NeedsRun ) == 0 ) {
109 // inner provides what outer needs
110 NNL.resize( NNL.size() + 1 );
111 NNL[NNL.size()-1] = InnerIt.current();
112 Done = 1; // break from 2 loops
113 break;
114 }
115 }
116 }
117 }
118 OuterIt.current()->setAlternatives( NNLP );
119 }
120 }
121
122#endif
123
69 // define built in Node types to Description map 124 // define built in Node types to Description map
70 addNodeType( "device", tr( "Network Device" ), 125 addNodeType( "device", tr( "Network Device" ),
71 tr( "<p>Devices that can handle IP packets</p>" ) ); 126 tr( "<p>Devices that can handle IP packets</p>" ) );
72 addNodeType( "line", tr( "Character device" ), 127 addNodeType( "line", tr( "Character device" ),
73 tr( "<p>Devices that can handle single bytes</p>" ) ); 128 tr( "<p>Devices that can handle single bytes</p>" ) );
74 addNodeType( "connection", tr( "IP Connection" ), 129 addNodeType( "connection", tr( "IP Connection" ),
75 tr( "<p>Nodes that provide working IP connections</p>" ) ); 130 tr( "<p>Nodes that provide working IP connections</p>" ) );
76 addNodeType( "fullsetup", tr( "Connection Profile" ), 131 addNodeType( "fullsetup", tr( "Connection Profile" ),
77 tr( "<p>Fully configured connection profile</p>" ) ); 132 tr( "<p>Fully configured connection profile</p>" ) );
78 addNodeType( "GPRS", tr( "Connection to GPRS device" ), 133 addNodeType( "GPRS", tr( "Connection to GPRS device" ),
79 tr( "<p>Connection to a GPRS capable device</p>" ) ); 134 tr( "<p>Connection to a GPRS capable device</p>" ) );
80 135
81 // get access to the system 136 // get access to the system
82 TheSystem = new System(); 137 TheSystem = new System();
83 138
84} 139}
85 140
86TheNSResources::~TheNSResources( void ) { 141TheNSResources::~TheNSResources( void ) {
142
143#ifndef MYPLUGINS
144 if( Plugins ) {
145 delete Plugins;
146 delete PluginManager;
147 }
148#endif
87 delete TheSystem; 149 delete TheSystem;
150
88} 151}
89 152
90void TheNSResources::addNodeType( const QString & ID, 153void TheNSResources::addNodeType( const QString & ID,
91 const QString & Name, 154 const QString & Name,
92 const QString & Descr ) { 155 const QString & Descr ) {
93 if( NodeTypeNameMap[ID].isEmpty() ) { 156 if( NodeTypeNameMap[ID].isEmpty() ) {
94 NodeTypeNameMap.insert( ID, Name ); 157 NodeTypeNameMap.insert( ID, Name );
95 NodeTypeDescriptionMap.insert( ID, Descr ); 158 NodeTypeDescriptionMap.insert( ID, Descr );
96 } 159 }
97} 160}
98 161
99void TheNSResources::addSystemFile( const QString & ID, 162void TheNSResources::addSystemFile( const QString & ID,
100 const QString & P, 163 const QString & P,
101 bool KDI ) { 164 bool KDI ) {
102 if( ! SystemFiles.find( ID ) ) { 165 if( ! SystemFiles.find( ID ) ) {
103 // new system file 166 // new system file
104 SystemFiles.insert( ID, new SystemFile( ID, P, KDI ) ); 167 SystemFiles.insert( ID, new SystemFile( ID, P, KDI ) );
105 } // else existed 168 } // else existed
106} 169}
107 170
108void TheNSResources::busy( bool ) { 171void TheNSResources::busy( bool ) {
109/* 172/*
110 if( B ) { 173 if( B ) {
111 ShowWait->show(); 174 ShowWait->show();
112 qApp->process 175 qApp->process
113 } else { 176 } else {
114 ShowWait->hide(); 177 ShowWait->hide();
115 } 178 }
116*/ 179*/
117} 180}
118 181
182#ifdef MYPLUGIN
119/** 183/**
120 * Load all modules that are found in the path 184 * Load all modules that are found in the path
121 * @param path a directory that is scaned for any plugins that can be loaded 185 * @param path a directory that is scaned for any plugins that can be loaded
122 * and attempts to load them 186 * and attempts to load them
123 */ 187 */
124void TheNSResources::findAvailableNetNodes(const QString &path){ 188void TheNSResources::findAvailableNetNodes(const QString &path){
125 189
126 Log(("Locate plugins in %s\n", path.latin1() )); 190 Log(("Locate plugins in %s\n", path.latin1() ));
127 QDir d(path); 191 QDir d(path);
128 if(!d.exists()) 192 if(!d.exists())
129 return; 193 return;
130 194
131 QString lang = ::getenv("LANG"); 195 QString lang = ::getenv("LANG");
132 196
133 // Don't want sym links 197 // Don't want sym links
134 d.setFilter( QDir::Files | QDir::NoSymLinks ); 198 d.setFilter( QDir::Files | QDir::NoSymLinks );
135 const QFileInfoList *list = d.entryInfoList(); 199 const QFileInfoList *list = d.entryInfoList();
136 QFileInfoListIterator it( *list ); 200 QFileInfoListIterator it( *list );
137 QFileInfo *fi; 201 QFileInfo *fi;
138 202
139 while ( (fi=it.current()) ) { 203 while ( (fi=it.current()) ) {
140 204
141 if( fi->fileName().contains(".so")){ 205 if( fi->fileName().contains(".so")){
142 /* if loaded install translation */ 206 /* if loaded install translation */
143 if( loadNetNode(path + "/" + fi->fileName()) ) { 207 if( loadNetNode(path + "/" + fi->fileName()) ) {
144 Log(( "Loading plugin %s\n", fi->fileName().latin1())); 208 Log(( "Loading plugin %s\n", fi->fileName().latin1()));
145 QTranslator *trans = new QTranslator(qApp); 209 QTranslator *trans = new QTranslator(qApp);
146 QString fn = QPEApplication::qpeDir()+ 210 QString fn = QPEApplication::qpeDir()+
147 "/i18n/"+lang+"/"+ 211 "/i18n/"+lang+"/"+
148 fi->fileName().left( fi->fileName().find(".") )+ 212 fi->fileName().left( fi->fileName().find(".") )+
149 ".qm"; 213 ".qm";
150 214
151 if( trans->load( fn ) ) 215 if( trans->load( fn ) )
152 qApp->installTranslator( trans ); 216 qApp->installTranslator( trans );
153 else 217 else
154 delete trans; 218 delete trans;
155 } else { 219 } else {
156 Log(( "Error loading plugin %s\n", fi->fileName().latin1())); 220 Log(( "Error loading plugin %s\n", fi->fileName().latin1()));
157 } 221 }
158 } 222 }
159 ++it; 223 ++it;
160 } 224 }
161} 225}
162 226
163// used to find unique connection number
164int TheNSResources::assignConnectionNumber( void ) {
165 bool found = 1;
166 for( int trial = 0; ; trial ++ ) {
167 found = 1;
168 for( QDictIterator<NodeCollection> it(ConnectionsMap);
169 it.current();
170 ++it ) {
171 if( it.current()->number() == trial ) {
172 found = 0;
173 break;
174 }
175 }
176
177 if( found ) {
178 Log(("Assign profile number %d\n", trial ));
179 return trial;
180 }
181 }
182}
183
184/** 227/**
185 * Attempt to load a function and resolve a function. 228 * Attempt to load a function and resolve a function.
186 * @param pluginFileName - the name of the file in which to attempt to load 229 * @param pluginFileName - the name of the file in which to attempt to load
187 * @param resolveString - function pointer to resolve 230 * @param resolveString - function pointer to resolve
188 * @return true of loading is successful 231 * @return true of loading is successful
189 */ 232 */
190bool TheNSResources::loadNetNode( 233bool TheNSResources::loadNetNode(
191 const QString &pluginFileName, const QString &resolveString){ 234 const QString &pluginFileName, const QString &resolveString){
192 235
193 QLibrary *lib = new QLibrary(pluginFileName); 236 QLibrary *lib = new QLibrary(pluginFileName);
194 void * res = lib->resolve(resolveString); 237 void * res = lib->resolve(resolveString);
195 if( ! res ){ 238 if( ! res ){
196 delete lib; 239 delete lib;
197 return 0; 240 return 0;
198 } 241 }
199 242
200 GetNetNodeListFt_t getNetNodeList = (GetNetNodeListFt_t)res; 243 GetNetNodeListFt_t getNetNodeList = (GetNetNodeListFt_t)res;
201 244
202 // Try to get an object. 245 // Try to get an object.
203 QList<ANetNode> PNN; 246 QList<ANetNode> PNN;
204 247
205 getNetNodeList( PNN ); 248 getNetNodeList( PNN );
206 if( PNN.isEmpty() ) { 249 if( PNN.isEmpty() ) {
207 delete lib; 250 delete lib;
208 return 0; 251 return 0;
209 } 252 }
210 253
211 ANetNode * NNP; 254 ANetNode * NNP;
212 for( QListIterator<ANetNode> it(PNN); 255 for( QListIterator<ANetNode> it(PNN);
213 it.current(); 256 it.current();
214 ++it ) { 257 ++it ) {
215 NetNode_t * NN; 258 NetNode_t * NN;
216 259
217 NNP = it.current(); 260 NNP = it.current();
218 NN = new NetNode_t; 261 NN = new NetNode_t;
219 NN->NetNode = NNP; 262 NN->NetNode = NNP;
220 NN->TheLibrary = lib; 263 NN->TheLibrary = lib;
221 NN->NodeCountInLib = PNN.count(); 264 NN->NodeCountInLib = PNN.count();
222 265
223 // store mapping 266 // store mapping
224 AllNodeTypes.insert( NN->NetNode->name(), NN ); 267 AllNodeTypes.insert( NN->NetNode->name(), NN );
225 } 268 }
226 269
227 return 1; 270 return 1;
228} 271}
229 272
273#else
274
275void TheNSResources::findAvailableNetNodes( void ){
276
277 Plugins = new OPluginLoader( "networksettings2" );
278 Plugins->setAutoDelete( true );
279
280 PluginManager = new OPluginManager( Plugins );
281 PluginManager->load();
282
283 if( Plugins->isInSafeMode() ) {
284 QMessageBox::information(
285 0,
286 tr( "Today Error"),
287 tr( "<qt>The plugin '%1' caused Today to crash."
288 " It could be that the plugin is not properly"
289 " installed.<br>Today tries to continue loading"
290 " plugins.</qt>" )
291 .arg( PluginManager->crashedPlugin().name()));
292 }
293
294 // Get All Plugins
295 OPluginLoader::List allplugins = Plugins->filtered();
296
297 for( OPluginLoader::List::Iterator it = allplugins.begin();
298 it != allplugins.end();
299 ++it ) {
300
301 // check if this plugin supports the proper interface
302 NetNodeInterface * interface =
303 Plugins->load<NetNodeInterface>( *it, IID_NetworkSettings2 );
304
305 if( ! interface ) {
306 Log(( "Plugin %s from %s does not support proper interface\n",
307 it->name().latin1(), it->path().latin1() ));
308 continue;
309 }
310
311 // add the nodes in this plugin to the dictionary
312 { QList<ANetNode> PNN;
313
314 interface->create_plugin( PNN );
315
316 if( PNN.isEmpty() ) {
317 Log(( "Plugin %s from %s does offer any nodes\n",
318 it->name().latin1(), it->path().latin1() ));
319 delete interface;
320 continue;
321 }
322
323 // merge this node with global node
324 for( QListIterator<ANetNode> it(PNN);
325 it.current();
326 ++it ) {
327 AllNodeTypes.insert( it->current()->name(), it->current() );
328 }
329 }
330
331 // load the translation
332 QTranslator *trans = new QTranslator(qApp);
333 QString fn = QPEApplication::qpeDir()+
334 "/i18n/"+lang+"/"+ it->name() + ".qm";
335
336 if( trans->load( fn ) )
337 qApp->installTranslator( trans );
338 else
339 delete trans;
340 }
341
342}
343
344#endif
345
346// used to find unique connection number
347int TheNSResources::assignConnectionNumber( void ) {
348 bool found = 1;
349 for( int trial = 0; ; trial ++ ) {
350 found = 1;
351 for( QDictIterator<NodeCollection> it(ConnectionsMap);
352 it.current();
353 ++it ) {
354 if( it.current()->number() == trial ) {
355 found = 0;
356 break;
357 }
358 }
359
360 if( found ) {
361 Log(("Assign profile number %d\n", trial ));
362 return trial;
363 }
364 }
365}
366
230QPixmap TheNSResources::getPixmap( const QString & QS ) { 367QPixmap TheNSResources::getPixmap( const QString & QS ) {
231 QPixmap P; 368 QPixmap P;
232 QString S("networksettings2/"); 369 QString S("networksettings2/");
233 S += QS; 370 S += QS;
234 P = Resource::loadPixmap( S ); 371 P = Resource::loadPixmap( S );
235 if( P.isNull() ) { 372 if( P.isNull() ) {
236 Log(( "Cannot load %s\n", S.latin1() )); 373 Log(( "Cannot load %s\n", S.latin1() ));
237 } 374 }
238 return ( P.isNull() ) ? QPixmap() : P; 375 return ( P.isNull() ) ? QPixmap() : P;
239} 376}
240 377
241QString TheNSResources::tr( const char * s ) { 378QString TheNSResources::tr( const char * s ) {
242 return qApp->translate( "resource", s ); 379 return qApp->translate( "resource", s );
243} 380}
244 381
245const QString & TheNSResources::netNode2Name( const char * s ) { 382const QString & TheNSResources::netNode2Name( const char * s ) {
246 return NodeTypeNameMap[s]; 383 return NodeTypeNameMap[s];
247} 384}
248 385
249const QString & TheNSResources::netNode2Description( const char * s ) { 386const QString & TheNSResources::netNode2Description( const char * s ) {
250 return NodeTypeDescriptionMap[s]; 387 return NodeTypeDescriptionMap[s];
251} 388}
252 389
253void TheNSResources::addConnection( NodeCollection * NC ) { 390void TheNSResources::addConnection( NodeCollection * NC ) {
254 ANetNodeInstance * NNI; 391 ANetNodeInstance * NNI;
255 ConnectionsMap.insert( NC->name(), NC ); 392 ConnectionsMap.insert( NC->name(), NC );
256 // add (new) nodes to NodeList 393 // add (new) nodes to NodeList
257 for( QListIterator<ANetNodeInstance> it(*NC); 394 for( QListIterator<ANetNodeInstance> it(*NC);
258 it.current(); 395 it.current();
259 ++it ) { 396 ++it ) {
260 NNI = it.current(); 397 NNI = it.current();
261 if( findNodeInstance( NNI->name() ) == 0 ) { 398 if( findNodeInstance( NNI->name() ) == 0 ) {
262 // new item 399 // new item
263 addNodeInstance( NNI ); 400 addNodeInstance( NNI );
264 } 401 }
265 } 402 }
266} 403}
267 404
268void TheNSResources::removeConnection( const QString & N ) { 405void TheNSResources::removeConnection( const QString & N ) {
269 NodeCollection * NC = findConnection( N ); 406 NodeCollection * NC = findConnection( N );
270 if( ! NC ) 407 if( ! NC )
271 return; 408 return;
272 409
273 // delete netnodes in this connection 410 // delete netnodes in this connection
274 ANetNodeInstance * NNI; 411 ANetNodeInstance * NNI;
275 for( NNI = NC->first(); NNI != 0; NNI = NC->next() ) { 412 for( NNI = NC->first(); NNI != 0; NNI = NC->next() ) {
276 removeNodeInstance( NNI->name() ); 413 removeNodeInstance( NNI->name() );
277 } 414 }
278 ConnectionsMap.remove( N ); 415 ConnectionsMap.remove( N );
279} 416}
280 417
281NodeCollection * TheNSResources::findConnection( const QString & S ) { 418NodeCollection * TheNSResources::findConnection( const QString & S ) {
282 return ConnectionsMap[ S ]; 419 return ConnectionsMap[ S ];
283} 420}
284 421
285NodeCollection * TheNSResources::getConnection( int nr ) { 422NodeCollection * TheNSResources::getConnection( int nr ) {
286 for( QDictIterator<NodeCollection> it(ConnectionsMap); 423 for( QDictIterator<NodeCollection> it(ConnectionsMap);
287 it.current(); 424 it.current();
288 ++it ) { 425 ++it ) {
289 if( it.current()->number() == nr ) { 426 if( it.current()->number() == nr ) {
290 return it.current(); 427 return it.current();
291 } 428 }
292 } 429 }
293 return 0; 430 return 0;
294} 431}
295/* 432/*
296void TheNSResources::renumberConnections( void ) { 433void TheNSResources::renumberConnections( void ) {
297 Name2Connection_t & M = NSResources->connections(); 434 Name2Connection_t & M = NSResources->connections();
298 NodeCollection * NC; 435 NodeCollection * NC;
299 436
300 // for all connections 437 // for all connections
301 NodeCollection::resetMaxNr(); 438 NodeCollection::resetMaxNr();
302 for( QDictIterator<NodeCollection> it(M); 439 for( QDictIterator<NodeCollection> it(M);
303 it.current(); 440 it.current();
304 ++it ) { 441 ++it ) {
305 NC = it.current(); 442 NC = it.current();
306 NC->setNumber( NC->maxConnectionNumber()+1 ); 443 NC->setNumber( NC->maxConnectionNumber()+1 );
307 NC->setModified( 1 ); 444 NC->setModified( 1 );
308 } 445 }
309} 446}
310*/ 447*/
311 448
312typedef struct EnvVars { 449typedef struct EnvVars {
313 char * Name; 450 char * Name;
314 int Len; 451 int Len;
315} EnvVar_t; 452} EnvVar_t;
316 453
317#define AnEV(x) x, sizeof(x)-1 454#define AnEV(x) x, sizeof(x)-1
318 455
319static EnvVar_t EV[] = { 456static EnvVar_t EV[] = {
320 AnEV( "HOME" ), 457 AnEV( "HOME" ),
321 AnEV( "LOGNAME" ), 458 AnEV( "LOGNAME" ),
322 AnEV( "USER" ), 459 AnEV( "USER" ),
323 AnEV( "LD_LIBRARY_PATH" ), 460 AnEV( "LD_LIBRARY_PATH" ),
324 AnEV( "PATH" ), 461 AnEV( "PATH" ),
325 AnEV( "QTDIR" ), 462 AnEV( "QTDIR" ),
326 AnEV( "OPIEDIR" ), 463 AnEV( "OPIEDIR" ),
327 AnEV( "SHELL" ), 464 AnEV( "SHELL" ),
328 { NULL, 0 } 465 { NULL, 0 }
329}; 466};
330 467
331void TheNSResources::detectCurrentUser( void ) { 468void TheNSResources::detectCurrentUser( void ) {
332 // find current running qpe 469 // find current running qpe
333 QString QPEEnvFile = ""; 470 QString QPEEnvFile = "";
334 471
335 CurrentUser.UserName = ""; 472 CurrentUser.UserName = "";
336 CurrentUser.HomeDir = ""; 473 CurrentUser.HomeDir = "";
337 474
338 if( getenv( "OPIEDIR" ) == 0 ) { 475 if( getenv( "OPIEDIR" ) == 0 ) {
339 // nothing known 476 // nothing known
340 { // open proc dir and find all dirs in it 477 { // open proc dir and find all dirs in it
341 QRegExp R("[0-9]+"); 478 QRegExp R("[0-9]+");
342 QDir ProcDir( "/proc" ); 479 QDir ProcDir( "/proc" );
343 QFileInfo FI; 480 QFileInfo FI;
344 QStringList EL = ProcDir.entryList( QDir::Dirs ); 481 QStringList EL = ProcDir.entryList( QDir::Dirs );
345 482
346 // print it out 483 // print it out
347 for ( QStringList::Iterator it = EL.begin(); 484 for ( QStringList::Iterator it = EL.begin();
348 it != EL.end(); 485 it != EL.end();
349 ++it ) { 486 ++it ) {
350 if( R.match( (*it) ) >= 0 ) { 487 if( R.match( (*it) ) >= 0 ) {
351 QString S = ProcDir.path()+"/"+ (*it); 488 QString S = ProcDir.path()+"/"+ (*it);
352 S.append( "/exe" ); 489 S.append( "/exe" );
353 FI.setFile( S ); 490 FI.setFile( S );
354 // get the link 491 // get the link
355 S = FI.readLink(); 492 S = FI.readLink();
356 if( S.right( 8 ) == "/bin/qpe" ) { 493 if( S.right( 8 ) == "/bin/qpe" ) {
357 // found running qpe 494 // found running qpe
358 QPEEnvFile.sprintf( ProcDir.path()+ "/" + (*it) + "/environ" ); 495 QPEEnvFile.sprintf( ProcDir.path()+ "/" + (*it) + "/environ" );
359 break; 496 break;
360 } 497 }
361 } 498 }
362 } 499 }
363 } 500 }
364 501
365 if( QPEEnvFile.isEmpty() ) { 502 if( QPEEnvFile.isEmpty() ) {
366 // could not find qpe 503 // could not find qpe
367 Log(("Could not find qpe\n" )); 504 Log(("Could not find qpe\n" ));
368 return; 505 return;
369 } 506 }
370 507
371 // FI now contains path ProcDir to the cmd dir 508 // FI now contains path ProcDir to the cmd dir
372 { char * Buf = 0; 509 { char * Buf = 0;
373 char TB[1024]; 510 char TB[1024];
374 long BufSize = 0; 511 long BufSize = 0;
375 int fd; 512 int fd;
376 int rd; 513 int rd;
377 514
378 fd = open( QPEEnvFile.latin1(), O_RDONLY ); 515 fd = open( QPEEnvFile.latin1(), O_RDONLY );
379 if( fd < 0 ) { 516 if( fd < 0 ) {
380 Log(("Could not open %s : %d\n", 517 Log(("Could not open %s : %d\n",
381 QPEEnvFile.latin1(), errno )); 518 QPEEnvFile.latin1(), errno ));
382 return; 519 return;
383 } 520 }
384 521
385 while( (rd = read( fd, TB, sizeof(TB) ) ) > 0 ) { 522 while( (rd = read( fd, TB, sizeof(TB) ) ) > 0 ) {
386 Buf = (char *)realloc( Buf, BufSize+rd ); 523 Buf = (char *)realloc( Buf, BufSize+rd );
387 memcpy( Buf+BufSize, TB, rd ); 524 memcpy( Buf+BufSize, TB, rd );
388 BufSize += rd; 525 BufSize += rd;
389 } 526 }
390 527
391 char * Data = Buf; 528 char * Data = Buf;
392 char * DataEnd = Data+BufSize-1; 529 char * DataEnd = Data+BufSize-1;
393 530
394 // get env items out of list 531 // get env items out of list
395 while( Data < DataEnd ) { 532 while( Data < DataEnd ) {
396 533
397 EnvVar_t * Run = EV; 534 EnvVar_t * Run = EV;
398 while( Run->Name ) { 535 while( Run->Name ) {
399 if( strncmp( Data, Run->Name, Run->Len ) == 0 && 536 if( strncmp( Data, Run->Name, Run->Len ) == 0 &&
400 Data[Run->Len] == '=' 537 Data[Run->Len] == '='
401 ) { 538 ) {
402 CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); 539 CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 );
403 CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = 540 CurrentUser.EnvList[CurrentUser.EnvList.size()-1] =
404 strdup( Data ); 541 strdup( Data );
405 542
406 if( strcmp( Run->Name, "OPIEDIR" ) == 0 ) { 543 if( strcmp( Run->Name, "OPIEDIR" ) == 0 ) {
407 // put OPIEDIR in env 544 // put OPIEDIR in env
408 putenv( CurrentUser.EnvList[CurrentUser.EnvList.size()-1] ); 545 putenv( CurrentUser.EnvList[CurrentUser.EnvList.size()-1] );
409 } else if( strcmp( Run->Name, "HOME" ) == 0 ) { 546 } else if( strcmp( Run->Name, "HOME" ) == 0 ) {
410 CurrentUser.HomeDir = Data+5; 547 CurrentUser.HomeDir = Data+5;
411 } else if( strcmp( Run->Name, "LOGNAME" ) == 0 ) { 548 } else if( strcmp( Run->Name, "LOGNAME" ) == 0 ) {
412 CurrentUser.UserName = Data+8; 549 CurrentUser.UserName = Data+8;
413 } 550 }
414 break; 551 break;
415 } 552 }
416 Run ++; 553 Run ++;
417 } 554 }
418 555
419 Data += strlen( Data )+1; 556 Data += strlen( Data )+1;
420 } 557 }
421 558
diff --git a/noncore/settings/networksettings2/networksettings2/resources.h b/noncore/settings/networksettings2/networksettings2/resources.h
index 5d90286..421a433 100644
--- a/noncore/settings/networksettings2/networksettings2/resources.h
+++ b/noncore/settings/networksettings2/networksettings2/resources.h
@@ -1,144 +1,183 @@
1#ifndef __RESOURCES__H 1#ifndef __RESOURCES__H
2#define __RESOURCES__H 2#define __RESOURCES__H
3 3
4#include <qstring.h> 4#include <qstring.h>
5#include <qdict.h> 5#include <qdict.h>
6#include <qmap.h> 6#include <qmap.h>
7#include <qlist.h> 7#include <qlist.h>
8#include "netnode.h" 8#include "netnode.h"
9#include "systemfile.h" 9#include "systemfile.h"
10#include "system.h" 10#include "system.h"
11 11
12class QLibrary; 12class QLibrary;
13class QPixmap; 13class QPixmap;
14class ANetNode; 14class ANetNode;
15class ANetNodeInstance; 15class ANetNodeInstance;
16 16
17typedef void (*GetNetNodeListFt_t)(QList<ANetNode>& PNN ); 17namespace Opie {
18 namespace Core {
19 class OPluginLoader;
20 class OPluginManager;
21 }
22}
18 23
19typedef struct NetNode_S { 24typedef void (*GetNetNodeListFt_t)(QList<ANetNode>& PNN );
20 ANetNode * NetNode;
21 QLibrary * TheLibrary;
22 long NodeCountInLib;
23} NetNode_t;
24 25
25class CurrentQPEUser { 26class CurrentQPEUser {
26 27
27public : 28public :
28 CurrentQPEUser() : UserName(), HomeDir(), EnvList() {} 29 CurrentQPEUser() : UserName(), HomeDir(), EnvList() {}
29 30
30 inline bool known( void ) 31 inline bool known( void )
31 { return ! HomeDir.isEmpty() && ! UserName.isEmpty(); } 32 { return ! HomeDir.isEmpty() && ! UserName.isEmpty(); }
32 33
33 QString UserName; 34 QString UserName;
34 QString HomeDir; 35 QString HomeDir;
35 int Uid; 36 int Uid;
36 int Gid; 37 int Gid;
37 QArray<char *> EnvList; 38 QArray<char *> EnvList;
38}; 39};
39 40
41#ifdef MYPLUGIN
42
43typedef struct NetNode_S {
44 ANetNode * NetNode;
45 QLibrary * TheLibrary;
46 long NodeCountInLib;
47} NetNode_t;
40typedef QDict<NetNode_t> Name2NetNode_t; 48typedef QDict<NetNode_t> Name2NetNode_t;
49
50#else
51
52typedef QDict<ANetNode> Name2NetNode_t;
53
54#endif
55
41typedef QDict<ANetNodeInstance > Name2Instance_t; 56typedef QDict<ANetNodeInstance > Name2Instance_t;
42typedef QDict<NodeCollection> Name2Connection_t; 57typedef QDict<NodeCollection> Name2Connection_t;
43typedef QDict<SystemFile> Name2SystemFile_t; 58typedef QDict<SystemFile> Name2SystemFile_t;
44 59
45class TheNSResources { 60class TheNSResources {
46 61
47public : 62public :
48 63
49 TheNSResources( void ); 64 TheNSResources( void );
50 ~TheNSResources( ); 65 ~TheNSResources( );
51 66
52 // give busy feedback 67 // give busy feedback
53 void busy( bool B ); 68 void busy( bool B );
54 69
55 System & system() 70 System & system()
56 { return *TheSystem; } 71 { return *TheSystem; }
57 72
58 int assignConnectionNumber(void); 73 int assignConnectionNumber(void);
59 QPixmap getPixmap( const QString & Name ); 74 QPixmap getPixmap( const QString & Name );
60 75
61 Name2NetNode_t & netNodes( void ) 76 Name2NetNode_t & netNodes( void )
62 { return AllNodeTypes; } 77 { return AllNodeTypes; }
63 bool netNodeExists( const QString & X ) 78 bool netNodeExists( const QString & X )
64 { return AllNodeTypes.find(X)!=0; } 79 { return AllNodeTypes.find(X)!=0; }
80#ifdef MYPLUGIN
65 ANetNode * findNetNode( const QString & N ) 81 ANetNode * findNetNode( const QString & N )
66 { NetNode_t * NNT = AllNodeTypes.find(N); 82 { NetNode_t * NNT = AllNodeTypes.find(N);
67 return (NNT) ? NNT->NetNode : 0; 83 return (NNT) ? NNT->NetNode : 0;
68 } 84 }
69 85#else
86 ANetNode * findNetNode( const QString & N )
87 { return AllNodeTypes.find(N);
88 }
89#endif
70 // define new plugin (=node) 90 // define new plugin (=node)
71 void addNodeType( const QString & ID, 91 void addNodeType( const QString & ID,
72 const QString & LongName, 92 const QString & LongName,
73 const QString & Description ); 93 const QString & Description );
74 94
75 Name2SystemFile_t & systemFiles( void ) 95 Name2SystemFile_t & systemFiles( void )
76 { return SystemFiles; } 96 { return SystemFiles; }
77 void addSystemFile( const QString & ID, 97 void addSystemFile( const QString & ID,
78 const QString & P, 98 const QString & P,
79 bool KDI ); 99 bool KDI );
80 100
81 ANetNodeInstance * createNodeInstance( const QString & S ) 101 ANetNodeInstance * createNodeInstance( const QString & S )
82 { ANetNodeInstance * NNI = 0; 102 { ANetNodeInstance * NNI = 0;
83 printf( "Find node type %s\n", S.latin1() ); 103 printf( "Find node type %s\n", S.latin1() );
104#ifdef MYPLUGIN
84 NetNode_t * NNT = AllNodeTypes[S]; 105 NetNode_t * NNT = AllNodeTypes[S];
85 if( ! NNT ) { 106 if( ! NNT ) {
86 return 0; 107 return 0;
87 } 108 }
88 NNI = NNT->NetNode->createInstance(); 109 NNI = NNT->NetNode->createInstance();
110#else
111 ANetNode * NNT = AllNodeTypes[S];
112 if( ! NNT ) {
113 return 0;
114 }
115 NNI = NNT->createInstance();
116#endif
89 NNI->initialize(); 117 NNI->initialize();
90 return NNI; 118 return NNI;
91 } 119 }
92 120
93 Name2Instance_t & netNodeInstances( void ) 121 Name2Instance_t & netNodeInstances( void )
94 { return AllNodes; } 122 { return AllNodes; }
95 void addNodeInstance( ANetNodeInstance * I ) 123 void addNodeInstance( ANetNodeInstance * I )
96 { AllNodes.insert( I->name(), I ); } 124 { AllNodes.insert( I->name(), I ); }
97 void removeNodeInstance( const QString & N ) 125 void removeNodeInstance( const QString & N )
98 { AllNodes.remove( N );} 126 { AllNodes.remove( N );}
99 ANetNodeInstance * findNodeInstance( const QString & S ) 127 ANetNodeInstance * findNodeInstance( const QString & S )
100 { return AllNodes[S]; } 128 { return AllNodes[S]; }
101 129
102 const QString & netNode2Name( const char * Type ); 130 const QString & netNode2Name( const char * Type );
103 const QString & netNode2Description( const char * Type ); 131 const QString & netNode2Description( const char * Type );
104 132
105 void addConnection( NodeCollection * NC ); 133 void addConnection( NodeCollection * NC );
106 void removeConnection( const QString & N ); 134 void removeConnection( const QString & N );
107 NodeCollection * findConnection( const QString & N ); 135 NodeCollection * findConnection( const QString & N );
108 NodeCollection * getConnection( int nr ); 136 NodeCollection * getConnection( int nr );
109 Name2Connection_t & connections( void ) 137 Name2Connection_t & connections( void )
110 { return ConnectionsMap; } 138 { return ConnectionsMap; }
111 139
112 inline bool userKnown( void ) 140 inline bool userKnown( void )
113 { return CurrentUser.known(); } 141 { return CurrentUser.known(); }
114 CurrentQPEUser & currentUser( void ) 142 CurrentQPEUser & currentUser( void )
115 { return CurrentUser; } 143 { return CurrentUser; }
116 144
117private : 145private :
118 146
119 void detectCurrentUser( void ); 147 void detectCurrentUser( void );
120 QString tr( const char * path ); 148 QString tr( const char * path );
149
150#ifdef MYPLUGIN
121 void findAvailableNetNodes( const QString &path ); 151 void findAvailableNetNodes( const QString &path );
122 bool loadNetNode( 152 bool loadNetNode(
123 const QString &pluginFileName, 153 const QString &pluginFileName,
124 const QString &resolveString = "create_plugin"); 154 const QString &resolveString = "create_plugin");
155#else
156 void findAvailableNetNodes( void );
157#endif
125 158
126 QMap< QString, QString> NodeTypeNameMap; 159 QMap< QString, QString> NodeTypeNameMap;
127 QMap< QString, QString> NodeTypeDescriptionMap; 160 QMap< QString, QString> NodeTypeDescriptionMap;
128 Name2Connection_t ConnectionsMap; 161 Name2Connection_t ConnectionsMap;
129 System * TheSystem; 162 System * TheSystem;
130 Name2SystemFile_t SystemFiles; 163 Name2SystemFile_t SystemFiles;
131 164
132 // all node type classes 165 // all node type classes
133 Name2NetNode_t AllNodeTypes; 166 Name2NetNode_t AllNodeTypes;
134 167
135 // all nodes 168 // all nodes
136 Name2Instance_t AllNodes; 169 Name2Instance_t AllNodes;
170
171 CurrentQPEUser CurrentUser;
172
173#ifndef MYPLUGIN
174 Opie::Core::OPluginLoader * Plugins;
175 Opie::Core::OPluginManager * PluginManager;
176#endif
137 177
138 CurrentQPEUser CurrentUser;
139}; 178};
140 179
141extern TheNSResources * _NSResources; 180extern TheNSResources * _NSResources;
142#define NSResources _NSResources 181#define NSResources _NSResources
143 182
144#endif 183#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTDevice.h b/noncore/settings/networksettings2/opietooth2/OTDevice.h
index cf1c4b6..09de7ee 100644
--- a/noncore/settings/networksettings2/opietooth2/OTDevice.h
+++ b/noncore/settings/networksettings2/opietooth2/OTDevice.h
@@ -1,116 +1,116 @@
1#ifndef OTDEVICE_H 1#ifndef OTDEVICE_H
2#define OTDEVICE_H 2#define OTDEVICE_H
3 3
4#include <qobject.h> 4#include <qobject.h>
5#include <qstring.h> 5#include <qstring.h>
6 6
7#include <bluezlib.h> 7#include <bluezlib.h>
8 8
9#include <OTGateway.h> 9#include <OTGateway.h>
10 10
11// define if you want to use the process hciattach for detection 11// define if you want to use the process hciattach for detection
12// #define USEHCIPROC 12// #define USEHCIPROC
13 13
14class QTimerEvent; 14class QTimerEvent;
15 15
16namespace Opie { 16namespace Opie {
17 namespace Core { 17 namespace Core {
18 class OProcess; 18 class OProcess;
19 }; 19 }
20}; 20}
21 21
22namespace Opietooth2 { 22namespace Opietooth2 {
23 23
24 /** 24 /**
25 * Device takes care of attaching serial 25 * Device takes care of attaching serial
26 * devices to the blueZ stack. 26 * devices to the blueZ stack.
27 * After attaching it hciconfig ups it 27 * After attaching it hciconfig ups it
28 */ 28 */
29 class OTDevice : public QObject { 29 class OTDevice : public QObject {
30 30
31 Q_OBJECT 31 Q_OBJECT
32 32
33 public: 33 public:
34 34
35 /** 35 /**
36 * Brings up the device. 36 * Brings up the device.
37 * will detech which device is needed 37 * will detech which device is needed
38 * Usage example: new Device(/dev/ttySB0, csr) 38 * Usage example: new Device(/dev/ttySB0, csr)
39 * 39 *
40 */ 40 */
41 OTDevice( OTGateway * _OT ); 41 OTDevice( OTGateway * _OT );
42 42
43 /** 43 /**
44 * unloads the device 44 * unloads the device
45 */ 45 */
46 ~OTDevice(); 46 ~OTDevice();
47 47
48 inline OTGateway * gateway() const 48 inline OTGateway * gateway() const
49 { return OT; } 49 { return OT; }
50 50
51 inline bool needsAttach( void ) const 51 inline bool needsAttach( void ) const
52 { return NeedsAttach; } 52 { return NeedsAttach; }
53 53
54 inline int deviceNr() const 54 inline int deviceNr() const
55 { return m_deviceNr; } 55 { return m_deviceNr; }
56 56
57 /** 57 /**
58 * attach the device 58 * attach the device
59 * @return bool which is TRUE if command started sucessfully 59 * @return bool which is TRUE if command started sucessfully
60 */ 60 */
61 bool attach(); 61 bool attach();
62 62
63 /** 63 /**
64 * detach the device 64 * detach the device
65 * @return bool which is TRUE if command started sucessfully 65 * @return bool which is TRUE if command started sucessfully
66 */ 66 */
67 bool detach(); 67 bool detach();
68 68
69 /** 69 /**
70 * Is the device loaded? 70 * Is the device loaded?
71 * @return bool, if the device is loaded 71 * @return bool, if the device is loaded
72 */ 72 */
73 bool isAttached()const; 73 bool isAttached()const;
74 74
75 // check current state of attachment 75 // check current state of attachment
76 bool checkAttach(); 76 bool checkAttach();
77 77
78 // returns pattern that points to the proper 78 // returns pattern that points to the proper
79 // RFCOMM device file. Put %1 where device nr should be put 79 // RFCOMM device file. Put %1 where device nr should be put
80 // e.g. : /dev/bluetooth/rfcomm/%1 or /def/rfcomm%1 80 // e.g. : /dev/bluetooth/rfcomm/%1 or /def/rfcomm%1
81 QString getRFCommDevicePattern(); 81 QString getRFCommDevicePattern();
82 82
83 signals: 83 signals:
84 84
85 /** 85 /**
86 * Signals if the attach/detach of the device produced 86 * Signals if the attach/detach of the device produced
87 * errors 87 * errors
88 * @param Mesg contains an error message 88 * @param Mesg contains an error message
89 */ 89 */
90 void error( const QString & mesg ); 90 void error( const QString & mesg );
91 void isEnabled( int devnr, bool ); 91 void isEnabled( int devnr, bool );
92 92
93 private slots: 93 private slots:
94 94
95 void slotStdOut(Opie::Core::OProcess*, char*, int ); 95 void slotStdOut(Opie::Core::OProcess*, char*, int );
96 void slotStdErr(Opie::Core::OProcess*, char*, int ); 96 void slotStdErr(Opie::Core::OProcess*, char*, int );
97 97
98 private: 98 private:
99 99
100 void detectDeviceType( QString & Device, 100 void detectDeviceType( QString & Device,
101 QString & Mode, 101 QString & Mode,
102 unsigned long & Speed ); 102 unsigned long & Speed );
103 pid_t getPidOfHCIAttach( void ); 103 pid_t getPidOfHCIAttach( void );
104 104
105 Opie::Core::OProcess* m_hciattach; // ptr to hciattach proces 105 Opie::Core::OProcess* m_hciattach; // ptr to hciattach proces
106 106
107 int m_deviceNr; // x as in hci(x) 107 int m_deviceNr; // x as in hci(x)
108 pid_t m_hciattachPid; // pid of hciattach program 108 pid_t m_hciattachPid; // pid of hciattach program
109 109
110 // backpointer 110 // backpointer
111 OTGateway * OT; 111 OTGateway * OT;
112 bool NeedsAttach; 112 bool NeedsAttach;
113 }; 113 };
114}; 114}
115 115
116#endif 116#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTDeviceAddress.h b/noncore/settings/networksettings2/opietooth2/OTDeviceAddress.h
index 50f28fc..8395f37 100644
--- a/noncore/settings/networksettings2/opietooth2/OTDeviceAddress.h
+++ b/noncore/settings/networksettings2/opietooth2/OTDeviceAddress.h
@@ -1,108 +1,108 @@
1//-*-c++-*- 1//-*-c++-*-
2/*************************************************************************** 2/***************************************************************************
3 * Copyright (C) 2003 by Fred Schaettgen * 3 * Copyright (C) 2003 by Fred Schaettgen *
4 * kdebluetooth@0xF.de * 4 * kdebluetooth@0xF.de *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by * 7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or * 8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. * 9 * (at your option) any later version. *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12#ifndef OTDEVICEADDRESS_H 12#ifndef OTDEVICEADDRESS_H
13#define OTDEVICEADDRESS_H 13#define OTDEVICEADDRESS_H
14 14
15#include <qstring.h> 15#include <qstring.h>
16#include <bluezlib.h> 16#include <bluezlib.h>
17 17
18namespace Opietooth2 { 18namespace Opietooth2 {
19 19
20/** Represents a Bluetooth device address. 20/** Represents a Bluetooth device address.
21 * This class allows easy conversion of Bluetooth addresses 21 * This class allows easy conversion of Bluetooth addresses
22 * from and to strings. It also works with the bdaddr_t type 22 * from and to strings. It also works with the bdaddr_t type
23 * used by BlueZ. 23 * used by BlueZ.
24 * The class offers a comparsion and less-than operator, so 24 * The class offers a comparsion and less-than operator, so
25 * that it can be used a key in an STL map or similar. 25 * that it can be used a key in an STL map or similar.
26 * The string conversion functions of BlueZ are used internally, 26 * The string conversion functions of BlueZ are used internally,
27 * so the string format is the same than for BlueZ's ba2str(). 27 * so the string format is the same than for BlueZ's ba2str().
28 */ 28 */
29class OTDeviceAddress { 29class OTDeviceAddress {
30 30
31public: 31public:
32 32
33 /** Default constructor. 33 /** Default constructor.
34 The resulting address is equal to DeviceAddress::invalid. 34 The resulting address is equal to DeviceAddress::invalid.
35 */ 35 */
36 OTDeviceAddress(); 36 OTDeviceAddress();
37 37
38 /** Initialize the object with a BlueZ bdaddr_t. 38 /** Initialize the object with a BlueZ bdaddr_t.
39 @param bdaddr address 39 @param bdaddr address
40 @param networkbyteorder if true, bdaddr is assumed to be in 40 @param networkbyteorder if true, bdaddr is assumed to be in
41 network byte order and converted to host byte order first. 41 network byte order and converted to host byte order first.
42 */ 42 */
43 explicit OTDeviceAddress( const bdaddr_t& bdaddr, 43 explicit OTDeviceAddress( const bdaddr_t& bdaddr,
44 bool networkbyteorder = false 44 bool networkbyteorder = false
45 ); 45 );
46 46
47 /** Initializes the object with an address given as a string. 47 /** Initializes the object with an address given as a string.
48 The string must be in a format which is understood by the 48 The string must be in a format which is understood by the
49 BlueZ str2ba function, like 00:61:58:4C:E6:AD. Case doesn't matter. 49 BlueZ str2ba function, like 00:61:58:4C:E6:AD. Case doesn't matter.
50 @param s address string 50 @param s address string
51 */ 51 */
52 explicit OTDeviceAddress(const QString& s); 52 explicit OTDeviceAddress(const QString& s);
53 53
54 /** convert the address to a string. 54 /** convert the address to a string.
55 @return address string 55 @return address string
56 */ 56 */
57 QString toString() const; 57 QString toString() const;
58 58
59 /** Converts the DeviceAddress into a BlueZ bdaddr_t. 59 /** Converts the DeviceAddress into a BlueZ bdaddr_t.
60 @param networkbyteorder if true, the address is returned 60 @param networkbyteorder if true, the address is returned
61 in network byte order. 61 in network byte order.
62 @return the address as bdaddr_t 62 @return the address as bdaddr_t
63 */ 63 */
64 inline const bdaddr_t & getBDAddr( void ) const 64 inline const bdaddr_t & getBDAddr( void ) const
65 { return BDaddr; } 65 { return BDaddr; }
66 bdaddr_t getBDAddrInNetworkByteOrder() const; 66 bdaddr_t getBDAddrInNetworkByteOrder() const;
67 void setBDAddr( const bdaddr_t& bdaddr, 67 void setBDAddr( const bdaddr_t& bdaddr,
68 bool networkbyteorder = false 68 bool networkbyteorder = false
69 ); 69 );
70 70
71 /** Less-than-operator. 71 /** Less-than-operator.
72 Mainly there to use DeviceAddress inside STL containers, 72 Mainly there to use DeviceAddress inside STL containers,
73 like STL sets or as a key in a STL map. 73 like STL sets or as a key in a STL map.
74 @param b the DeviceAddress to compare to (right hand side) 74 @param b the DeviceAddress to compare to (right hand side)
75 @return true if this < b, false otherwise. 75 @return true if this < b, false otherwise.
76 */ 76 */
77 bool operator<(const OTDeviceAddress& b) const; 77 bool operator<(const OTDeviceAddress& b) const;
78 78
79 /** Equality operator. 79 /** Equality operator.
80 Tests two device addresses for equality. 80 Tests two device addresses for equality.
81 @param b the DeviceAddress to compare to (right hand side) 81 @param b the DeviceAddress to compare to (right hand side)
82 @return true if this and b have the same address or 82 @return true if this and b have the same address or
83 if both are invalid, false otherwise 83 if both are invalid, false otherwise
84 */ 84 */
85 bool operator==(const OTDeviceAddress& b) const; 85 bool operator==(const OTDeviceAddress& b) const;
86 86
87 inline bool operator!=(const OTDeviceAddress& b) const 87 inline bool operator!=(const OTDeviceAddress& b) const
88 { return ! ( *this == b ); } 88 { return ! ( *this == b ); }
89 89
90 /** The address 00:00:00:FF:FF:FF */ 90 /** The address 00:00:00:FF:FF:FF */
91 static const OTDeviceAddress local; 91 static const OTDeviceAddress local;
92 92
93 /** The address 00:00:00:00:00:00 */ 93 /** The address 00:00:00:00:00:00 */
94 static const OTDeviceAddress any; 94 static const OTDeviceAddress any;
95 95
96 /** An address tagged as invalid */ 96 /** An address tagged as invalid */
97 static const OTDeviceAddress invalid; 97 static const OTDeviceAddress invalid;
98 98
99protected: 99protected:
100 100
101 bdaddr_t BDaddr; 101 bdaddr_t BDaddr;
102 bool IsValid; 102 bool IsValid;
103 103
104}; 104};
105 105
106}; 106}
107 107
108#endif 108#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTDriver.h b/noncore/settings/networksettings2/opietooth2/OTDriver.h
index f249cf7..b54ffdf 100644
--- a/noncore/settings/networksettings2/opietooth2/OTDriver.h
+++ b/noncore/settings/networksettings2/opietooth2/OTDriver.h
@@ -39,194 +39,194 @@ class OTPeer;
39class OTDriver : public QObject { 39class OTDriver : public QObject {
40 40
41 Q_OBJECT 41 Q_OBJECT
42 42
43public: 43public:
44 44
45 OTDriver( OTGateway * Ot, struct hci_dev_info* di); 45 OTDriver( OTGateway * Ot, struct hci_dev_info* di);
46 ~OTDriver(); 46 ~OTDriver();
47 47
48 inline OTGateway * gateway() const 48 inline OTGateway * gateway() const
49 { return OT; } 49 { return OT; }
50 50
51 /* 51 /*
52 * Initializes the device using the passed hci_dev_info 52 * Initializes the device using the passed hci_dev_info
53 * struct, contining the basic information in order to 53 * struct, contining the basic information in order to
54 * talk with the pyisical device. 54 * talk with the pyisical device.
55 */ 55 */
56 void init(struct hci_dev_info* di); 56 void init(struct hci_dev_info* di);
57 57
58 /* 58 /*
59 * Open the device and obtains a file descriptor to id 59 * Open the device and obtains a file descriptor to id
60 * return if open 60 * return if open
61 */ 61 */
62 bool open(); 62 bool open();
63 63
64 OTHCISocket * openSocket(); 64 OTHCISocket * openSocket();
65 65
66 void closeSocket(); 66 void closeSocket();
67 67
68 /* 68 /*
69 * Return true if the device is opened. 69 * Return true if the device is opened.
70 */ 70 */
71 int isOpen() 71 int isOpen()
72 { return Fd != -1; }; 72 { return Fd != -1; };
73 73
74 /* 74 /*
75 * Calls the ioctl(HCIDEVRESET) in order to 75 * Calls the ioctl(HCIDEVRESET) in order to
76 * reset the device. 76 * reset the device.
77 */ 77 */
78 int reset(); 78 int reset();
79 79
80 // set Up if true and not yet up 80 // set Up if true and not yet up
81 void setUp( bool Mode ); 81 void setUp( bool Mode );
82 82
83 /* 83 /*
84 * Turn the device up and the reinitializes the device. 84 * Turn the device up and the reinitializes the device.
85 * If the device is already up, nothing is done. 85 * If the device is already up, nothing is done.
86 */ 86 */
87 void bringUp(); 87 void bringUp();
88 88
89 /* 89 /*
90 * Turn the device down and the reinitializes the device. 90 * Turn the device down and the reinitializes the device.
91 * If the device is already down, nothing is done. 91 * If the device is already down, nothing is done.
92 */ 92 */
93 void bringDown(); 93 void bringDown();
94 94
95 // is the device UP now 95 // is the device UP now
96 bool isUp() const 96 bool isUp() const
97 { return IsUp; } 97 { return IsUp; }
98 98
99 // get current state 99 // get current state
100 // return 1 if UP, 0 if DOWN, -1 if ERROR 100 // return 1 if UP, 0 if DOWN, -1 if ERROR
101 int currentState(); 101 int currentState();
102 102
103 /* 103 /*
104 * Returns the name of the device. If the device is 104 * Returns the name of the device. If the device is
105 * down, the device id is returned. 105 * down, the device id is returned.
106 */ 106 */
107 QString name(); 107 QString name();
108 108
109 int devId() const 109 int devId() const
110 { return Dev_id; }; 110 { return Dev_id; };
111 111
112 /* 112 /*
113 * Returns the string representation of the device id, 113 * Returns the string representation of the device id,
114 * with the same format of the hciconfig tool. 114 * with the same format of the hciconfig tool.
115 */ 115 */
116 QString devname() 116 QString devname()
117 { return Dev; }; 117 { return Dev; };
118 118
119 /* 119 /*
120 * Returns the file descriptor for the local 120 * Returns the file descriptor for the local
121 * connection to this device 121 * connection to this device
122 */ 122 */
123 int fd() const 123 int fd() const
124 { return Fd; }; 124 { return Fd; };
125 void setfd(int _fd) 125 void setfd(int _fd)
126 { Fd = _fd; }; 126 { Fd = _fd; };
127 127
128 void setType(int _type) 128 void setType(int _type)
129 { Type = _type; }; 129 { Type = _type; };
130 int type() const 130 int type() const
131 { return Type; }; 131 { return Type; };
132 QString strType(); 132 QString strType();
133 133
134 int iscan() const 134 int iscan() const
135 { return Iscan; } 135 { return Iscan; }
136 void setIScan(int _iscan) 136 void setIScan(int _iscan)
137 { Iscan = _iscan; } 137 { Iscan = _iscan; }
138 138
139 int pscan() const 139 int pscan() const
140 { return Pscan; } 140 { return Pscan; }
141 void setPScan(int _pscan) 141 void setPScan(int _pscan)
142 { Pscan = _pscan; } 142 { Pscan = _pscan; }
143 143
144 int authentication() const 144 int authentication() const
145 { return Auth; } 145 { return Auth; }
146 void setAuthentication(int _auth) 146 void setAuthentication(int _auth)
147 { Auth = _auth; } 147 { Auth = _auth; }
148 148
149 int encryption() const 149 int encryption() const
150 { return Encrypt; } 150 { return Encrypt; }
151 void setEncryption(int _encrypt) 151 void setEncryption(int _encrypt)
152 { Encrypt = _encrypt; } 152 { Encrypt = _encrypt; }
153 153
154 void setDevId(int _dev_id) 154 void setDevId(int _dev_id)
155 { Dev_id = _dev_id; }; 155 { Dev_id = _dev_id; };
156 void setDev(char* _dev) 156 void setDev(char* _dev)
157 { Dev = _dev; }; 157 { Dev = _dev; };
158 158
159 void setFlags( unsigned long flags); 159 void setFlags( unsigned long flags);
160 160
161 const OTDeviceAddress & address() 161 const OTDeviceAddress & address()
162 { return Address; } 162 { return Address; }
163 163
164 void setFeatures( unsigned char * _f); 164 void setFeatures( unsigned char * _f);
165 QString features() 165 QString features()
166 { return Features; } 166 { return Features; }
167 167
168 void setManufacturer(int compid); 168 void setManufacturer(int compid);
169 QString manufacturer() 169 QString manufacturer()
170 { return Manufacturer; } 170 { return Manufacturer; }
171 171
172 QString revision(); 172 QString revision();
173 173
174 void setScanMode(bool iscan, bool pscan); 174 void setScanMode(bool iscan, bool pscan);
175 void setClass(unsigned long cls); 175 void setClass(unsigned long cls);
176 176
177 void changeDevName(const char* name); 177 void changeDevName(const char* name);
178 void changeEncryption(bool _encryption); 178 void changeEncryption(bool _encryption);
179 void changeAuthentication(bool _auth); 179 void changeAuthentication(bool _auth);
180 180
181 void getClass( QString & service, 181 void getClass( QString & service,
182 QString & device ); 182 QString & device );
183 void changeClass( unsigned char service, 183 void changeClass( unsigned char service,
184 unsigned char major, 184 unsigned char major,
185 unsigned char minor); 185 unsigned char minor);
186 186
187 QString getPeerName( const OTDeviceAddress & PAddr ); 187 QString getPeerName( const OTDeviceAddress & PAddr );
188 188
189 // address must be connected to this driver 189 // address must be connected to this driver
190 long getLinkQuality( const OTDeviceAddress & Address ); 190 long getLinkQuality( const OTDeviceAddress & Address );
191 191
192signals : 192signals :
193 193
194 void error( const QString & ); 194 void error( const QString & );
195 void stateChange( OTDriver * , bool ); 195 void stateChange( OTDriver * , bool );
196 void driverDisappeared( OTDriver * ); 196 void driverDisappeared( OTDriver * );
197 197
198private slots : 198private slots :
199 199
200 /* 200 /*
201 * Reinitializes the device, obtaining a fresh 201 * Reinitializes the device, obtaining a fresh
202 * hci_dev_info structure. 202 * hci_dev_info structure.
203 */ 203 */
204 void reinit(); 204 void reinit();
205 void SLOT_CloseFd(); 205 void SLOT_CloseFd();
206 206
207private: 207private:
208 208
209 QString getRevEricsson(); 209 QString getRevEricsson();
210 QString getRevCsr(unsigned short rev); 210 QString getRevCsr(unsigned short rev);
211 211
212 QString Name; 212 QString Name;
213 QString Dev; 213 QString Dev;
214 QString Revision; 214 QString Revision;
215 QString Manufacturer; 215 QString Manufacturer;
216 OTDeviceAddress Address; 216 OTDeviceAddress Address;
217 QString Features; 217 QString Features;
218 QTimer * AutoClose; 218 QTimer * AutoClose;
219 219
220 int Dev_id,Fd,Type; 220 int Dev_id,Fd,Type;
221 bool IsUp; 221 bool IsUp;
222 int Iscan,Pscan,Auth,Encrypt; 222 int Iscan,Pscan,Auth,Encrypt;
223 223
224 // socket bound to this device 224 // socket bound to this device
225 OTHCISocket * Socket; 225 OTHCISocket * Socket;
226 226
227 // backpointer to opietooth system 227 // backpointer to opietooth system
228 OTGateway * OT; 228 OTGateway * OT;
229}; 229};
230 230
231}; 231}
232#endif 232#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTGateway.h b/noncore/settings/networksettings2/opietooth2/OTGateway.h
index a47cefb..d97ef35 100644
--- a/noncore/settings/networksettings2/opietooth2/OTGateway.h
+++ b/noncore/settings/networksettings2/opietooth2/OTGateway.h
@@ -6,195 +6,195 @@
6#include <qmap.h> 6#include <qmap.h>
7 7
8#include <OTDriverList.h> 8#include <OTDriverList.h>
9#include <OTInquiry.h> 9#include <OTInquiry.h>
10 10
11class QPixmap; 11class QPixmap;
12 12
13namespace Opietooth2 { 13namespace Opietooth2 {
14 14
15class OTDriverList; 15class OTDriverList;
16class OTDriver; 16class OTDriver;
17class OTDevice; 17class OTDevice;
18class OTPeer; 18class OTPeer;
19class OTInquiry; 19class OTInquiry;
20class OTPANConnection; 20class OTPANConnection;
21class OTLinkKey; 21class OTLinkKey;
22 22
23typedef QVector<OTPeer> PeerVector; 23typedef QVector<OTPeer> PeerVector;
24typedef QVector<OTPANConnection> PANConnectionVector; 24typedef QVector<OTPANConnection> PANConnectionVector;
25typedef QArray<OTLinkKey> LinkKeyArray; 25typedef QArray<OTLinkKey> LinkKeyArray;
26 26
27class OTLinkKey { 27class OTLinkKey {
28 28
29public : 29public :
30 30
31 OTLinkKey( const OTDeviceAddress & F, 31 OTLinkKey( const OTDeviceAddress & F,
32 const OTDeviceAddress & T ) { 32 const OTDeviceAddress & T ) {
33 From = F; 33 From = F;
34 To = T; 34 To = T;
35 } 35 }
36 36
37 const OTDeviceAddress & to() 37 const OTDeviceAddress & to()
38 { return To; } 38 { return To; }
39 const OTDeviceAddress & from() 39 const OTDeviceAddress & from()
40 { return From; } 40 { return From; }
41 41
42 OTDeviceAddress From; 42 OTDeviceAddress From;
43 OTDeviceAddress To; 43 OTDeviceAddress To;
44}; 44};
45 45
46class OTPANConnection { 46class OTPANConnection {
47 47
48public : 48public :
49 49
50 OTPANConnection( const QString & Dev, const QString & CT ) { 50 OTPANConnection( const QString & Dev, const QString & CT ) {
51 Device = Dev; 51 Device = Dev;
52 ConnectedTo = CT; 52 ConnectedTo = CT;
53 } 53 }
54 54
55 QString Device; 55 QString Device;
56 QString ConnectedTo; 56 QString ConnectedTo;
57}; 57};
58 58
59 59
60class OTGateway : public QObject { 60class OTGateway : public QObject {
61 61
62 Q_OBJECT 62 Q_OBJECT
63 63
64public : 64public :
65 65
66 // single instance 66 // single instance
67 static OTGateway * getOTGateway( void ); 67 static OTGateway * getOTGateway( void );
68 static void releaseOTGateway( void ); 68 static void releaseOTGateway( void );
69 // convert device type as class to name for that class 69 // convert device type as class to name for that class
70 static const char * deviceTypeToName( int Cls ); 70 static const char * deviceTypeToName( int Cls );
71 71
72 // open bluetooth system 72 // open bluetooth system
73 OTGateway( void ); 73 OTGateway( void );
74 // close bluetooth system 74 // close bluetooth system
75 ~OTGateway( void ); 75 ~OTGateway( void );
76 76
77 // get access to system device 77 // get access to system device
78 OTDevice * getOTDevice(); 78 OTDevice * getOTDevice();
79 79
80 // return true if this device needs enabling of bluetooth 80 // return true if this device needs enabling of bluetooth
81 bool needsEnabling(); 81 bool needsEnabling();
82 // return true if system is running 82 // return true if system is running
83 bool isEnabled(); 83 bool isEnabled();
84 void setRefreshTimer( int MilleSecs ); 84 void setRefreshTimer( int MilleSecs );
85 // return socket to HCI raw layer 85 // return socket to HCI raw layer
86 inline int getSocket() 86 inline int getSocket()
87 { return HciCtl; } 87 { return HciCtl; }
88 88
89 OTDriverList & getDriverList() 89 OTDriverList & getDriverList()
90 { return AllDrivers; } 90 { return AllDrivers; }
91 OTDriver * driver( int nr ) 91 OTDriver * driver( int nr )
92 { return AllDrivers[nr]; } 92 { return AllDrivers[nr]; }
93 void updateDrivers(); 93 void updateDrivers();
94 94
95 PANConnectionVector getPANConnections(); 95 PANConnectionVector getPANConnections();
96 96
97 // scan neighbourhood using device 97 // scan neighbourhood using device
98 void scanNeighbourhood( OTDriver * D = 0 ); 98 void scanNeighbourhood( OTDriver * D = 0 );
99 void stopScanOfNeighbourhood(void ); 99 void stopScanOfNeighbourhood(void );
100 void setScanWith( OTDriver * D = 0 ) 100 void setScanWith( OTDriver * D = 0 )
101 { ScanWith = (D) ? D : 101 { ScanWith = (D) ? D :
102 (AllDrivers.count() ) ? AllDrivers[0] : 0; } 102 (AllDrivers.count() ) ? AllDrivers[0] : 0; }
103 OTDriver * scanWith( void ) 103 OTDriver * scanWith( void )
104 { return ScanWith; } 104 { return ScanWith; }
105 105
106 // get list of all detected peers 106 // get list of all detected peers
107 inline const PeerVector & peers( void ) 107 inline const PeerVector & peers( void )
108 { return AllPeers; } 108 { return AllPeers; }
109 // ping peer to see if it is up 109 // ping peer to see if it is up
110 bool isPeerUp( const OTDeviceAddress & PAddr, 110 bool isPeerUp( const OTDeviceAddress & PAddr,
111 int timeoutInSec = 1, 111 int timeoutInSec = 1,
112 int timeoutInUSec = 0, 112 int timeoutInUSec = 0,
113 int retry = 1 ); 113 int retry = 1 );
114 OTPeer * findPeer( const OTDeviceAddress & Addr ); 114 OTPeer * findPeer( const OTDeviceAddress & Addr );
115 void removePeer( OTPeer * P ); 115 void removePeer( OTPeer * P );
116 void addPeer( OTPeer * P ); 116 void addPeer( OTPeer * P );
117 117
118 OTDriver * findDriver( const OTDeviceAddress & Addr ); 118 OTDriver * findDriver( const OTDeviceAddress & Addr );
119 119
120 inline const LinkKeyArray & getLinkKeys() const 120 inline const LinkKeyArray & getLinkKeys() const
121 { return AllKeys; } 121 { return AllKeys; }
122 bool removeLinkKey( unsigned int index ); 122 bool removeLinkKey( unsigned int index );
123 123
124 // return device number if we are connected over any device 124 // return device number if we are connected over any device
125 // to the channel 125 // to the channel
126 // else returns -1 126 // else returns -1
127 int connectedToRFCommChannel( const OTDeviceAddress & Addr, int channel ); 127 int connectedToRFCommChannel( const OTDeviceAddress & Addr, int channel );
128 int getFreeRFCommDevice( void ); 128 int getFreeRFCommDevice( void );
129 // return 0 if properly released 129 // return 0 if properly released
130 int releaseRFCommDevice( int DevNr ); 130 int releaseRFCommDevice( int DevNr );
131 131
132public slots : 132public slots :
133 133
134 // start bluetooth system 134 // start bluetooth system
135 void SLOT_SetEnabled( bool ); 135 void SLOT_SetEnabled( bool );
136 void SLOT_Enable(); 136 void SLOT_Enable();
137 void SLOT_Disable(); 137 void SLOT_Disable();
138 138
139 // show error 139 // show error
140 void SLOT_ShowError( const QString & ); 140 void SLOT_ShowError( const QString & );
141 141
142 void SLOT_Enabled( int, bool ); 142 void SLOT_Enabled( int, bool );
143 void SLOT_DriverDisappeared( OTDriver * ); 143 void SLOT_DriverDisappeared( OTDriver * );
144 void SLOT_PeerDetected( OTPeer *, bool ); 144 void SLOT_PeerDetected( OTPeer *, bool );
145 void SLOT_FinishedDetecting(); 145 void SLOT_FinishedDetecting();
146 146
147signals : 147signals :
148 148
149 // any error 149 // any error
150 void error( const QString & ); 150 void error( const QString & );
151 151
152 // signal state of bluetooth driver 152 // signal state of bluetooth driver
153 void stateChange( OTDriver * D, bool State ); 153 void stateChange( OTDriver * D, bool State );
154 154
155 // sent when list of drivers changees 155 // sent when list of drivers changees
156 void driverListChanged(); 156 void driverListChanged();
157 157
158 // sent when bluetooth on device is enabled 158 // sent when bluetooth on device is enabled
159 void deviceEnabled( bool ); 159 void deviceEnabled( bool );
160 160
161 // sent when a (new if bool = TRUE) peer is detected 161 // sent when a (new if bool = TRUE) peer is detected
162 void detectedPeer( OTPeer *, bool ); 162 void detectedPeer( OTPeer *, bool );
163 163
164 // end of detection process 164 // end of detection process
165 void finishedDetecting(); 165 void finishedDetecting();
166 166
167protected : 167protected :
168 168
169 void connectNotify( const char * Signal ); 169 void connectNotify( const char * Signal );
170 void disconnectNotify( const char * Signal ); 170 void disconnectNotify( const char * Signal );
171 171
172 void timerEvent( QTimerEvent * ); 172 void timerEvent( QTimerEvent * );
173 173
174private : 174private :
175 175
176 void loadActiveConnections( void ); 176 void loadActiveConnections( void );
177 void loadKnownPeers( void ); 177 void loadKnownPeers( void );
178 void saveKnownPeers( void ); 178 void saveKnownPeers( void );
179 bool isConnectedTo( int devid, 179 bool isConnectedTo( int devid,
180 const OTDeviceAddress & Address ); 180 const OTDeviceAddress & Address );
181 181
182 void readLinkKeys(); 182 void readLinkKeys();
183 183
184 static OTGateway * SingleGateway; 184 static OTGateway * SingleGateway;
185 static int UseCount; 185 static int UseCount;
186 186
187 OTDriver * ScanWith; 187 OTDriver * ScanWith;
188 OTDriverList AllDrivers; 188 OTDriverList AllDrivers;
189 OTDevice * TheOTDevice; 189 OTDevice * TheOTDevice;
190 int HciCtl; 190 int HciCtl;
191 int ErrorConnectCount; 191 int ErrorConnectCount;
192 int RefreshTimer; 192 int RefreshTimer;
193 OTInquiry * Scanning; 193 OTInquiry * Scanning;
194 bool AllPeersModified; 194 bool AllPeersModified;
195 PeerVector AllPeers; 195 PeerVector AllPeers;
196 LinkKeyArray AllKeys; 196 LinkKeyArray AllKeys;
197}; 197};
198}; 198}
199 199
200#endif 200#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTHCISocket.h b/noncore/settings/networksettings2/opietooth2/OTHCISocket.h
index d508078..a004989 100644
--- a/noncore/settings/networksettings2/opietooth2/OTHCISocket.h
+++ b/noncore/settings/networksettings2/opietooth2/OTHCISocket.h
@@ -1,116 +1,116 @@
1//-*-c++-*- 1//-*-c++-*-
2/*************************************************************************** 2/***************************************************************************
3 * Copyright (C) 2003 by Fred Schaettgen * 3 * Copyright (C) 2003 by Fred Schaettgen *
4 * kdebluetooth@schaettgen.de * 4 * kdebluetooth@schaettgen.de *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by * 7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or * 8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. * 9 * (at your option) any later version. *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12#ifndef OTHCISOCKET_H 12#ifndef OTHCISOCKET_H
13#define OTHCISOCKET_H 13#define OTHCISOCKET_H
14 14
15#include <qobject.h> 15#include <qobject.h>
16#include <qsocketnotifier.h> 16#include <qsocketnotifier.h>
17#include <qsocketdevice.h> 17#include <qsocketdevice.h>
18#include <qguardedptr.h> 18#include <qguardedptr.h>
19 19
20class QSocket; 20class QSocket;
21 21
22namespace Opietooth2 { 22namespace Opietooth2 {
23 23
24/** Bluetooth HCI Socket class. 24/** Bluetooth HCI Socket class.
25 * This class provides socket level access to the Bluez HCI layer. 25 * This class provides socket level access to the Bluez HCI layer.
26 * It is set up to filter out all but HCI event packets, since more 26 * It is set up to filter out all but HCI event packets, since more
27 * is only allowed for privileged users. 27 * is only allowed for privileged users.
28 * @todo writeHciEvent() function 28 * @todo writeHciEvent() function
29 * @todo error handling 29 * @todo error handling
30 */ 30 */
31 31
32class OTDriver; 32class OTDriver;
33 33
34class OTHCISocket : public QObject { 34class OTHCISocket : public QObject {
35 35
36 Q_OBJECT 36 Q_OBJECT
37 37
38public: 38public:
39 39
40 OTHCISocket( OTDriver * ConnectTo ); 40 OTHCISocket( OTDriver * ConnectTo );
41 virtual ~OTHCISocket(); 41 virtual ~OTHCISocket();
42 42
43 /** Opens a HCI socket for the given 43 /** Opens a HCI socket for the given
44 @return true if sucessfully opened, false otherwise 44 @return true if sucessfully opened, false otherwise
45 */ 45 */
46 virtual bool open(); 46 virtual bool open();
47 47
48 /** Closes the HCI socket. */ 48 /** Closes the HCI socket. */
49 virtual void close(); 49 virtual void close();
50 50
51 bool sendCommand( unsigned char ogf, 51 bool sendCommand( unsigned char ogf,
52 unsigned short ocf, 52 unsigned short ocf,
53 QByteArray buf 53 QByteArray buf
54 ); 54 );
55 bool readStatus( unsigned char ogf, 55 bool readStatus( unsigned char ogf,
56 unsigned short ocf, 56 unsigned short ocf,
57 int *status, 57 int *status,
58 int timeout_ms = 1000); 58 int timeout_ms = 1000);
59 59
60 /** Reads whole HCI packet. 60 /** Reads whole HCI packet.
61 @param packetType [out] The packet type. Should always be ... 61 @param packetType [out] The packet type. Should always be ...
62 @param eventCode [out] The event code. 62 @param eventCode [out] The event code.
63 @param buflen [in/out] The maximum size of the buffer / the number of 63 @param buflen [in/out] The maximum size of the buffer / the number of
64 bytes written into the buffer. 64 bytes written into the buffer.
65 @param paramBuf pointer to a buffer for the HCI event packet 65 @param paramBuf pointer to a buffer for the HCI event packet
66 @return true if successful 66 @return true if successful
67 */ 67 */
68 /*bool readEvent(unsigned char &packetType, 68 /*bool readEvent(unsigned char &packetType,
69 unsigned char &eventCode, unsigned char &buflen, 69 unsigned char &eventCode, unsigned char &buflen,
70 char* paramBuf);*/ 70 char* paramBuf);*/
71 71
72 enum Error { ErrSocket = 1 }; 72 enum Error { ErrSocket = 1 };
73 73
74 /** Forces reading the next event packet. */ 74 /** Forces reading the next event packet. */
75 void readEvent( void ); 75 void readEvent( void );
76 76
77 /** Returns the internal socket */ 77 /** Returns the internal socket */
78 int socket( void ); 78 int socket( void );
79 79
80 inline QSocketDevice & socketDevice() 80 inline QSocketDevice & socketDevice()
81 { return HCISocket; } 81 { return HCISocket; }
82 82
83 inline OTDriver * driver() const 83 inline OTDriver * driver() const
84 { return Driver; } 84 { return Driver; }
85 85
86signals: 86signals:
87 87
88 void event( unsigned char eventCode, QByteArray buf); 88 void event( unsigned char eventCode, QByteArray buf);
89 void error( QString message ); 89 void error( QString message );
90 void connectionClosed( ); 90 void connectionClosed( );
91 91
92private: 92private:
93 93
94 void updateStatus( const QByteArray& data ); 94 void updateStatus( const QByteArray& data );
95 95
96 //QSocketDevice hciSocket; 96 //QSocketDevice hciSocket;
97 QGuardedPtr<QSocketNotifier> HCIReadNotifier; 97 QGuardedPtr<QSocketNotifier> HCIReadNotifier;
98 QSocketDevice HCISocket; 98 QSocketDevice HCISocket;
99 OTDriver * Driver ; 99 OTDriver * Driver ;
100 100
101 bool BStatusSet; 101 bool BStatusSet;
102 unsigned short LastStatusOcf; 102 unsigned short LastStatusOcf;
103 unsigned char LastStatusOgf; 103 unsigned char LastStatusOgf;
104 int LastStatus; 104 int LastStatus;
105 105
106private slots: 106private slots:
107 107
108 void slotSocketActivated(); 108 void slotSocketActivated();
109 void slotSocketError(int); 109 void slotSocketError(int);
110 void slotConnectionClosed(); 110 void slotConnectionClosed();
111 111
112}; 112};
113 113
114}; 114}
115 115
116#endif 116#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTIcons.h b/noncore/settings/networksettings2/opietooth2/OTIcons.h
index 966ed24..ee10831 100644
--- a/noncore/settings/networksettings2/opietooth2/OTIcons.h
+++ b/noncore/settings/networksettings2/opietooth2/OTIcons.h
@@ -1,54 +1,54 @@
1#ifndef OTICONLOADER_H 1#ifndef OTICONLOADER_H
2#define OTICONLOADER_H 2#define OTICONLOADER_H
3 3
4#include <OTUUID.h> 4#include <OTUUID.h>
5#include <qpixmap.h> 5#include <qpixmap.h>
6#include <qmap.h> 6#include <qmap.h>
7 7
8namespace Opietooth2 { 8namespace Opietooth2 {
9 9
10class OTIcons { 10class OTIcons {
11 11
12public: 12public:
13 13
14 OTIcons(); 14 OTIcons();
15 ~OTIcons(); 15 ~OTIcons();
16 16
17 /** 17 /**
18 * Returns an icon depending on device class 18 * Returns an icon depending on device class
19 * @param deviceClass the device class name 19 * @param deviceClass the device class name
20 * @return the pixmap 20 * @return the pixmap
21 */ 21 */
22 QPixmap deviceIcon( const QString & ); 22 QPixmap deviceIcon( const QString & );
23 23
24 /** 24 /**
25 * Returns an icon depending on service id 25 * Returns an icon depending on service id
26 * @param serviceClass the service id 26 * @param serviceClass the service id
27 * @return the pixmap 27 * @return the pixmap
28 * @return true if found 28 * @return true if found
29 */ 29 */
30 QPixmap serviceIcon( int, bool & ); 30 QPixmap serviceIcon( int, bool & );
31 31
32 // returns all UUID that represent channels with modem function 32 // returns all UUID that represent channels with modem function
33 const UUIDVector & modems() 33 const UUIDVector & modems()
34 { return Modems; } 34 { return Modems; }
35 35
36 // returns all UUID that represent channels with network 36 // returns all UUID that represent channels with network
37 const UUIDVector & network() 37 const UUIDVector & network()
38 { return Networks; } 38 { return Networks; }
39 39
40 // set Sub to find icons in .../Icons dir 40 // set Sub to find icons in .../Icons dir
41 QPixmap loadPixmap( const QString &, bool Sub = 0 ); 41 QPixmap loadPixmap( const QString &, bool Sub = 0 );
42 42
43private: 43private:
44 44
45 // first ist id, second is icon name 45 // first ist id, second is icon name
46 QMap<QString,QString> deviceIcons; 46 QMap<QString,QString> deviceIcons;
47 QMap<int,QString> serviceIcons; 47 QMap<int,QString> serviceIcons;
48 UUIDVector Modems; 48 UUIDVector Modems;
49 UUIDVector Networks; 49 UUIDVector Networks;
50 50
51}; 51};
52}; 52}
53 53
54#endif 54#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTInquiry.h b/noncore/settings/networksettings2/opietooth2/OTInquiry.h
index 2682499..f7bdeec 100644
--- a/noncore/settings/networksettings2/opietooth2/OTInquiry.h
+++ b/noncore/settings/networksettings2/opietooth2/OTInquiry.h
@@ -1,178 +1,178 @@
1//-*-c++-*- 1//-*-c++-*-
2/*************************************************************************** 2/***************************************************************************
3 * Copyright (C) 2003 by Fred Schaettgen * 3 * Copyright (C) 2003 by Fred Schaettgen *
4 * kdebluetooth@schaettgen.de * 4 * kdebluetooth@schaettgen.de *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by * 7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or * 8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. * 9 * (at your option) any later version. *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12#ifndef OTINQUIRY_H 12#ifndef OTINQUIRY_H
13#define OTINQUIRY_H 13#define OTINQUIRY_H
14 14
15#include <qstring.h> 15#include <qstring.h>
16#include <qobject.h> 16#include <qobject.h>
17 17
18#include <qguardedptr.h> 18#include <qguardedptr.h>
19#include <qtimer.h> 19#include <qtimer.h>
20 20
21#include <OTPeer.h> 21#include <OTPeer.h>
22 22
23// #include <set> 23// #include <set>
24// #include <deque> 24// #include <deque>
25 25
26namespace Opietooth2 { 26namespace Opietooth2 {
27 27
28class QSocket; 28class QSocket;
29class QDateTime; 29class QDateTime;
30 30
31class OTDriver; 31class OTDriver;
32class OTHCISocket; 32class OTHCISocket;
33 33
34/** Scans for nearby bluetooth devices. 34/** Scans for nearby bluetooth devices.
35 * This class provides an asynchronous interface to the 35 * This class provides an asynchronous interface to the
36 * inquriy HCI command. To scan for other devices, connect 36 * inquriy HCI command. To scan for other devices, connect
37 * to the signals neighbourFound() and finished() and call 37 * to the signals neighbourFound() and finished() and call
38 * inquiry(). Inquiry results are signalled as soon as they arrive, 38 * inquiry(). Inquiry results are signalled as soon as they arrive,
39 * so the information can be displayed before the whole inquiry 39 * so the information can be displayed before the whole inquiry
40 * process is finished. 40 * process is finished.
41 * Still no connections should be set up before 41 * Still no connections should be set up before
42 * the finished() signal was sent (hmm, is this always true..?) 42 * the finished() signal was sent (hmm, is this always true..?)
43 */ 43 */
44 44
45class OTInquiry : public QObject { 45class OTInquiry : public QObject {
46 46
47 Q_OBJECT 47 Q_OBJECT
48 48
49public: 49public:
50 50
51 /** Constructor. 51 /** Constructor.
52 @param owner The owning parent object 52 @param owner The owning parent object
53 */ 53 */
54 OTInquiry( OTDriver* Drv ); 54 OTInquiry( OTDriver* Drv );
55 55
56 /** Destructor. */ 56 /** Destructor. */
57 virtual ~OTInquiry(); 57 virtual ~OTInquiry();
58 58
59 // General/Unlimited Inquiry Access Code 59 // General/Unlimited Inquiry Access Code
60 static const int GIAC = 0x9E8B33; 60 static const int GIAC = 0x9E8B33;
61 61
62 // Limited Dedicated Inquiry Access Code 62 // Limited Dedicated Inquiry Access Code
63 static const int LIAC = 0x9E8B00; 63 static const int LIAC = 0x9E8B00;
64 64
65 /** Starts the inquiry. 65 /** Starts the inquiry.
66 if you start inquiry several times without calling clear(), 66 if you start inquiry several times without calling clear(),
67 you will receive each result only once. 67 you will receive each result only once.
68 @param timeout duration of the inquiry in seconds. 68 @param timeout duration of the inquiry in seconds.
69 It will be rounded to the next multiple of 1.28 sec, 69 It will be rounded to the next multiple of 1.28 sec,
70 with a maximum of 61.44 sec. 70 with a maximum of 61.44 sec.
71 @param lap 71 @param lap
72 */ 72 */
73 bool inquire( double timeout = 8.0, 73 bool inquire( double timeout = 8.0,
74 int numResponses = 0, 74 int numResponses = 0,
75 int lap = GIAC); 75 int lap = GIAC);
76 76
77 void stopInquiring( ); 77 void stopInquiring( );
78 78
79 /** Enters periodic inquiry mode. 79 /** Enters periodic inquiry mode.
80 An inquiry will be started at a random time in the intervall 80 An inquiry will be started at a random time in the intervall
81 between minduration and maxduration. 81 between minduration and maxduration.
82 @param minduration minimum time between two inquiries. Rounded to 82 @param minduration minimum time between two inquiries. Rounded to
83 a multiple of 1.28, (3.84 <= d <= 83884.8) 83 a multiple of 1.28, (3.84 <= d <= 83884.8)
84 @param maxduration maximum time between two inquiries. Rounded to 84 @param maxduration maximum time between two inquiries. Rounded to
85 a multiple of 1.28, (3.84 <= d <= 83884.8) 85 a multiple of 1.28, (3.84 <= d <= 83884.8)
86 @param timeout duration of the inquiry in seconds. 86 @param timeout duration of the inquiry in seconds.
87 It will be rounded to the next multiple of 1.28 sec, 87 It will be rounded to the next multiple of 1.28 sec,
88 with a maximum of 61.44 sec. 88 with a maximum of 61.44 sec.
89 @param numResponses Number of responses after which the inquiry 89 @param numResponses Number of responses after which the inquiry
90 will be stopped. 0 means no limit. 90 will be stopped. 0 means no limit.
91 @param lap 91 @param lap
92 */ 92 */
93 /* 93 /*
94 void inquirePeriodically( double minduration, 94 void inquirePeriodically( double minduration,
95 double maxduration, 95 double maxduration,
96 double timeout = 8.0, 96 double timeout = 8.0,
97 int numResponses = 0, 97 int numResponses = 0,
98 int lap = LIAC 98 int lap = LIAC
99 ); 99 );
100*/ 100*/
101 /** checks if there the inquiry is running currently 101 /** checks if there the inquiry is running currently
102 @return true if there is an inquiry running 102 @return true if there is an inquiry running
103 which was started by this object. 103 which was started by this object.
104 @todo possibility to check for "foreign" inquiries. Deal with 104 @todo possibility to check for "foreign" inquiries. Deal with
105 the fact that we can receive foreign inquiry results. 105 the fact that we can receive foreign inquiry results.
106 */ 106 */
107 bool isInquiring(); 107 bool isInquiring();
108 108
109 /** This function returns true after after an inquiry was 109 /** This function returns true after after an inquiry was
110 started, results were received and the inquiry ended successfully. 110 started, results were received and the inquiry ended successfully.
111 This can be the case without calling inquiry() at all, because 111 This can be the case without calling inquiry() at all, because
112 results of inquiries started by other programs are also processed. 112 results of inquiries started by other programs are also processed.
113 */ 113 */
114 bool isFinished(); 114 bool isFinished();
115 115
116 /** Resets the list of received results and sets 116 /** Resets the list of received results and sets
117 isInquiryComplete() to false. 117 isInquiryComplete() to false.
118 */ 118 */
119 void reset(); 119 void reset();
120 120
121 inline OTDriver * driver() const 121 inline OTDriver * driver() const
122 { return Driver; } 122 { return Driver; }
123 123
124protected: 124protected:
125 125
126 /** Called when a new neighbour was found. The default 126 /** Called when a new neighbour was found. The default
127 implementation emits the neighbourFound signal. 127 implementation emits the neighbourFound signal.
128 @param bdaddr the address found. 128 @param bdaddr the address found.
129 */ 129 */
130 virtual void onPeerFound( OTPeer * Peer, bool ); 130 virtual void onPeerFound( OTPeer * Peer, bool );
131 131
132 enum ErrorCode { 132 enum ErrorCode {
133 InquiryFinishedTimeout = 0x0100 133 InquiryFinishedTimeout = 0x0100
134 }; 134 };
135 135
136signals : 136signals :
137 137
138 void peerFound( OTPeer *, bool ); 138 void peerFound( OTPeer *, bool );
139 139
140 /** Emitted after an inquiry has finished successfully. 140 /** Emitted after an inquiry has finished successfully.
141 If the inquiry was canceled, no finished signals is emitted. 141 If the inquiry was canceled, no finished signals is emitted.
142 This signal can be emitted without having called inquiry, since 142 This signal can be emitted without having called inquiry, since
143 other processes may have started an inquiry. 143 other processes may have started an inquiry.
144 */ 144 */
145 void finished(); 145 void finished();
146 146
147 /** Emitted instead of finished if an error occured after 147 /** Emitted instead of finished if an error occured after
148 calling inquiry() or periodicInquiryMode() 148 calling inquiry() or periodicInquiryMode()
149 @param code error code. 149 @param code error code.
150 @param message Error message 150 @param message Error message
151 */ 151 */
152 void error( QString message ); 152 void error( QString message );
153 153
154private: 154private:
155 155
156 // std::set<DeviceAddress> addrCache; 156 // std::set<DeviceAddress> addrCache;
157 // double currentTimeout; 157 // double currentTimeout;
158 // QByteArray* buf; 158 // QByteArray* buf;
159 // QSocket* hciSocket; 159 // QSocket* hciSocket;
160 QGuardedPtr<OTHCISocket> Socket; 160 QGuardedPtr<OTHCISocket> Socket;
161 OTDriver * Driver; 161 OTDriver * Driver;
162 162
163 //QDateTime *startTime; 163 //QDateTime *startTime;
164 QTimer *InquiryTimeoutTimer; 164 QTimer *InquiryTimeoutTimer;
165 165
166 // std::deque<InquiryInfo> infoQueue; 166 // std::deque<InquiryInfo> infoQueue;
167 bool SuccessfullyStarted; 167 bool SuccessfullyStarted;
168 bool SuccessfullyEnded; 168 bool SuccessfullyEnded;
169 169
170private slots: 170private slots:
171 171
172 void slotInquiryTimeout(); 172 void slotInquiryTimeout();
173 void slotHCIEvent(unsigned char eventCode, QByteArray buf); 173 void slotHCIEvent(unsigned char eventCode, QByteArray buf);
174 174
175}; 175};
176 176
177}; 177}
178#endif 178#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTPeer.h b/noncore/settings/networksettings2/opietooth2/OTPeer.h
index 9cd0dc7..c09af15 100644
--- a/noncore/settings/networksettings2/opietooth2/OTPeer.h
+++ b/noncore/settings/networksettings2/opietooth2/OTPeer.h
@@ -1,135 +1,135 @@
1//-*-c++-*- 1//-*-c++-*-
2/*************************************************************************** 2/***************************************************************************
3 * Copyright (C) 2003 by Fred Schaettgen * 3 * Copyright (C) 2003 by Fred Schaettgen *
4 * kdebluetooth@0xF.de * 4 * kdebluetooth@0xF.de *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by * 7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or * 8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. * 9 * (at your option) any later version. *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12#ifndef OTPEER_H 12#ifndef OTPEER_H
13#define OTPEER_H 13#define OTPEER_H
14 14
15#include <qstring.h> 15#include <qstring.h>
16#include <qobject.h> 16#include <qobject.h>
17#include <qvector.h> 17#include <qvector.h>
18#include <bluezlib.h> 18#include <bluezlib.h>
19#include <OTDeviceAddress.h> 19#include <OTDeviceAddress.h>
20 20
21class QTextStream; 21class QTextStream;
22class QTimerEvent; 22class QTimerEvent;
23 23
24namespace Opietooth2 { 24namespace Opietooth2 {
25 25
26class OTGateway; 26class OTGateway;
27 27
28class OTDriver; 28class OTDriver;
29class OTSDPService; 29class OTSDPService;
30class OTSDPAttribute; 30class OTSDPAttribute;
31class OTUUID; 31class OTUUID;
32typedef QVector<OTSDPService> ServiceVector; 32typedef QVector<OTSDPService> ServiceVector;
33 33
34class OTPeer : public QObject { 34class OTPeer : public QObject {
35 35
36 Q_OBJECT; 36 Q_OBJECT;
37 37
38public : 38public :
39 39
40 typedef enum PeerState_E { 40 typedef enum PeerState_E {
41 Peer_Unknown = -1, 41 Peer_Unknown = -1,
42 Peer_Down = 0, 42 Peer_Down = 0,
43 Peer_Up = 1 43 Peer_Up = 1
44 } PeerState_t; 44 } PeerState_t;
45 45
46 OTPeer( OTGateway * _OT ); 46 OTPeer( OTGateway * _OT );
47 OTPeer( QTextStream & TS, OTGateway * _TS ); 47 OTPeer( QTextStream & TS, OTGateway * _TS );
48 ~OTPeer(); 48 ~OTPeer();
49 49
50 inline OTGateway * gateway() const 50 inline OTGateway * gateway() const
51 { return OT; } 51 { return OT; }
52 52
53 inline int deviceClass( void ) const 53 inline int deviceClass( void ) const
54 { return Class; } 54 { return Class; }
55 inline void setDeviceClass( int cls ) 55 inline void setDeviceClass( int cls )
56 { Class = cls; } 56 { Class = cls; }
57 57
58 void setAddress( const OTDeviceAddress & A ) 58 void setAddress( const OTDeviceAddress & A )
59 { Addr = A; } 59 { Addr = A; }
60 60
61 const OTDeviceAddress & address( void ) 61 const OTDeviceAddress & address( void )
62 { return Addr; } 62 { return Addr; }
63 63
64 inline QString name( void ) const 64 inline QString name( void ) const
65 { return Name; } 65 { return Name; }
66 inline void setName( const QString & n ) 66 inline void setName( const QString & n )
67 { Name = n; } 67 { Name = n; }
68 68
69 ServiceVector & services( bool Force = 0 ) 69 ServiceVector & services( bool Force = 0 )
70 { if( Force || serviceList.count() == 0 ) { 70 { if( Force || serviceList.count() == 0 ) {
71 updateServices(); 71 updateServices();
72 } 72 }
73 return serviceList; 73 return serviceList;
74 } 74 }
75 75
76 /* Returns TRUE if the device has at least a service 76 /* Returns TRUE if the device has at least a service
77 with inside the required class Id.*/ 77 with inside the required class Id.*/
78 bool hasServiceClassID( const OTUUID & uuid); 78 bool hasServiceClassID( const OTUUID & uuid);
79 79
80 /* Get a vector of Rfcomm channels of the services 80 /* Get a vector of Rfcomm channels of the services
81 having "uuid" in the class ID List */ 81 having "uuid" in the class ID List */
82 QArray<int> rfcommList( const OTUUID & uuid ); 82 QArray<int> rfcommList( const OTUUID & uuid );
83 83
84 inline void setState( PeerState_t S) 84 inline void setState( PeerState_t S)
85 { State = S; } 85 { State = S; }
86 inline PeerState_t state( void ) 86 inline PeerState_t state( void )
87 { return State; } 87 { return State; }
88 88
89 // go and find out state 89 // go and find out state
90 // will report back with signal 90 // will report back with signal
91 void findOutState( int timeoutInSec = 1, bool Force = 0 ); 91 void findOutState( int timeoutInSec = 1, bool Force = 0 );
92 void stopFindingOutState( void ); 92 void stopFindingOutState( void );
93 93
94 // return driver to which this peer is connected to 94 // return driver to which this peer is connected to
95 // if it is connected 95 // if it is connected
96 inline OTDriver * connectedTo( void ) const 96 inline OTDriver * connectedTo( void ) const
97 { return ConnectedTo; } 97 { return ConnectedTo; }
98 inline void setConnectedTo( OTDriver * D ) 98 inline void setConnectedTo( OTDriver * D )
99 { ConnectedTo = D; } 99 { ConnectedTo = D; }
100 100
101 void save( QTextStream& TS ); 101 void save( QTextStream& TS );
102 void load( QTextStream& TS ); 102 void load( QTextStream& TS );
103 103
104signals : 104signals :
105 105
106 // report back state 106 // report back state
107 void peerStateReport( OTPeer *); 107 void peerStateReport( OTPeer *);
108 void error( const QString & ); 108 void error( const QString & );
109 109
110protected : 110protected :
111 111
112 // while polling for result of ping 112 // while polling for result of ping
113 void timerEvent( QTimerEvent * ev ); 113 void timerEvent( QTimerEvent * ev );
114 114
115private: 115private:
116 116
117 void updateServices(); 117 void updateServices();
118 118
119 OTGateway * OT; 119 OTGateway * OT;
120 OTDeviceAddress Addr; 120 OTDeviceAddress Addr;
121 QString Name; 121 QString Name;
122 int Class; 122 int Class;
123 ServiceVector serviceList; 123 ServiceVector serviceList;
124 // -1 : don't know, 0 no, 1 yes 124 // -1 : don't know, 0 no, 1 yes
125 PeerState_t State; 125 PeerState_t State;
126 OTDriver * ConnectedTo; 126 OTDriver * ConnectedTo;
127 127
128 int ProbeFD; 128 int ProbeFD;
129 int ProbePhase; // see OTDriver 129 int ProbePhase; // see OTDriver
130 long ProbeTimeout; 130 long ProbeTimeout;
131}; 131};
132 132
133}; 133}
134 134
135#endif 135#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.h b/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.h
index 86b5623..e79e33d 100644
--- a/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.h
+++ b/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.h
@@ -1,140 +1,140 @@
1//-*-c++-*- 1//-*-c++-*-
2/*************************************************************************** 2/***************************************************************************
3 * Copyright (C) 2003 by Fred Schaettgen * 3 * Copyright (C) 2003 by Fred Schaettgen *
4 * kdebluetooth@schaettgen.de * 4 * kdebluetooth@schaettgen.de *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by * 7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or * 8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. * 9 * (at your option) any later version. *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12#ifndef OTATTRIBUTE_H 12#ifndef OTATTRIBUTE_H
13#define OTATTRIBUTE_H 13#define OTATTRIBUTE_H
14 14
15#include <stdio.h> 15#include <stdio.h>
16#include <qstring.h> 16#include <qstring.h>
17#include <qarray.h> 17#include <qarray.h>
18#include <qvector.h> 18#include <qvector.h>
19#include <bluezlib.h> 19#include <bluezlib.h>
20#include <OTUUID.h> 20#include <OTUUID.h>
21 21
22namespace Opietooth2 { 22namespace Opietooth2 {
23 23
24class OTSDPAttribute; 24class OTSDPAttribute;
25class OTUUID; 25class OTUUID;
26 26
27typedef QVector<OTSDPAttribute> AttributeVector; 27typedef QVector<OTSDPAttribute> AttributeVector;
28 28
29/** 29/**
30@author Fred Schaettgen 30@author Fred Schaettgen
31*/ 31*/
32class OTSDPAttribute { 32class OTSDPAttribute {
33 33
34public: 34public:
35 35
36 enum AttrType { 36 enum AttrType {
37 INVALID = 0, 37 INVALID = 0,
38 NIL = 1, 38 NIL = 1,
39 UINT = 2, 39 UINT = 2,
40 INT = 3, 40 INT = 3,
41 UUID = 4, 41 UUID = 4,
42 BOOLEAN = 5, 42 BOOLEAN = 5,
43 STRING = 6, 43 STRING = 6,
44 SEQUENCE = 7, 44 SEQUENCE = 7,
45 ALTERNATIVE = 8, 45 ALTERNATIVE = 8,
46 URL = 9, 46 URL = 9,
47 UNKNOWN = 10 47 UNKNOWN = 10
48 }; 48 };
49 49
50 class int128_t { 50 class int128_t {
51 public : 51 public :
52 int128_t(int64_t l=0, int64_t h=0) { 52 int128_t(int64_t l=0, int64_t h=0) {
53 hi = h; 53 hi = h;
54 lo = l; 54 lo = l;
55 } 55 }
56 int128_t(const OTSDPAttribute::int128_t & l) { 56 int128_t(const OTSDPAttribute::int128_t & l) {
57 hi = l.hi; 57 hi = l.hi;
58 lo = l.lo; 58 lo = l.lo;
59 } 59 }
60 QString toString() const { 60 QString toString() const {
61 char Buf[50]; 61 char Buf[50];
62 sprintf( Buf, "%lld%lld", hi, lo ); 62 sprintf( Buf, "%lld%lld", hi, lo );
63 return QString( Buf ); 63 return QString( Buf );
64 } 64 }
65 int64_t hi; 65 int64_t hi;
66 int64_t lo; 66 int64_t lo;
67 }; 67 };
68 68
69 class uint128_t { 69 class uint128_t {
70 public : 70 public :
71 uint128_t( uint64_t l=0, uint64_t h=0) { 71 uint128_t( uint64_t l=0, uint64_t h=0) {
72 hi = h; 72 hi = h;
73 lo = l; 73 lo = l;
74 } 74 }
75 uint128_t( const OTSDPAttribute::uint128_t & l) { 75 uint128_t( const OTSDPAttribute::uint128_t & l) {
76 hi = l.hi; 76 hi = l.hi;
77 lo = l.lo; 77 lo = l.lo;
78 } 78 }
79 QString toString() const { 79 QString toString() const {
80 char Buf[50]; 80 char Buf[50];
81 sprintf( Buf, "%llu%llu", hi, lo ); 81 sprintf( Buf, "%llu%llu", hi, lo );
82 return QString( Buf ); 82 return QString( Buf );
83 } 83 }
84 uint64_t hi; 84 uint64_t hi;
85 uint64_t lo; 85 uint64_t lo;
86 }; 86 };
87 87
88public: 88public:
89 89
90 OTSDPAttribute(); 90 OTSDPAttribute();
91 OTSDPAttribute( sdp_data_t * D ); 91 OTSDPAttribute( sdp_data_t * D );
92 ~OTSDPAttribute(); 92 ~OTSDPAttribute();
93 93
94 QString toString( void ); 94 QString toString( void );
95 95
96 void setNil(); 96 void setNil();
97 void setInt(const OTSDPAttribute::int128_t & val); 97 void setInt(const OTSDPAttribute::int128_t & val);
98 void setUInt(const OTSDPAttribute::uint128_t & val); 98 void setUInt(const OTSDPAttribute::uint128_t & val);
99 void setUUID( const OTUUID & val); 99 void setUUID( const OTUUID & val);
100 void setBool(bool val); 100 void setBool(bool val);
101 void setString(const QString & val); 101 void setString(const QString & val);
102 void setURL(const QString & val); 102 void setURL(const QString & val);
103 void setSequence(const AttributeVector& val); 103 void setSequence(const AttributeVector& val);
104 void setAlternative(const AttributeVector& val); 104 void setAlternative(const AttributeVector& val);
105 105
106 QString getString(); 106 QString getString();
107 QString getURL(); 107 QString getURL();
108 const OTSDPAttribute::int128_t & getInt(); 108 const OTSDPAttribute::int128_t & getInt();
109 const OTSDPAttribute::uint128_t & getUInt(); 109 const OTSDPAttribute::uint128_t & getUInt();
110 const OTUUID & getUUID(); 110 const OTUUID & getUUID();
111 bool getBool(); 111 bool getBool();
112 AttributeVector * getSequence(); 112 AttributeVector * getSequence();
113 AttributeVector * getAlternative(); 113 AttributeVector * getAlternative();
114 114
115 UUIDVector getAllUUIDs(); 115 UUIDVector getAllUUIDs();
116 116
117 inline AttrType getType() 117 inline AttrType getType()
118 { return type; } 118 { return type; }
119 119
120 //QString getValString(); 120 //QString getValString();
121 const char * getTypeString(); 121 const char * getTypeString();
122 122
123private: 123private:
124 124
125 AttrType type; 125 AttrType type;
126 126
127 union { 127 union {
128 OTSDPAttribute::int128_t * intVal; 128 OTSDPAttribute::int128_t * intVal;
129 OTSDPAttribute::uint128_t * uintVal; 129 OTSDPAttribute::uint128_t * uintVal;
130 OTUUID * uuidVal; 130 OTUUID * uuidVal;
131 bool boolVal; 131 bool boolVal;
132 QString * stringVal; // strings and urls 132 QString * stringVal; // strings and urls
133 AttributeVector * sequenceVal; // sequences and alternatives 133 AttributeVector * sequenceVal; // sequences and alternatives
134 } Value; 134 } Value;
135 135
136}; 136};
137 137
138}; 138}
139 139
140#endif 140#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTSDPService.h b/noncore/settings/networksettings2/opietooth2/OTSDPService.h
index 21d7344..4831df0 100644
--- a/noncore/settings/networksettings2/opietooth2/OTSDPService.h
+++ b/noncore/settings/networksettings2/opietooth2/OTSDPService.h
@@ -1,75 +1,75 @@
1//-*-c++-*- 1//-*-c++-*-
2/*************************************************************************** 2/***************************************************************************
3 * Copyright (C) 2003 by Fred Schaettgen * 3 * Copyright (C) 2003 by Fred Schaettgen *
4 * kdebluetooth@schaettgen.de * 4 * kdebluetooth@schaettgen.de *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by * 7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or * 8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. * 9 * (at your option) any later version. *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12#ifndef SDPSERVICE_H 12#ifndef SDPSERVICE_H
13#define SDPSERVICE_H 13#define SDPSERVICE_H
14 14
15#include <qvector.h> 15#include <qvector.h>
16#include <qarray.h> 16#include <qarray.h>
17#include <OTSDPAttribute.h> 17#include <OTSDPAttribute.h>
18 18
19namespace Opietooth2 { 19namespace Opietooth2 {
20 20
21/** 21/**
22@author Fred Schaettgen 22@author Fred Schaettgen
23*/ 23*/
24class OTSDPService { 24class OTSDPService {
25 25
26public: 26public:
27 27
28 OTSDPService(); 28 OTSDPService();
29 virtual ~OTSDPService(); 29 virtual ~OTSDPService();
30 30
31 void addAttribute(int id, OTSDPAttribute * attr); 31 void addAttribute(int id, OTSDPAttribute * attr);
32 32
33 const OTSDPAttribute & attribute( int index ); 33 const OTSDPAttribute & attribute( int index );
34 int attributeID( int index ); 34 int attributeID( int index );
35 35
36 AttributeVector subAttributes( OTSDPAttribute * attr); 36 AttributeVector subAttributes( OTSDPAttribute * attr);
37 OTSDPAttribute * attributeByID( int id ); 37 OTSDPAttribute * attributeByID( int id );
38 38
39 // See Bluetooth Core Spec Sec. 5.1 39 // See Bluetooth Core Spec Sec. 5.1
40 bool recordHandle(uint32_t *handle); // 0x00 40 bool recordHandle(uint32_t *handle); // 0x00
41 41
42 //bool getServiceClassIDList(vector<uuid_t> *classIDList); // 0x01 42 //bool getServiceClassIDList(vector<uuid_t> *classIDList); // 0x01
43 //bool getServiceRecordState(uint32_t *state); // 0x02 43 //bool getServiceRecordState(uint32_t *state); // 0x02
44 //bool getServiceID(uuid_t *id); // 0x03; 44 //bool getServiceID(uuid_t *id); // 0x03;
45 //bool getProtocolDescriptorList(SDP::Attribute *attribute); // 0x04 45 //bool getProtocolDescriptorList(SDP::Attribute *attribute); // 0x04
46 //bool getBrowseGroupList(vector<uuid_t> *browseGroupList); // 0x05 46 //bool getBrowseGroupList(vector<uuid_t> *browseGroupList); // 0x05
47 QString name(void); // langBase + 0x00 47 QString name(void); // langBase + 0x00
48 QString description(void); // langBase + 0x01 48 QString description(void); // langBase + 0x01
49 49
50 UUIDVector allUUIDs(); 50 UUIDVector allUUIDs();
51 51
52 // return list of classes this service belongs to 52 // return list of classes this service belongs to
53 UUIDVector classIDList(); 53 UUIDVector classIDList();
54 54
55 /** Retrieves the Rfcomm channel. 55 /** Retrieves the Rfcomm channel.
56 This function is provided just for conveniance. 56 This function is provided just for conveniance.
57 @param n The Rfcomm channel. 57 @param n The Rfcomm channel.
58 @ret true if an rfcomm channel was found, false otherwise. */ 58 @ret true if an rfcomm channel was found, false otherwise. */
59 bool rfcommChannel(unsigned int &n); 59 bool rfcommChannel(unsigned int &n);
60 60
61 bool hasClassID(const OTUUID & uuid); 61 bool hasClassID(const OTUUID & uuid);
62 62
63private: 63private:
64 64
65 struct AttributeEntry { 65 struct AttributeEntry {
66 int id; 66 int id;
67 OTSDPAttribute * attr; 67 OTSDPAttribute * attr;
68 }; 68 };
69 69
70 QArray<AttributeEntry> attributeList; 70 QArray<AttributeEntry> attributeList;
71}; 71};
72 72
73}; 73}
74 74
75#endif 75#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTUUID.h b/noncore/settings/networksettings2/opietooth2/OTUUID.h
index 97df114..aebd9b9 100644
--- a/noncore/settings/networksettings2/opietooth2/OTUUID.h
+++ b/noncore/settings/networksettings2/opietooth2/OTUUID.h
@@ -1,58 +1,58 @@
1//-*-c++-*- 1//-*-c++-*-
2/*************************************************************************** 2/***************************************************************************
3 * Copyright (C) 2003 by Fred Schaettgen * 3 * Copyright (C) 2003 by Fred Schaettgen *
4 * kdebluetooth@schaettgen.de * 4 * kdebluetooth@schaettgen.de *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by * 7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or * 8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. * 9 * (at your option) any later version. *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12#ifndef OTUUID_H 12#ifndef OTUUID_H
13#define OTUUID_H 13#define OTUUID_H
14 14
15#include <qstring.h> 15#include <qstring.h>
16#include <qarray.h> 16#include <qarray.h>
17#include <bluezlib.h> 17#include <bluezlib.h>
18 18
19namespace Opietooth2 { 19namespace Opietooth2 {
20 20
21class OTUUID; 21class OTUUID;
22 22
23typedef QArray<OTUUID> UUIDVector; 23typedef QArray<OTUUID> UUIDVector;
24 24
25class OTUUID { 25class OTUUID {
26 26
27public : 27public :
28 28
29 OTUUID( QString s ); 29 OTUUID( QString s );
30 OTUUID( uint64_t l=0, uint64_t h=0); 30 OTUUID( uint64_t l=0, uint64_t h=0);
31 OTUUID( const OTUUID & O ); 31 OTUUID( const OTUUID & O );
32 32
33 bool fromString(QString s); 33 bool fromString(QString s);
34 34
35 void setUUID128(uint64_t hi, uint64_t lo); 35 void setUUID128(uint64_t hi, uint64_t lo);
36 36
37 void setUUID32(uint32_t v); 37 void setUUID32(uint32_t v);
38 38
39 uint16_t toShort() 39 uint16_t toShort()
40 { return ((hi>>32) & 0xffff); } 40 { return ((hi>>32) & 0xffff); }
41 uint32_t toLong() 41 uint32_t toLong()
42 { return ((hi>>32) & 0xffffffff); } 42 { return ((hi>>32) & 0xffffffff); }
43 uint64_t toLongLong() 43 uint64_t toLongLong()
44 { return hi; } 44 { return hi; }
45 45
46 QString toString() const ; 46 QString toString() const ;
47 operator QString() const; 47 operator QString() const;
48 operator ::uuid_t() const; 48 operator ::uuid_t() const;
49 49
50 OTUUID & operator=( const OTUUID & other ) ; 50 OTUUID & operator=( const OTUUID & other ) ;
51 bool operator<( const OTUUID & other ) const; 51 bool operator<( const OTUUID & other ) const;
52 bool operator==(const OTUUID & uuid) const; 52 bool operator==(const OTUUID & uuid) const;
53 53
54 uint64_t hi; 54 uint64_t hi;
55 uint64_t lo; 55 uint64_t lo;
56}; 56};
57}; 57}
58#endif 58#endif
diff --git a/noncore/settings/networksettings2/opietooth2/Opietooth.h b/noncore/settings/networksettings2/opietooth2/Opietooth.h
index e66787f..f077dd7 100644
--- a/noncore/settings/networksettings2/opietooth2/Opietooth.h
+++ b/noncore/settings/networksettings2/opietooth2/Opietooth.h
@@ -1,238 +1,238 @@
1#ifndef OPIETOOTH_H 1#ifndef OPIETOOTH_H
2#define OPIETOOTH_H 2#define OPIETOOTH_H
3 3
4#include <OTIcons.h> 4#include <OTIcons.h>
5 5
6class MyProcess; 6class MyProcess;
7 7
8namespace Opie { 8namespace Opie {
9 9
10 namespace Ui { 10 namespace Ui {
11 11
12 class OLedBox; 12 class OLedBox;
13 13
14 }; 14 }
15 15
16}; 16}
17 17
18#include <OTSniffGUI.h> 18#include <OTSniffGUI.h>
19namespace Opietooth2 { 19namespace Opietooth2 {
20 20
21class OTGateway; 21class OTGateway;
22class OTDriver; 22class OTDriver;
23class OTInquiry; 23class OTInquiry;
24class OTPeer; 24class OTPeer;
25class PeerLVI; 25class PeerLVI;
26 26
27class OTSniffing : public OTSniffGUI { 27class OTSniffing : public OTSniffGUI {
28 28
29 Q_OBJECT 29 Q_OBJECT
30 30
31public : 31public :
32 32
33 OTSniffing( QWidget * parent ); 33 OTSniffing( QWidget * parent );
34 ~OTSniffing(); 34 ~OTSniffing();
35 35
36private slots : 36private slots :
37 37
38 void SLOT_Trace( bool ); 38 void SLOT_Trace( bool );
39 void SLOT_ClearLog( void ); 39 void SLOT_ClearLog( void );
40 void SLOT_Load( void ); 40 void SLOT_Load( void );
41 void SLOT_Save( void ); 41 void SLOT_Save( void );
42 void SLOT_ProcessExited( MyProcess * ); 42 void SLOT_ProcessExited( MyProcess * );
43 void SLOT_Show( const QString & ); 43 void SLOT_Show( const QString & );
44 44
45signals : 45signals :
46 46
47protected : 47protected :
48 48
49private : 49private :
50 50
51 OTGateway * OT; 51 OTGateway * OT;
52 MyProcess * HciDump; 52 MyProcess * HciDump;
53}; 53};
54}; 54}
55 55
56#include <OTPairingGUI.h> 56#include <OTPairingGUI.h>
57 57
58namespace Opietooth2 { 58namespace Opietooth2 {
59class OTPairing : public OTPairingGUI { 59class OTPairing : public OTPairingGUI {
60 60
61 Q_OBJECT 61 Q_OBJECT
62 62
63public : 63public :
64 64
65 OTPairing( QWidget * parent, 65 OTPairing( QWidget * parent,
66 OTIcons * _Ic = 0 ); 66 OTIcons * _Ic = 0 );
67 ~OTPairing(); 67 ~OTPairing();
68 68
69private slots : 69private slots :
70 70
71 void SLOT_Unpair( void ); 71 void SLOT_Unpair( void );
72 72
73signals : 73signals :
74 74
75protected : 75protected :
76 76
77private : 77private :
78 78
79 bool MyIcons; 79 bool MyIcons;
80 OTIcons * Icons; 80 OTIcons * Icons;
81 OTGateway * OT; 81 OTGateway * OT;
82}; 82};
83}; 83}
84 84
85#include <OTScanGUI.h> 85#include <OTScanGUI.h>
86 86
87namespace Opietooth2 { 87namespace Opietooth2 {
88 88
89class OTGateway; 89class OTGateway;
90class OTDriver; 90class OTDriver;
91class OTInquiry; 91class OTInquiry;
92class OTPeer; 92class OTPeer;
93 93
94class OTScan : public OTScanGUI { 94class OTScan : public OTScanGUI {
95 95
96 Q_OBJECT 96 Q_OBJECT
97 97
98public : 98public :
99 99
100 OTScan( QWidget * parent, 100 OTScan( QWidget * parent,
101 OTIcons * _Ic = 0 ); 101 OTIcons * _Ic = 0 );
102 ~OTScan(); 102 ~OTScan();
103 103
104 // static function to return a device and a channel 104 // static function to return a device and a channel
105 static int getDevice( OTPeer *& Peer, 105 static int getDevice( OTPeer *& Peer,
106 int & Channel, 106 int & Channel,
107 OTGateway * OT, 107 OTGateway * OT,
108 const UUIDVector & Filter = 0, 108 const UUIDVector & Filter = 0,
109 QWidget* Parent = 0); 109 QWidget* Parent = 0);
110 110
111 // show only services that match any of the filter 111 // show only services that match any of the filter
112 void setScanFilter( const UUIDVector & Filter ); 112 void setScanFilter( const UUIDVector & Filter );
113 void resetScanFilter( void ); 113 void resetScanFilter( void );
114 114
115 inline OTPeer * selectedPeer( void ) 115 inline OTPeer * selectedPeer( void )
116 { return SelectedPeer; } 116 { return SelectedPeer; }
117 inline int selectedChannel( void ) 117 inline int selectedChannel( void )
118 { return SelectedChannel; } 118 { return SelectedChannel; }
119 119
120public slots : 120public slots :
121 121
122private slots : 122private slots :
123 123
124 void SLOT_DoScan( bool ); 124 void SLOT_DoScan( bool );
125 void SLOT_NewPeer( OTPeer *, bool ); 125 void SLOT_NewPeer( OTPeer *, bool );
126 void SLOT_FinishedDetecting(); 126 void SLOT_FinishedDetecting();
127 void SLOT_Show( QListViewItem *); 127 void SLOT_Show( QListViewItem *);
128 void SLOT_RefreshServices( void ); 128 void SLOT_RefreshServices( void );
129 void SLOT_RefreshState( void ); 129 void SLOT_RefreshState( void );
130 void SLOT_CleanupOld( void ); 130 void SLOT_CleanupOld( void );
131 void SLOT_UpdateStrength( void ); 131 void SLOT_UpdateStrength( void );
132 void SLOT_PeerState( OTPeer * ); 132 void SLOT_PeerState( OTPeer * );
133 void SLOT_Selected( QListViewItem * ); 133 void SLOT_Selected( QListViewItem * );
134 134
135signals : 135signals :
136 136
137 void selected( void ); 137 void selected( void );
138 138
139protected : 139protected :
140 140
141private : 141private :
142 142
143 void refreshState( PeerLVI *, bool ); 143 void refreshState( PeerLVI *, bool );
144 void scanMode( bool ); 144 void scanMode( bool );
145 145
146 // load scanned devices 146 // load scanned devices
147 147
148 bool MyIcons; 148 bool MyIcons;
149 OTIcons * Icons; 149 OTIcons * Icons;
150 OTGateway * OT; 150 OTGateway * OT;
151 OTInquiry * Scanning; 151 OTInquiry * Scanning;
152 UUIDVector Filter; 152 UUIDVector Filter;
153 153
154 Opie::Ui::OLedBox * Paired_Led; 154 Opie::Ui::OLedBox * Paired_Led;
155 QTimer * StrengthTimer; 155 QTimer * StrengthTimer;
156 PeerLVI * Current; 156 PeerLVI * Current;
157 157
158 OTPeer * SelectedPeer; 158 OTPeer * SelectedPeer;
159 int SelectedChannel; 159 int SelectedChannel;
160}; 160};
161}; 161}
162 162
163#include <OTManageGUI.h> 163#include <OTManageGUI.h>
164namespace Opietooth2 { 164namespace Opietooth2 {
165 165
166class OTManage : public OTManageGUI { 166class OTManage : public OTManageGUI {
167 167
168 Q_OBJECT 168 Q_OBJECT
169 169
170public : 170public :
171 171
172 OTManage( QWidget * parent, 172 OTManage( QWidget * parent,
173 OTIcons * _IC = 0 ); 173 OTIcons * _IC = 0 );
174 ~OTManage(); 174 ~OTManage();
175 175
176public slots : 176public slots :
177 177
178private slots : 178private slots :
179 179
180 void SLOT_ShowDriver( QListViewItem * ); 180 void SLOT_ShowDriver( QListViewItem * );
181 void SLOT_UpDriver( bool ); 181 void SLOT_UpDriver( bool );
182 void SLOT_StateChange( OTDriver * , bool ); 182 void SLOT_StateChange( OTDriver * , bool );
183 void SLOT_DriverListChanged(); 183 void SLOT_DriverListChanged();
184 void SLOT_SetRefreshTimer( int ); 184 void SLOT_SetRefreshTimer( int );
185 185
186signals : 186signals :
187 187
188protected : 188protected :
189 189
190private : 190private :
191 191
192 // load scanned devices 192 // load scanned devices
193 193
194 bool MyIcons; 194 bool MyIcons;
195 OTIcons * Icons; 195 OTIcons * Icons;
196 OTGateway * OT; 196 OTGateway * OT;
197 OTInquiry * Scanning; 197 OTInquiry * Scanning;
198}; 198};
199}; 199}
200 200
201#include <OTMainGUI.h> 201#include <OTMainGUI.h>
202 202
203namespace Opietooth2 { 203namespace Opietooth2 {
204class OTMain : public OTMainGUI { 204class OTMain : public OTMainGUI {
205 205
206 Q_OBJECT 206 Q_OBJECT
207 207
208public : 208public :
209 209
210 OTMain( QWidget * parent ); 210 OTMain( QWidget * parent );
211 ~OTMain(); 211 ~OTMain();
212 212
213public slots : 213public slots :
214 214
215private slots : 215private slots :
216 216
217 void SLOT_Pairing( void ); 217 void SLOT_Pairing( void );
218 void SLOT_Manage( void ); 218 void SLOT_Manage( void );
219 void SLOT_Sniffing( void ); 219 void SLOT_Sniffing( void );
220 void SLOT_Scan( void ); 220 void SLOT_Scan( void );
221 void SLOT_EnableBluetooth( bool ); 221 void SLOT_EnableBluetooth( bool );
222 void SLOT_DriverListChanged(); 222 void SLOT_DriverListChanged();
223 void SLOT_DeviceIsEnabled( bool ); 223 void SLOT_DeviceIsEnabled( bool );
224 void SLOT_StateChange( OTDriver * , bool ); 224 void SLOT_StateChange( OTDriver * , bool );
225 225
226signals : 226signals :
227 227
228protected : 228protected :
229 229
230private : 230private :
231 231
232 // load scanned devices 232 // load scanned devices
233 OTIcons * Icons; 233 OTIcons * Icons;
234 OTGateway * OT; 234 OTGateway * OT;
235 QDialog * SnifWindow; 235 QDialog * SnifWindow;
236}; 236};
237}; 237}
238#endif 238#endif
diff --git a/noncore/settings/networksettings2/ppp/ppp.pro b/noncore/settings/networksettings2/ppp/ppp.pro
index dd3408c..10d0f1b 100644
--- a/noncore/settings/networksettings2/ppp/ppp.pro
+++ b/noncore/settings/networksettings2/ppp/ppp.pro
@@ -1,33 +1,33 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release plugin
3DESTDIR = $(OPIEDIR)/plugins/networksettings2 3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = ppp_NN.h \ 4 HEADERS = ppp_NN.h \
5 ppp_NNI.h \ 5 ppp_NNI.h \
6 PPPedit.h \ 6 PPPedit.h \
7 PPPAuthedit.h \ 7 PPPAuthedit.h \
8 PPPDNSedit.h \ 8 PPPDNSedit.h \
9 PPPRunedit.h \ 9 PPPRunedit.h \
10 PPPDialingedit.h \ 10 PPPDialingedit.h \
11 PPPIPedit.h 11 PPPIPedit.h
12 SOURCES = ppp_NN.cpp \ 12 SOURCES = ppp_NN.cpp \
13 ppp_NNI.cpp \ 13 ppp_NNI.cpp \
14 PPPedit.cpp \ 14 PPPedit.cpp \
15 PPPDNSedit.cpp \ 15 PPPDNSedit.cpp \
16 PPPRunedit.cpp \ 16 PPPRunedit.cpp \
17 PPPDialingedit.cpp \ 17 PPPDialingedit.cpp \
18 PPPAuthedit.cpp \ 18 PPPAuthedit.cpp \
19 ppprun.cpp \ 19 ppprun.cpp \
20 PPPIPedit.cpp 20 PPPIPedit.cpp
21 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 21 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2
22 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 22 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2
23LIBS += -lqpe 23LIBS += -lqpe
24 INTERFACES= PPPGUI.ui \ 24 INTERFACES= PPPGUI.ui \
25 PPPAuthGUI.ui \ 25 PPPAuthGUI.ui \
26 PPPIPGUI.ui \ 26 PPPIPGUI.ui \
27 PPPDNSGUI.ui \ 27 PPPDNSGUI.ui \
28 PPPDialingGUI.ui \ 28 PPPDialingGUI.ui \
29 PPPRunGUI.ui 29 PPPRunGUI.ui
30 TARGET = ppp 30 TARGET = ppp
31 VERSION = 1.0.0 31 VERSION = 1.0.0
32 32
33include( $(OPIEDIR)/include.pro ) 33include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
index 51ba27d..bd13ab9 100644
--- a/noncore/settings/networksettings2/ppp/ppp_NN.cpp
+++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp
@@ -1,85 +1,100 @@
1#include <qfile.h> 1#include <qfile.h>
2#include <resources.h> 2#include <resources.h>
3#include <qtextstream.h> 3#include <qtextstream.h>
4#include "ppp_NN.h" 4#include "ppp_NN.h"
5#include "ppp_NNI.h" 5#include "ppp_NNI.h"
6 6
7#ifndef MYPLUGIN
8
9#include "netnodeinterface.h"
10
11#endif
12
7QStringList * PPPNetNode::ProperFiles = 0; 13QStringList * PPPNetNode::ProperFiles = 0;
8 14
9static const char * PPPNeeds[] = 15static const char * PPPNeeds[] =
10 { "modem", 16 { "modem",
11 0 17 0
12 }; 18 };
13 19
14static const char * PPPProvides[] = 20static const char * PPPProvides[] =
15 { "connection", 21 { "connection",
16 0 22 0
17 }; 23 };
18 24
19/** 25/**
20 * Constructor, find all of the possible interfaces 26 * Constructor, find all of the possible interfaces
21 */ 27 */
22PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) { 28PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) {
23 29
24 NSResources->addSystemFile( 30 NSResources->addSystemFile(
25 "pap-secrets", "/etc/ppp/pap-secrets", 0 ); 31 "pap-secrets", "/etc/ppp/pap-secrets", 0 );
26 NSResources->addSystemFile( 32 NSResources->addSystemFile(
27 "chap-secrets", "/etc/ppp/chap-secrets", 0 ); 33 "chap-secrets", "/etc/ppp/chap-secrets", 0 );
28} 34}
29 35
30/** 36/**
31 * Delete any interfaces that we own. 37 * Delete any interfaces that we own.
32 */ 38 */
33PPPNetNode::~PPPNetNode(){ 39PPPNetNode::~PPPNetNode(){
34} 40}
35 41
36const QString PPPNetNode::nodeDescription(){ 42const QString PPPNetNode::nodeDescription(){
37 return tr("\ 43 return tr("\
38<p>Sets up IP using PPP.</p>\ 44<p>Sets up IP using PPP.</p>\
39<p>Use this for dialup devices or serial setups</p>\ 45<p>Use this for dialup devices or serial setups</p>\
40" 46"
41); 47);
42} 48}
43 49
44ANetNodeInstance * PPPNetNode::createInstance( void ) { 50ANetNodeInstance * PPPNetNode::createInstance( void ) {
45 return new APPP( this ); 51 return new APPP( this );
46} 52}
47 53
48const char ** PPPNetNode::needs( void ) { 54const char ** PPPNetNode::needs( void ) {
49 return PPPNeeds; 55 return PPPNeeds;
50} 56}
51 57
52const char ** PPPNetNode::provides( void ) { 58const char ** PPPNetNode::provides( void ) {
53 return PPPProvides; 59 return PPPProvides;
54} 60}
55 61
56QStringList PPPNetNode::properFiles( void ) { 62QStringList PPPNetNode::properFiles( void ) {
57 QStringList SL; 63 QStringList SL;
58 SL << "peers" << "chatscripts"; 64 SL << "peers" << "chatscripts";
59 return SL; 65 return SL;
60} 66}
61 67
62// need to generate : 68// need to generate :
63// /etc/ppp/pap-secrets 69// /etc/ppp/pap-secrets
64// /etc/ppp/pap-secrets 70// /etc/ppp/pap-secrets
65bool PPPNetNode::hasDataForFile( SystemFile & S ) { 71bool PPPNetNode::hasDataForFile( SystemFile & S ) {
66 return S.name() == "pap-secrets" || 72 return S.name() == "pap-secrets" ||
67 S.name() == "chap-secrets" ; 73 S.name() == "chap-secrets" ;
68} 74}
69 75
70QString PPPNetNode::genNic( long NicNr ) { 76QString PPPNetNode::genNic( long NicNr ) {
71 QString S; 77 QString S;
72 return S.sprintf( "ppp%ld", NicNr ); 78 return S.sprintf( "ppp%ld", NicNr );
73} 79}
74 80
75void PPPNetNode::setSpecificAttribute( QString & , QString & ) { 81void PPPNetNode::setSpecificAttribute( QString & , QString & ) {
76} 82}
77 83
78void PPPNetNode::saveSpecificAttribute( QTextStream & ) { 84void PPPNetNode::saveSpecificAttribute( QTextStream & ) {
79} 85}
80 86
87#ifdef MYPLUGIN
88
81extern "C" { 89extern "C" {
82void create_plugin( QList<ANetNode> & PNN ) { 90void create_plugin( QList<ANetNode> & PNN ) {
83 PNN.append( new PPPNetNode() ); 91 PNN.append( new PPPNetNode() );
84} 92}
93
94#else
95
96OPIE_NS2_PLUGIN( NetNodeInterface<PPPNetNode> )
97
98#endif
99
85} 100}
diff --git a/noncore/settings/networksettings2/profile/profile.pro b/noncore/settings/networksettings2/profile/profile.pro
index f980034..4db7a5d 100644
--- a/noncore/settings/networksettings2/profile/profile.pro
+++ b/noncore/settings/networksettings2/profile/profile.pro
@@ -1,18 +1,18 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release plugin
3DESTDIR = $(OPIEDIR)/plugins/networksettings2 3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = profile_NN.h \ 4 HEADERS = profile_NN.h \
5 profile_NNI.h \ 5 profile_NNI.h \
6 profileedit.h 6 profileedit.h
7 SOURCES = profile_NN.cpp \ 7 SOURCES = profile_NN.cpp \
8 profile_NNI.cpp \ 8 profile_NNI.cpp \
9 profileedit.cpp \ 9 profileedit.cpp \
10 profilerun.cpp 10 profilerun.cpp
11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2
12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2
13LIBS += -lqpe 13LIBS += -lqpe
14 INTERFACES= profileGUI.ui 14 INTERFACES= profileGUI.ui
15 TARGET = profile 15 TARGET = profile
16 VERSION = 1.0.0 16 VERSION = 1.0.0
17 17
18include( $(OPIEDIR)/include.pro ) 18include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/profile/profile_NN.cpp b/noncore/settings/networksettings2/profile/profile_NN.cpp
index b7d8aa0..6028ea5 100644
--- a/noncore/settings/networksettings2/profile/profile_NN.cpp
+++ b/noncore/settings/networksettings2/profile/profile_NN.cpp
@@ -1,60 +1,75 @@
1#include <resources.h> 1#include <resources.h>
2#include "profile_NN.h" 2#include "profile_NN.h"
3#include "profile_NNI.h" 3#include "profile_NNI.h"
4 4
5#ifndef MYPLUGIN
6
7#include "netnodeinterface.h"
8
9#endif
10
5static const char * ProfileNeeds[] = 11static const char * ProfileNeeds[] =
6 { "connection", 12 { "connection",
7 0 13 0
8 }; 14 };
9static const char * ProfileProvides[] = 15static const char * ProfileProvides[] =
10 { "fullsetup", 16 { "fullsetup",
11 0 17 0
12 }; 18 };
13 19
14/** 20/**
15 * Constructor, find all of the possible interfaces 21 * Constructor, find all of the possible interfaces
16 */ 22 */
17ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular connection profile")) { 23ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular connection profile")) {
18 24
19 NSResources->addSystemFile( 25 NSResources->addSystemFile(
20 "interfaces", "/etc/network/interfaces", 1 ); 26 "interfaces", "/etc/network/interfaces", 1 );
21 27
22} 28}
23 29
24/** 30/**
25 * Delete any interfaces that we own. 31 * Delete any interfaces that we own.
26 */ 32 */
27ProfileNetNode::~ProfileNetNode(){ 33ProfileNetNode::~ProfileNetNode(){
28} 34}
29 35
30const QString ProfileNetNode::nodeDescription(){ 36const QString ProfileNetNode::nodeDescription(){
31 return tr("\ 37 return tr("\
32<p>Define use of an IP connection.</p>\ 38<p>Define use of an IP connection.</p>\
33<p>Configure if and when this connection needs to be established</p>\ 39<p>Configure if and when this connection needs to be established</p>\
34" 40"
35); 41);
36} 42}
37 43
38ANetNodeInstance * ProfileNetNode::createInstance( void ) { 44ANetNodeInstance * ProfileNetNode::createInstance( void ) {
39 return new AProfile( this ); 45 return new AProfile( this );
40} 46}
41 47
42const char ** ProfileNetNode::needs( void ) { 48const char ** ProfileNetNode::needs( void ) {
43 return ProfileNeeds; 49 return ProfileNeeds;
44} 50}
45 51
46const char ** ProfileNetNode::provides( void ) { 52const char ** ProfileNetNode::provides( void ) {
47 return ProfileProvides; 53 return ProfileProvides;
48} 54}
49 55
50void ProfileNetNode::setSpecificAttribute( QString & , QString & ) { 56void ProfileNetNode::setSpecificAttribute( QString & , QString & ) {
51} 57}
52 58
53void ProfileNetNode::saveSpecificAttribute( QTextStream & ) { 59void ProfileNetNode::saveSpecificAttribute( QTextStream & ) {
54} 60}
55 61
62#ifdef MYPLUGIN
63
56extern "C" { 64extern "C" {
57void create_plugin( QList<ANetNode> & PNN ) { 65void create_plugin( QList<ANetNode> & PNN ) {
58 PNN.append( new ProfileNetNode() ); 66 PNN.append( new ProfileNetNode() );
59} 67}
68
69#else
70
71OPIE_NS2_PLUGIN( NetNodeInterface<ProfileNetNode> )
72
73#endif
74
60} 75}
diff --git a/noncore/settings/networksettings2/usb/usb.pro b/noncore/settings/networksettings2/usb/usb.pro
index 37c1bde..d9890b6 100644
--- a/noncore/settings/networksettings2/usb/usb.pro
+++ b/noncore/settings/networksettings2/usb/usb.pro
@@ -1,18 +1,18 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release plugin
3DESTDIR = $(OPIEDIR)/plugins/networksettings2 3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = usb_NN.h \ 4 HEADERS = usb_NN.h \
5 usb_NNI.h \ 5 usb_NNI.h \
6 usbedit.h 6 usbedit.h
7 SOURCES = usb_NN.cpp \ 7 SOURCES = usb_NN.cpp \
8 usb_NNI.cpp \ 8 usb_NNI.cpp \
9 usbedit.cpp \ 9 usbedit.cpp \
10 usbrun.cpp 10 usbrun.cpp
11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2
12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2
13LIBS += -lqpe 13LIBS += -lqpe
14 INTERFACES= usbGUI.ui 14 INTERFACES= usbGUI.ui
15 TARGET = usb 15 TARGET = usb
16 VERSION = 1.0.0 16 VERSION = 1.0.0
17 17
18include( $(OPIEDIR)/include.pro ) 18include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/usb/usb_NN.cpp b/noncore/settings/networksettings2/usb/usb_NN.cpp
index bd9ae2b..9c07b82 100644
--- a/noncore/settings/networksettings2/usb/usb_NN.cpp
+++ b/noncore/settings/networksettings2/usb/usb_NN.cpp
@@ -1,62 +1,77 @@
1#include <resources.h> 1#include <resources.h>
2#include "usb_NN.h" 2#include "usb_NN.h"
3#include "usb_NNI.h" 3#include "usb_NNI.h"
4 4
5#ifndef MYPLUGIN
6
7#include "netnodeinterface.h"
8
9#endif
10
5static const char * USBNeeds[] = 11static const char * USBNeeds[] =
6 { 0 12 { 0
7 }; 13 };
8 14
9static const char * USBProvides[] = 15static const char * USBProvides[] =
10 { "device", 16 { "device",
11 0 17 0
12 }; 18 };
13 19
14/** 20/**
15 * Constructor, find all of the possible interfaces 21 * Constructor, find all of the possible interfaces
16 */ 22 */
17USBNetNode::USBNetNode() : ANetNode(tr("USB Cable Connect")) { 23USBNetNode::USBNetNode() : ANetNode(tr("USB Cable Connect")) {
18 NSResources->addSystemFile( 24 NSResources->addSystemFile(
19 "interfaces", "/etc/network/interfaces", 1 ); 25 "interfaces", "/etc/network/interfaces", 1 );
20} 26}
21 27
22/** 28/**
23 * Delete any interfaces that we own. 29 * Delete any interfaces that we own.
24 */ 30 */
25USBNetNode::~USBNetNode(){ 31USBNetNode::~USBNetNode(){
26} 32}
27 33
28const QString USBNetNode::nodeDescription(){ 34const QString USBNetNode::nodeDescription(){
29 return tr("\ 35 return tr("\
30<p>Configure Ethernet over USB.</p>\ 36<p>Configure Ethernet over USB.</p>\
31<p>Use this for a computer to computer USB cable connection</p>\ 37<p>Use this for a computer to computer USB cable connection</p>\
32" 38"
33); 39);
34} 40}
35 41
36ANetNodeInstance * USBNetNode::createInstance( void ) { 42ANetNodeInstance * USBNetNode::createInstance( void ) {
37 return new AUSB( this ); 43 return new AUSB( this );
38} 44}
39 45
40const char ** USBNetNode::needs( void ) { 46const char ** USBNetNode::needs( void ) {
41 return USBNeeds; 47 return USBNeeds;
42} 48}
43 49
44const char ** USBNetNode::provides( void ) { 50const char ** USBNetNode::provides( void ) {
45 return USBProvides; 51 return USBProvides;
46} 52}
47 53
48QString USBNetNode::genNic( long ) { 54QString USBNetNode::genNic( long ) {
49 return QString( "usbf" ); 55 return QString( "usbf" );
50} 56}
51 57
52void USBNetNode::setSpecificAttribute( QString & , QString & ) { 58void USBNetNode::setSpecificAttribute( QString & , QString & ) {
53} 59}
54 60
55void USBNetNode::saveSpecificAttribute( QTextStream & ) { 61void USBNetNode::saveSpecificAttribute( QTextStream & ) {
56} 62}
57 63
64#ifdef MYPLUGIN
65
58extern "C" { 66extern "C" {
59void create_plugin( QList<ANetNode> & PNN ) { 67void create_plugin( QList<ANetNode> & PNN ) {
60 PNN.append( new USBNetNode() ); 68 PNN.append( new USBNetNode() );
61} 69}
70
71#else
72
73OPIE_NS2_PLUGIN( NetNodeInterface<USBNetNode> )
74
75#endif
76
62} 77}
diff --git a/noncore/settings/networksettings2/usb/usb_NNI.cpp b/noncore/settings/networksettings2/usb/usb_NNI.cpp
index 600b771..424845c 100644
--- a/noncore/settings/networksettings2/usb/usb_NNI.cpp
+++ b/noncore/settings/networksettings2/usb/usb_NNI.cpp
@@ -1,59 +1,59 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include "usbedit.h" 2#include "usbedit.h"
3#include "usb_NNI.h" 3#include "usb_NNI.h"
4#include "usb_NN.h" 4#include "usb_NN.h"
5 5
6AUSB::AUSB( USBNetNode * PNN ) : ANetNodeInstance( PNN ) { 6AUSB::AUSB( USBNetNode * PNN ) : ANetNodeInstance( PNN ) {
7 7
8 GUI = 0; 8 GUI = 0;
9 RT = 0; 9 RT = 0;
10} 10}
11 11
12void AUSB::setSpecificAttribute( QString & , QString & ) { 12void AUSB::setSpecificAttribute( QString & , QString & ) {
13} 13}
14 14
15void AUSB::saveSpecificAttribute( QTextStream & ) { 15void AUSB::saveSpecificAttribute( QTextStream & ) {
16} 16}
17 17
18 18
19QWidget * AUSB::edit( QWidget * parent ) { 19QWidget * AUSB::edit( QWidget * parent ) {
20 GUI = new USBEdit( parent ); 20 GUI = new USBEdit( parent );
21 GUI->showData( Data ); 21 GUI->showData( Data );
22 return GUI; 22 return GUI;
23} 23}
24 24
25QString AUSB::acceptable( void ) { 25QString AUSB::acceptable( void ) {
26 return ( GUI ) ? GUI->acceptable( ) : QString(); 26 return ( GUI ) ? GUI->acceptable( ) : QString();
27} 27}
28 28
29void AUSB::commit( void ) { 29void AUSB::commit( void ) {
30 if( GUI && GUI->commit( Data ) ) { 30 if( GUI && GUI->commit( Data ) ) {
31 setModified( 1 ); 31 setModified( 1 );
32 } 32 }
33} 33}
34 34
35short AUSB::generateFileEmbedded( SystemFile & SF, 35short AUSB::generateFileEmbedded( SystemFile & SF,
36 long DevNr ) { 36 long DevNr ) {
37 37
38 QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr ); 38 QString NIC = runtime()->device()->netNode()->nodeClass()->genNic( DevNr );
39 short rvl, rvd; 39 short rvl, rvd;
40 40
41 rvl = 1; 41 rvl = 1;
42 42
43 if( SF.name() == "interfaces" ) { 43 if( SF.name() == "interfaces" ) {
44 Log(("Generate USB for %s\n", SF.name().latin1() )); 44 Log(("Generate USB for %s\n", SF.name().latin1() ));
45 // generate mapping stanza for this interface 45 // generate mapping stanza for this interface
46 SF << " pre-up " 46 SF << " pre-up "
47 << QPEApplication::qpeDir() 47 << QPEApplication::qpeDir()
48 << "bin/setmacaddress.sh " 48 << "bin/NS2SetMac.sh "
49 << NIC 49 << NIC
50 << " || true" 50 << " || true"
51 << endl; 51 << endl;
52 rvl = 0; 52 rvl = 0;
53 } 53 }
54 rvd = ANetNodeInstance::generateFileEmbedded(SF, DevNr ); 54 rvd = ANetNodeInstance::generateFileEmbedded(SF, DevNr );
55 55
56 return (rvd == 2 || rvl == 2 ) ? 2 : 56 return (rvd == 2 || rvl == 2 ) ? 2 :
57 (rvd == 0 || rvl == 0 ) ? 0 : 1; 57 (rvd == 0 || rvl == 0 ) ? 0 : 1;
58 58
59} 59}
diff --git a/noncore/settings/networksettings2/vpn/vpn.pro b/noncore/settings/networksettings2/vpn/vpn.pro
index a131a1f..349571e 100644
--- a/noncore/settings/networksettings2/vpn/vpn.pro
+++ b/noncore/settings/networksettings2/vpn/vpn.pro
@@ -1,18 +1,18 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release plugin
3DESTDIR = $(OPIEDIR)/plugins/networksettings2 3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = vpn_NN.h \ 4 HEADERS = vpn_NN.h \
5 vpn_NNI.h \ 5 vpn_NNI.h \
6 vpnedit.h 6 vpnedit.h
7 SOURCES = vpn_NN.cpp \ 7 SOURCES = vpn_NN.cpp \
8 vpn_NNI.cpp \ 8 vpn_NNI.cpp \
9 vpnedit.cpp \ 9 vpnedit.cpp \
10 vpnrun.cpp 10 vpnrun.cpp
11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2
12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2
13LIBS += -lqpe 13LIBS += -lqpe
14 INTERFACES= vpnGUI.ui 14 INTERFACES= vpnGUI.ui
15 TARGET = vpn 15 TARGET = vpn
16 VERSION = 1.0.0 16 VERSION = 1.0.0
17 17
18include( $(OPIEDIR)/include.pro ) 18include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.cpp b/noncore/settings/networksettings2/vpn/vpn_NN.cpp
index 23ec04a..6dd5332 100644
--- a/noncore/settings/networksettings2/vpn/vpn_NN.cpp
+++ b/noncore/settings/networksettings2/vpn/vpn_NN.cpp
@@ -1,54 +1,69 @@
1#include "vpn_NN.h" 1#include "vpn_NN.h"
2#include "vpn_NNI.h" 2#include "vpn_NNI.h"
3 3
4#ifndef MYPLUGIN
5
6#include "netnodeinterface.h"
7
8#endif
9
4static const char * VPNNeeds[] = 10static const char * VPNNeeds[] =
5 { 0 11 { 0
6 }; 12 };
7 13
8static const char * VPNProvides[] = 14static const char * VPNProvides[] =
9 { "connection", 15 { "connection",
10 0 16 0
11 }; 17 };
12/** 18/**
13 * Constructor, find all of the possible interfaces 19 * Constructor, find all of the possible interfaces
14 */ 20 */
15VPNNetNode::VPNNetNode() : ANetNode(tr("VPN Connection")) { 21VPNNetNode::VPNNetNode() : ANetNode(tr("VPN Connection")) {
16} 22}
17 23
18/** 24/**
19 * Delete any interfaces that we own. 25 * Delete any interfaces that we own.
20 */ 26 */
21VPNNetNode::~VPNNetNode(){ 27VPNNetNode::~VPNNetNode(){
22} 28}
23 29
24const QString VPNNetNode::nodeDescription(){ 30const QString VPNNetNode::nodeDescription(){
25 return tr("\ 31 return tr("\
26<p>Configure private IP connection.</p>\ 32<p>Configure private IP connection.</p>\
27<p>Defines Secure tunnels over non secure IP sessions</p>\ 33<p>Defines Secure tunnels over non secure IP sessions</p>\
28" 34"
29); 35);
30} 36}
31 37
32ANetNodeInstance * VPNNetNode::createInstance( void ) { 38ANetNodeInstance * VPNNetNode::createInstance( void ) {
33 return new AVPN( this ); 39 return new AVPN( this );
34} 40}
35 41
36const char ** VPNNetNode::needs( void ) { 42const char ** VPNNetNode::needs( void ) {
37 return VPNNeeds; 43 return VPNNeeds;
38} 44}
39 45
40const char ** VPNNetNode::provides( void ) { 46const char ** VPNNetNode::provides( void ) {
41 return VPNProvides; 47 return VPNProvides;
42} 48}
43 49
44void VPNNetNode::setSpecificAttribute( QString & , QString & ) { 50void VPNNetNode::setSpecificAttribute( QString & , QString & ) {
45} 51}
46 52
47void VPNNetNode::saveSpecificAttribute( QTextStream & ) { 53void VPNNetNode::saveSpecificAttribute( QTextStream & ) {
48} 54}
49 55
56#ifdef MYPLUGIN
57
50extern "C" { 58extern "C" {
51void create_plugin( QList<ANetNode> & PNN ) { 59void create_plugin( QList<ANetNode> & PNN ) {
52 PNN.append( new VPNNetNode() ); 60 PNN.append( new VPNNetNode() );
53} 61}
62
63#else
64
65OPIE_NS2_PLUGIN( NetNodeInterface<VPNNetNode> )
66
67#endif
68
54} 69}
diff --git a/noncore/settings/networksettings2/wlan/wlan.pro b/noncore/settings/networksettings2/wlan/wlan.pro
index f4c55df..a08cbbb 100644
--- a/noncore/settings/networksettings2/wlan/wlan.pro
+++ b/noncore/settings/networksettings2/wlan/wlan.pro
@@ -1,18 +1,18 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release plugin
3DESTDIR = $(OPIEDIR)/plugins/networksettings2 3DESTDIR = $(OPIEDIR)/plugins/networksettings2
4 HEADERS = wlan_NN.h \ 4 HEADERS = wlan_NN.h \
5 wlan_NNI.h \ 5 wlan_NNI.h \
6 wlanedit.h 6 wlanedit.h
7 SOURCES = wlan_NN.cpp \ 7 SOURCES = wlan_NN.cpp \
8 wlan_NNI.cpp \ 8 wlan_NNI.cpp \
9 wlanedit.cpp \ 9 wlanedit.cpp \
10 wlanrun.cpp 10 wlanrun.cpp
11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2
12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 12 DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2
13LIBS += -lqpe 13LIBS += -lqpe
14 INTERFACES= wlanGUI.ui 14 INTERFACES= wlanGUI.ui
15 TARGET = wlan 15 TARGET = wlan
16 VERSION = 1.0.0 16 VERSION = 1.0.0
17 17
18include( $(OPIEDIR)/include.pro ) 18include( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.cpp b/noncore/settings/networksettings2/wlan/wlan_NN.cpp
index 36a5c33..c56da06 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NN.cpp
+++ b/noncore/settings/networksettings2/wlan/wlan_NN.cpp
@@ -1,70 +1,85 @@
1#include <resources.h> 1#include <resources.h>
2#include "wlan_NN.h" 2#include "wlan_NN.h"
3#include "wlan_NNI.h" 3#include "wlan_NNI.h"
4 4
5#ifndef MYPLUGIN
6
7#include "netnodeinterface.h"
8
9#endif
10
5static const char * WLanNeeds[] = 11static const char * WLanNeeds[] =
6 { 0 12 { 0
7 }; 13 };
8 14
9static const char * WLanProvides[] = 15static const char * WLanProvides[] =
10 { "device", 16 { "device",
11 0 17 0
12 }; 18 };
13 19
14/** 20/**
15 * Constructor, find all of the possible interfaces 21 * Constructor, find all of the possible interfaces
16 */ 22 */
17WLanNetNode::WLanNetNode() : ANetNode(tr("WLan Device")) { 23WLanNetNode::WLanNetNode() : ANetNode(tr("WLan Device")) {
18 NSResources->addSystemFile( 24 NSResources->addSystemFile(
19 "interfaces", "/etc/network/interfaces", 1 ); 25 "interfaces", "/etc/network/interfaces", 1 );
20 InstanceCount = 2; 26 InstanceCount = 2;
21} 27}
22 28
23/** 29/**
24 * Delete any interfaces that we own. 30 * Delete any interfaces that we own.
25 */ 31 */
26WLanNetNode::~WLanNetNode(){ 32WLanNetNode::~WLanNetNode(){
27} 33}
28 34
29const QString WLanNetNode::nodeDescription(){ 35const QString WLanNetNode::nodeDescription(){
30 return tr("\ 36 return tr("\
31<p>Configure Wi/Fi or WLan network cards.</p>\ 37<p>Configure Wi/Fi or WLan network cards.</p>\
32<p>Defines Wireless options for those cards</p>\ 38<p>Defines Wireless options for those cards</p>\
33" 39"
34); 40);
35} 41}
36 42
37ANetNodeInstance * WLanNetNode::createInstance( void ) { 43ANetNodeInstance * WLanNetNode::createInstance( void ) {
38 return new AWLan( this ); 44 return new AWLan( this );
39} 45}
40 46
41const char ** WLanNetNode::needs( void ) { 47const char ** WLanNetNode::needs( void ) {
42 return WLanNeeds; 48 return WLanNeeds;
43} 49}
44 50
45const char ** WLanNetNode::provides( void ) { 51const char ** WLanNetNode::provides( void ) {
46 return WLanProvides; 52 return WLanProvides;
47} 53}
48 54
49QString WLanNetNode::genNic( long nr ) { 55QString WLanNetNode::genNic( long nr ) {
50 QString S; 56 QString S;
51 return S.sprintf( "wlan%ld", nr ); 57 return S.sprintf( "wlan%ld", nr );
52} 58}
53 59
54void WLanNetNode::setSpecificAttribute( QString & A, QString & V ) { 60void WLanNetNode::setSpecificAttribute( QString & A, QString & V ) {
55 if( A == "interfacecount" ) { 61 if( A == "interfacecount" ) {
56 InstanceCount = V.toLong(); 62 InstanceCount = V.toLong();
57 } 63 }
58} 64}
59 65
60void WLanNetNode::saveSpecificAttribute( QTextStream & TS ) { 66void WLanNetNode::saveSpecificAttribute( QTextStream & TS ) {
61 TS << "interfacecount=" 67 TS << "interfacecount="
62 << InstanceCount 68 << InstanceCount
63 << endl; 69 << endl;
64} 70}
65 71
72#ifdef MYPLUGIN
73
66extern "C" { 74extern "C" {
67void create_plugin( QList<ANetNode> & PNN ) { 75void create_plugin( QList<ANetNode> & PNN ) {
68 PNN.append( new WLanNetNode() ); 76 PNN.append( new WLanNetNode() );
69} 77}
78
79#else
80
81OPIE_NS2_PLUGIN( NetNodeInterface<WLanNetNode> )
82
83#endif
84
70} 85}