author | wimpie <wimpie> | 2005-01-04 01:35:26 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-04 01:35:26 (UTC) |
commit | a9c188235c97e07b0eb96b13adbcdfd4bad64767 (patch) (unidiff) | |
tree | 13f6ae5c499dc0c1d1bd4b763a1973a0fa8635cf /noncore/settings/networksettings2/bluetooth | |
parent | 48b6cd5966ec6cc0b968edf10ba1a1ad96ef165f (diff) | |
download | opie-a9c188235c97e07b0eb96b13adbcdfd4bad64767.zip opie-a9c188235c97e07b0eb96b13adbcdfd4bad64767.tar.gz opie-a9c188235c97e07b0eb96b13adbcdfd4bad64767.tar.bz2 |
CONTROL files : changed version string
NS2 many changes and first release of OT2
Diffstat (limited to 'noncore/settings/networksettings2/bluetooth') (more/less context) (show whitespace changes)
15 files changed, 594 insertions, 289 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth.pro b/noncore/settings/networksettings2/bluetooth/bluetooth.pro index 8170d46..2e3b5bb 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetooth.pro +++ b/noncore/settings/networksettings2/bluetooth/bluetooth.pro | |||
@@ -3,9 +3,12 @@ CONFIG += qt warn_on release | |||
3 | DESTDIR = $(OPIEDIR)/plugins/networksettings2 | 3 | DESTDIR = $(OPIEDIR)/plugins/networksettings2 |
4 | HEADERS = bluetooth_NN.h \ | 4 | HEADERS = bluetoothBNEP_NN.h \ |
5 | bluetoothBNEP_NNI.h \ | 5 | bluetoothBNEP_NNI.h \ |
6 | bluetoothRFCOMM_NN.h \ | ||
6 | bluetoothRFCOMM_NNI.h \ | 7 | bluetoothRFCOMM_NNI.h \ |
7 | bluetoothBNEPedit.h \ | 8 | bluetoothBNEPedit.h \ |
9 | bluetoothRFCOMMrun.h \ | ||
8 | bluetoothRFCOMMedit.h | 10 | bluetoothRFCOMMedit.h |
9 | SOURCES = bluetooth_NN.cpp \ | 11 | SOURCES = bluetoothBNEP_NN.cpp \ |
10 | bluetoothBNEP_NNI.cpp \ | 12 | bluetoothBNEP_NNI.cpp \ |
13 | bluetoothRFCOMM_NN.cpp \ | ||
11 | bluetoothRFCOMM_NNI.cpp \ | 14 | bluetoothRFCOMM_NNI.cpp \ |
@@ -13,6 +16,7 @@ SOURCES = bluetooth_NN.cpp \ | |||
13 | bluetoothBNEPrun.cpp \ | 16 | bluetoothBNEPrun.cpp \ |
17 | bluetoothRFCOMMrun.cpp \ | ||
14 | bluetoothRFCOMMedit.cpp | 18 | bluetoothRFCOMMedit.cpp |
15 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 | 19 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../networksettings2 ../opietooth2 |
16 | DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 | 20 | DEPENDPATH+= $(OPIEDIR)/include ../ ../networksettings2 ../opietooth2 |
17 | LIBS += -lqpe | 21 | LIBS += -lqpe -lopietooth2 |
18 | INTERFACES= bluetoothBNEPGUI.ui bluetoothRFCOMMGUI.ui | 22 | INTERFACES= bluetoothBNEPGUI.ui bluetoothRFCOMMGUI.ui |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.cpp index 398dcdc..42b2515 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.cpp +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEP_NNI.cpp | |||
@@ -2,3 +2,3 @@ | |||
2 | #include "bluetoothBNEP_NNI.h" | 2 | #include "bluetoothBNEP_NNI.h" |
3 | #include "bluetooth_NN.h" | 3 | #include "bluetoothBNEP_NN.h" |
4 | 4 | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPdata.h b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPdata.h index 03c6903..f52a2c5 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPdata.h +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPdata.h | |||
@@ -5,6 +5,9 @@ | |||
5 | 5 | ||
6 | typedef struct BluetoothBNEPData { | 6 | class BluetoothBNEPData { |
7 | |||
8 | public : | ||
9 | |||
7 | bool AllowAll; | 10 | bool AllowAll; |
8 | QStringList BDAddress; | 11 | QStringList BDAddress; |
9 | } BluetoothBNEPData_t; | 12 | }; |
10 | 13 | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp index 24e4b7b..9d4ae97 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp | |||
@@ -6,56 +6,13 @@ | |||
6 | 6 | ||
7 | QDict<QString> * BluetoothBNEPRun::PANConnections = 0; | 7 | BluetoothBNEPRun::BluetoothBNEPRun( ANetNodeInstance * NNI, |
8 | 8 | BluetoothBNEPData & D ) : | |
9 | void BluetoothBNEPRun::detectState( NodeCollection * NC ) { | 9 | RuntimeInfo( NNI ), |
10 | // unavailable : no card found | 10 | Data( D), |
11 | // available : card found and assigned to us or free | 11 | Pat( "bnep[0-6]" ) { |
12 | // up : card found and assigned to us and up | 12 | OT = 0; |
13 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); | ||
14 | System & Sys = NSResources->system(); | ||
15 | InterfaceInfo * Run; | ||
16 | QFile F( S ); | ||
17 | |||
18 | Log(("Detecting for %s\n", NC->name().latin1() )); | ||
19 | |||
20 | if( F.open( IO_ReadOnly ) ) { | ||
21 | // could open file -> read interface and assign | ||
22 | QString X; | ||
23 | bool accepted = 0; | ||
24 | QTextStream TS(&F); | ||
25 | X = TS.readLine(); | ||
26 | Log(("%s exists : %s\n", S.latin1(), X.latin1() )); | ||
27 | // find interface | ||
28 | if( handlesInterface( X ) ) { | ||
29 | |||
30 | Log(("Handles interface %s, PANC %p\n", X.latin1(), PANConnections )); | ||
31 | if( PANConnections == 0 ) { | ||
32 | // load connections that are active | ||
33 | // format : bnep0 00:60:57:02:71:A2 PANU | ||
34 | FILE * OutputOfCmd = popen( "pand --show", "r" ) ; | ||
35 | |||
36 | PANConnections = new QDict<QString>; | ||
37 | |||
38 | if( OutputOfCmd ) { | ||
39 | char ch; | ||
40 | // could fork | ||
41 | // read all data | ||
42 | QString Line = ""; | ||
43 | while( 1 ) { | ||
44 | if( fread( &ch, 1, 1, OutputOfCmd ) < 1 ) { | ||
45 | // eof | ||
46 | break; | ||
47 | } | ||
48 | if( ch == '\n' || ch == '\r' ) { | ||
49 | if( ! Line.isEmpty() ) { | ||
50 | if( Line.startsWith( "bnep" ) ) { | ||
51 | QStringList SL = QStringList::split( " ", Line ); | ||
52 | Log(("Detected PAN %s %s\n", | ||
53 | SL[0].latin1(), SL[1].latin1() )); | ||
54 | PANConnections->insert( SL[0], new QString(SL[1])); | ||
55 | } | ||
56 | Line=""; | ||
57 | } | ||
58 | } else { | ||
59 | Line += ch; | ||
60 | } | 13 | } |
14 | |||
15 | BluetoothBNEPRun::~BluetoothBNEPRun( void ) { | ||
16 | if( OT ) { | ||
17 | OTGateway::releaseOTGateway(); | ||
61 | } | 18 | } |
@@ -63,187 +20,142 @@ void BluetoothBNEPRun::detectState( NodeCollection * NC ) { | |||
63 | 20 | ||
64 | pclose( OutputOfCmd ); | 21 | State_t BluetoothBNEPRun::detectState( void ) { |
65 | } | ||
66 | 22 | ||
67 | // check if this runtime allows connection to node | 23 | /* |
68 | if( ! Data.AllowAll ) { | ||
69 | // has addresses | ||
70 | for ( QStringList::Iterator it = Data.BDAddress.begin(); | ||
71 | ! accepted && it != Data.BDAddress.end(); | ||
72 | ++ it ) { | ||
73 | for( QDictIterator<QString> it2( *(PANConnections) ); | ||
74 | it2.current(); | ||
75 | ++ it2 ) { | ||
76 | if( X == it2.currentKey() && | ||
77 | (*it) == *(it2.current()) | ||
78 | ) { | ||
79 | // found | ||
80 | Log(("%s accepts connections to %s\n", | ||
81 | NC->name().latin1(), | ||
82 | it2.current()->latin1() )); | ||
83 | accepted = 1; | ||
84 | break; | ||
85 | } | ||
86 | } | ||
87 | } | ||
88 | } else { | ||
89 | Log(("%s accepts any connection\n", NC->name().latin1() )); | ||
90 | // accept any | ||
91 | accepted = 1; | ||
92 | } | ||
93 | 24 | ||
94 | if( accepted ) { | 25 | need to detect |
95 | // matches and is allowed for this node | ||
96 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | ||
97 | It.current(); | ||
98 | ++It ) { | ||
99 | Run = It.current(); | ||
100 | if( X == Run->Name ) { | ||
101 | Log(("%s Assigned %p\n", NC->name().latin1(), Run )); | ||
102 | Run->assignNode( netNode() ); | ||
103 | assignInterface( Run ); | ||
104 | NC->setCurrentState( IsUp ); | ||
105 | return; | ||
106 | } | ||
107 | } | ||
108 | } | ||
109 | } | ||
110 | } | ||
111 | 26 | ||
112 | Log(("Assigned %p\n", assignedInterface() )); | 27 | 1. for any PAN connection that is found if that |
113 | if( ( Run = assignedInterface() ) ) { | 28 | PAN is connected. |
114 | // we already have an interface assigned -> still present ? | 29 | |
115 | if( ! Run->IsUp ) { | 30 | if it is connected it is not available (since we do |
116 | // usb is still free -> keep assignment | 31 | not manage IP settings and we are called to detect |
117 | NC->setCurrentState( Available ); | 32 | the state we knwo that we do not have an UP connection) |
118 | return; | 33 | |
119 | } // else interface is up but NOT us -> some other profile | 34 | 2. if it not connected and we allow any connection we |
120 | } | 35 | are available or if that PAN connection is to a device |
121 | 36 | with a correct address | |
122 | // nothing (valid) assigned to us | 37 | |
123 | assignInterface( 0 ); | 38 | 3. if it is not connected and the address do not match or |
124 | 39 | we do not accept any address, we are Unavailable but | |
125 | // find possible interface | 40 | not DOWN. I.e a new connection could perhaps be created |
126 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | 41 | |
127 | It.current(); | 42 | */ |
128 | ++It ) { | 43 | |
129 | Run = It.current(); | 44 | if( ! OT ) { |
130 | 45 | OT = OTGateway::getOTGateway(); | |
131 | Log(("%s %d %d=%d %d\n", | ||
132 | Run->Name.latin1(), | ||
133 | handlesInterface( Run->Name ), | ||
134 | Run->CardType, ARPHRD_ETHER, | ||
135 | ! Run->IsUp )); | ||
136 | |||
137 | if( handlesInterface( Run->Name ) && | ||
138 | Run->CardType == ARPHRD_ETHER && | ||
139 | ! Run->IsUp | ||
140 | ) { | ||
141 | Log(("Released(OFF)\n" )); | ||
142 | // proper type, and Not UP -> free | ||
143 | NC->setCurrentState( Off ); | ||
144 | return; | ||
145 | } | 46 | } |
47 | |||
48 | if( ! OT->isEnabled() ) { | ||
49 | return Unavailable; | ||
146 | } | 50 | } |
147 | // no free found | ||
148 | Log(("None available\n" )); | ||
149 | 51 | ||
150 | NC->setCurrentState( Unavailable ); | 52 | // if there is a PAN connection that is UP but not |
53 | // yet configured (no ifup) the we are available | ||
54 | return ( hasFreePANConnection() ) ? Available : Unknown; | ||
151 | } | 55 | } |
152 | 56 | ||
153 | bool BluetoothBNEPRun::setState( NodeCollection * NC, Action_t A, bool ) { | 57 | QString BluetoothBNEPRun::setMyState( NodeCollection * NC, Action_t A, bool ) { |
154 | 58 | ||
155 | // we only handle activate and deactivate | 59 | if( A == Activate ) { |
156 | switch( A ) { | 60 | if( hasFreePANConnection( 1 ) ) { |
157 | case Activate : | 61 | // we have now an assignedinterface |
158 | { | 62 | } else { |
159 | if( NC->currentState() != Off ) { | 63 | return QString("TODO : Start PAND"); |
160 | return 0; | ||
161 | } | ||
162 | InterfaceInfo * N = getInterface(); | ||
163 | if( ! N ) { | ||
164 | // no interface available | ||
165 | NC->setCurrentState( Unavailable ); | ||
166 | return 0; | ||
167 | } | 64 | } |
168 | // because we were OFF the interface | 65 | |
169 | // we get back is NOT assigned | 66 | Log(( "Assigned interface" )); |
170 | N->assignNode( netNode() ); | ||
171 | assignInterface( N ); | ||
172 | Log(("Assing %p\n", N )); | ||
173 | NC->setCurrentState( Available ); | 67 | NC->setCurrentState( Available ); |
174 | return 1; | 68 | |
175 | } | 69 | return QString(); |
176 | case Deactivate : | ||
177 | if( NC->currentState() == IsUp ) { | ||
178 | // bring down first | ||
179 | if( ! connection()->setState( Down ) ) | ||
180 | // could not ... | ||
181 | return 0; | ||
182 | } else if( NC->currentState() != Available ) { | ||
183 | return 1; | ||
184 | } | 70 | } |
185 | assignedInterface()->assignNode( 0 ); // release | 71 | |
186 | assignInterface( 0 ); | 72 | if( A == Deactivate ) { |
73 | // nothing to do | ||
187 | NC->setCurrentState( Off ); | 74 | NC->setCurrentState( Off ); |
188 | return 1; | 75 | return QString(); |
189 | default : | ||
190 | // FT | ||
191 | break; | ||
192 | } | 76 | } |
193 | return 0; | 77 | return QString(); |
194 | } | 78 | } |
195 | 79 | ||
196 | bool BluetoothBNEPRun::canSetState( State_t Curr , Action_t A ) { | 80 | bool BluetoothBNEPRun::handlesInterface( const QString & S ) { |
197 | // we only handle up down activate and deactivate | 81 | return Pat.match( S ) >= 0; |
198 | switch( A ) { | ||
199 | case Activate : | ||
200 | { // at least available | ||
201 | if( Curr == Available ) { | ||
202 | return 1; | ||
203 | } | 82 | } |
204 | // or we can make one available | 83 | |
205 | InterfaceInfo * N = getInterface(); | 84 | bool BluetoothBNEPRun::handlesInterface( InterfaceInfo * I ) { |
206 | if( ! N || N->assignedNode() != 0 ) { | 85 | return handlesInterface( I->Name ); |
207 | // non available or assigned | ||
208 | return 0; | ||
209 | } | 86 | } |
210 | return 1; | 87 | |
88 | bool BluetoothBNEPRun::hasFreePANConnection( bool Grab ) { | ||
89 | |||
90 | if( ! OT ) { | ||
91 | OT = OTGateway::getOTGateway(); | ||
211 | } | 92 | } |
212 | case Deactivate : | 93 | |
213 | return ( Curr >= Available ); | 94 | // load PAN connections |
214 | default : | 95 | OTPANConnection * C; |
215 | // FT | 96 | InterfaceInfo * Run; |
97 | InterfaceInfo * Candidate = 0; // reuse this interface | ||
98 | PANConnectionVector Conns = OT->getPANConnections(); | ||
99 | System & Sys = NSResources->system(); | ||
100 | bool IsValid; | ||
101 | |||
102 | for( unsigned int i = 0; | ||
103 | i < Conns.count(); | ||
104 | i ++ ) { | ||
105 | C = Conns[i]; | ||
106 | |||
107 | if( Data.AllowAll ) { | ||
108 | // we allow all | ||
109 | IsValid = 1; | ||
110 | } else { | ||
111 | // is this PAN connection connecting to a Peer | ||
112 | // we allow ? | ||
113 | IsValid = 0; | ||
114 | for ( QStringList::Iterator it = Data.BDAddress.begin(); | ||
115 | it != Data.BDAddress.end(); | ||
116 | ++ it ) { | ||
117 | if( C->ConnectedTo == (*it) ) { | ||
118 | // this is a connection we could accept | ||
119 | IsValid = 1; | ||
216 | break; | 120 | break; |
217 | } | 121 | } |
218 | return 0; | 122 | } |
219 | } | 123 | } |
220 | 124 | ||
221 | // get interface that is free or assigned to us | 125 | if( ! IsValid ) { |
222 | InterfaceInfo * BluetoothBNEPRun::getInterface( void ) { | 126 | Log(("%s to %s not acceptable\n", |
127 | C->Device.latin1(), | ||
128 | C->ConnectedTo.latin1() )); | ||
129 | // don't bother checking this address | ||
130 | // it is not acceptable | ||
131 | continue; | ||
132 | } | ||
223 | 133 | ||
224 | System & S = NSResources->system(); | 134 | // is this PAN connection available to us ? |
225 | InterfaceInfo * best = 0, * Run; | 135 | Run = Sys.findInterface( C->Device ); |
226 | 136 | ||
227 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | 137 | if( Run && Run->IsUp ) { |
228 | It.current(); | 138 | // this PAN connection is up |
229 | ++It ) { | 139 | Log(("%s acceptable but unavailable\n", |
230 | Run = It.current(); | 140 | C->Device.latin1() )); |
231 | if( handlesInterface( Run->Name ) && | 141 | // find others |
232 | Run->CardType == ARPHRD_ETHER | 142 | continue; |
233 | ) { | ||
234 | // this is a bluetooth card | ||
235 | if( Run->assignedNode() == netNode() ) { | ||
236 | // assigned to us | ||
237 | return Run; | ||
238 | } else if( Run->assignedNode() == 0 ) { | ||
239 | // free | ||
240 | best = Run; | ||
241 | } | 143 | } |
144 | |||
145 | // we at least have a possible interface | ||
146 | if( ! Candidate ) { | ||
147 | Candidate = Run; | ||
242 | } | 148 | } |
243 | } | 149 | } |
244 | return best; // can be 0 | 150 | |
151 | if( Candidate ) { | ||
152 | if ( Grab ) { | ||
153 | netNode()->connection()->assignInterface( Candidate ); | ||
154 | } | ||
155 | return 1; | ||
245 | } | 156 | } |
246 | 157 | ||
247 | bool BluetoothBNEPRun::handlesInterface( const QString & S ) { | 158 | // no free PAN |
248 | return Pat.match( S ) >= 0; | 159 | return 0; |
249 | } | 160 | } |
161 | |||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h index ce03cbb..a05a7a2 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h | |||
@@ -1,5 +1,8 @@ | |||
1 | #include <asdevice.h> | 1 | #include <netnode.h> |
2 | #include "bluetoothBNEPdata.h" | 2 | #include "bluetoothBNEPdata.h" |
3 | 3 | ||
4 | class BluetoothBNEPRun : public AsDevice { | 4 | #include <OTGateway.h> |
5 | using namespace Opietooth2; | ||
6 | |||
7 | class BluetoothBNEPRun : public RuntimeInfo { | ||
5 | 8 | ||
@@ -8,13 +11,13 @@ public : | |||
8 | BluetoothBNEPRun( ANetNodeInstance * NNI, | 11 | BluetoothBNEPRun( ANetNodeInstance * NNI, |
9 | BluetoothBNEPData & D ) : | 12 | BluetoothBNEPData & D ); |
10 | AsDevice( NNI ), | 13 | virtual ~BluetoothBNEPRun( void ); |
11 | Data( D), | 14 | |
12 | Pat( "bnep[0-6]" ) | 15 | // i am a device |
13 | { } | 16 | virtual RuntimeInfo * device( void ) |
17 | { return this; } | ||
14 | 18 | ||
15 | virtual AsDevice * asDevice( void ) | 19 | bool handlesInterface( const QString & ); |
16 | { return (AsDevice *)this; } | 20 | bool handlesInterface( InterfaceInfo * ); |
17 | 21 | ||
18 | virtual AsDevice * device( void ) | 22 | State_t detectState( void ); |
19 | { return asDevice(); } | ||
20 | 23 | ||
@@ -22,6 +25,3 @@ protected : | |||
22 | 25 | ||
23 | void detectState( NodeCollection * ); | 26 | QString setMyState( NodeCollection * , Action_t, bool ); |
24 | bool setState( NodeCollection * , Action_t, bool ); | ||
25 | bool canSetState( State_t , Action_t ); | ||
26 | bool handlesInterface( const QString & ); | ||
27 | 27 | ||
@@ -29,5 +29,6 @@ private : | |||
29 | 29 | ||
30 | InterfaceInfo * getInterface( void ); | 30 | bool hasFreePANConnection( bool Grab = 0 ); |
31 | |||
31 | BluetoothBNEPData & Data; | 32 | BluetoothBNEPData & Data; |
32 | static QDict<QString> * PANConnections; | 33 | OTGateway * OT; |
33 | QRegExp Pat; | 34 | QRegExp Pat; |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMGUI.ui b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMGUI.ui index 2754a70..7f6565a 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMGUI.ui +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMGUI.ui | |||
@@ -13,4 +13,4 @@ | |||
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>283</width> | 14 | <width>488</width> |
15 | <height>199</height> | 15 | <height>604</height> |
16 | </rect> | 16 | </rect> |
@@ -30,3 +30,3 @@ | |||
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>2</number> | 31 | <number>0</number> |
32 | </property> | 32 | </property> |
@@ -34,5 +34,23 @@ | |||
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>2</number> | 35 | <number>3</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QLabel</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>TextLabel5_2</cstring> | ||
42 | </property> | ||
43 | <property stdset="1"> | ||
44 | <name>text</name> | ||
45 | <string>Selected devices with gprs capability</string> | ||
46 | </property> | ||
47 | <property stdset="1"> | ||
48 | <name>alignment</name> | ||
49 | <set>WordBreak|AlignVCenter|AlignLeft</set> | ||
50 | </property> | ||
51 | <property> | ||
52 | <name>wordwrap</name> | ||
53 | </property> | ||
54 | </widget> | ||
55 | <widget> | ||
38 | <class>QLayoutWidget</class> | 56 | <class>QLayoutWidget</class> |
@@ -40,3 +58,6 @@ | |||
40 | <name>name</name> | 58 | <name>name</name> |
41 | <cstring>Layout4</cstring> | 59 | <cstring>Layout8</cstring> |
60 | </property> | ||
61 | <property> | ||
62 | <name>layoutSpacing</name> | ||
42 | </property> | 63 | </property> |
@@ -49,3 +70,3 @@ | |||
49 | <name>spacing</name> | 70 | <name>spacing</name> |
50 | <number>6</number> | 71 | <number>3</number> |
51 | </property> | 72 | </property> |
@@ -55,3 +76,3 @@ | |||
55 | <name>name</name> | 76 | <name>name</name> |
56 | <cstring>TextLabel4</cstring> | 77 | <cstring>TextLabel5</cstring> |
57 | </property> | 78 | </property> |
@@ -59,3 +80,3 @@ | |||
59 | <name>text</name> | 80 | <name>text</name> |
60 | <string>Name</string> | 81 | <string>Address</string> |
61 | </property> | 82 | </property> |
@@ -66,3 +87,14 @@ | |||
66 | <name>name</name> | 87 | <name>name</name> |
67 | <cstring>Name_LE</cstring> | 88 | <cstring>Address_LE</cstring> |
89 | </property> | ||
90 | </widget> | ||
91 | <widget> | ||
92 | <class>QToolButton</class> | ||
93 | <property stdset="1"> | ||
94 | <name>name</name> | ||
95 | <cstring>FindDevice_TB</cstring> | ||
96 | </property> | ||
97 | <property stdset="1"> | ||
98 | <name>text</name> | ||
99 | <string>...</string> | ||
68 | </property> | 100 | </property> |
@@ -72,2 +104,49 @@ | |||
72 | <widget> | 104 | <widget> |
105 | <class>QLayoutWidget</class> | ||
106 | <property stdset="1"> | ||
107 | <name>name</name> | ||
108 | <cstring>Layout7</cstring> | ||
109 | </property> | ||
110 | <property> | ||
111 | <name>layoutSpacing</name> | ||
112 | </property> | ||
113 | <hbox> | ||
114 | <property stdset="1"> | ||
115 | <name>margin</name> | ||
116 | <number>0</number> | ||
117 | </property> | ||
118 | <property stdset="1"> | ||
119 | <name>spacing</name> | ||
120 | <number>3</number> | ||
121 | </property> | ||
122 | <widget> | ||
123 | <class>QLabel</class> | ||
124 | <property stdset="1"> | ||
125 | <name>name</name> | ||
126 | <cstring>TextLabel2</cstring> | ||
127 | </property> | ||
128 | <property stdset="1"> | ||
129 | <name>text</name> | ||
130 | <string>Channel</string> | ||
131 | </property> | ||
132 | </widget> | ||
133 | <widget> | ||
134 | <class>QSpinBox</class> | ||
135 | <property stdset="1"> | ||
136 | <name>name</name> | ||
137 | <cstring>Channel_SB</cstring> | ||
138 | </property> | ||
139 | <property stdset="1"> | ||
140 | <name>sizePolicy</name> | ||
141 | <sizepolicy> | ||
142 | <hsizetype>0</hsizetype> | ||
143 | <vsizetype>0</vsizetype> | ||
144 | </sizepolicy> | ||
145 | </property> | ||
146 | <property stdset="1"> | ||
147 | <name>minValue</name> | ||
148 | <number>1</number> | ||
149 | </property> | ||
150 | </widget> | ||
151 | <widget> | ||
73 | <class>QLabel</class> | 152 | <class>QLabel</class> |
@@ -75,3 +154,3 @@ | |||
75 | <name>name</name> | 154 | <name>name</name> |
76 | <cstring>TextLabel3</cstring> | 155 | <cstring>TextLabel2_2</cstring> |
77 | </property> | 156 | </property> |
@@ -79,3 +158,3 @@ | |||
79 | <name>text</name> | 158 | <name>text</name> |
80 | <string>Description</string> | 159 | <string>Name</string> |
81 | </property> | 160 | </property> |
@@ -83,7 +162,24 @@ | |||
83 | <widget> | 162 | <widget> |
84 | <class>QMultiLineEdit</class> | 163 | <class>QLabel</class> |
85 | <property stdset="1"> | 164 | <property stdset="1"> |
86 | <name>name</name> | 165 | <name>name</name> |
87 | <cstring>Description_LE</cstring> | 166 | <cstring>Name_LBL</cstring> |
167 | </property> | ||
168 | <property stdset="1"> | ||
169 | <name>sizePolicy</name> | ||
170 | <sizepolicy> | ||
171 | <hsizetype>7</hsizetype> | ||
172 | <vsizetype>1</vsizetype> | ||
173 | </sizepolicy> | ||
174 | </property> | ||
175 | <property stdset="1"> | ||
176 | <name>frameShape</name> | ||
177 | <enum>Box</enum> | ||
88 | </property> | 178 | </property> |
179 | <property stdset="1"> | ||
180 | <name>indent</name> | ||
181 | <number>0</number> | ||
182 | </property> | ||
183 | </widget> | ||
184 | </hbox> | ||
89 | </widget> | 185 | </widget> |
@@ -95,2 +191,5 @@ | |||
95 | </property> | 191 | </property> |
192 | <property> | ||
193 | <name>layoutSpacing</name> | ||
194 | </property> | ||
96 | <hbox> | 195 | <hbox> |
@@ -102,9 +201,34 @@ | |||
102 | <name>spacing</name> | 201 | <name>spacing</name> |
103 | <number>6</number> | 202 | <number>3</number> |
104 | </property> | 203 | </property> |
105 | <widget> | 204 | <widget> |
106 | <class>QCheckBox</class> | 205 | <class>QLabel</class> |
206 | <property stdset="1"> | ||
207 | <name>name</name> | ||
208 | <cstring>TextLabel7</cstring> | ||
209 | </property> | ||
210 | <property stdset="1"> | ||
211 | <name>sizePolicy</name> | ||
212 | <sizepolicy> | ||
213 | <hsizetype>7</hsizetype> | ||
214 | <vsizetype>1</vsizetype> | ||
215 | </sizepolicy> | ||
216 | </property> | ||
217 | <property stdset="1"> | ||
218 | <name>text</name> | ||
219 | <string>Addresses</string> | ||
220 | </property> | ||
221 | <property stdset="1"> | ||
222 | <name>alignment</name> | ||
223 | <set>AlignVCenter|AlignLeft</set> | ||
224 | </property> | ||
225 | <property> | ||
226 | <name>vAlign</name> | ||
227 | </property> | ||
228 | </widget> | ||
229 | <widget> | ||
230 | <class>QToolButton</class> | ||
107 | <property stdset="1"> | 231 | <property stdset="1"> |
108 | <name>name</name> | 232 | <name>name</name> |
109 | <cstring>Automatic_CB</cstring> | 233 | <cstring>Add_TB</cstring> |
110 | </property> | 234 | </property> |
@@ -112,3 +236,3 @@ | |||
112 | <name>text</name> | 236 | <name>text</name> |
113 | <string>Start automatically</string> | 237 | <string>...</string> |
114 | </property> | 238 | </property> |
@@ -116,6 +240,6 @@ | |||
116 | <widget> | 240 | <widget> |
117 | <class>QCheckBox</class> | 241 | <class>QToolButton</class> |
118 | <property stdset="1"> | 242 | <property stdset="1"> |
119 | <name>name</name> | 243 | <name>name</name> |
120 | <cstring>Confirm_CB</cstring> | 244 | <cstring>Remove_TB</cstring> |
121 | </property> | 245 | </property> |
@@ -123,3 +247,3 @@ | |||
123 | <name>text</name> | 247 | <name>text</name> |
124 | <string>Confirm before start</string> | 248 | <string>...</string> |
125 | </property> | 249 | </property> |
@@ -128,4 +252,80 @@ | |||
128 | </widget> | 252 | </widget> |
253 | <widget> | ||
254 | <class>QListView</class> | ||
255 | <column> | ||
256 | <property> | ||
257 | <name>text</name> | ||
258 | <string>Name</string> | ||
259 | </property> | ||
260 | <property> | ||
261 | <name>clickable</name> | ||
262 | <bool>true</bool> | ||
263 | </property> | ||
264 | <property> | ||
265 | <name>resizeable</name> | ||
266 | <bool>true</bool> | ||
267 | </property> | ||
268 | </column> | ||
269 | <column> | ||
270 | <property> | ||
271 | <name>text</name> | ||
272 | <string>Channel</string> | ||
273 | </property> | ||
274 | <property> | ||
275 | <name>clickable</name> | ||
276 | <bool>true</bool> | ||
277 | </property> | ||
278 | <property> | ||
279 | <name>resizeable</name> | ||
280 | <bool>true</bool> | ||
281 | </property> | ||
282 | </column> | ||
283 | <column> | ||
284 | <property> | ||
285 | <name>text</name> | ||
286 | <string>Address</string> | ||
287 | </property> | ||
288 | <property> | ||
289 | <name>clickable</name> | ||
290 | <bool>true</bool> | ||
291 | </property> | ||
292 | <property> | ||
293 | <name>resizeable</name> | ||
294 | <bool>true</bool> | ||
295 | </property> | ||
296 | </column> | ||
297 | <property stdset="1"> | ||
298 | <name>name</name> | ||
299 | <cstring>Addresses_LV</cstring> | ||
300 | </property> | ||
301 | <property stdset="1"> | ||
302 | <name>allColumnsShowFocus</name> | ||
303 | <bool>true</bool> | ||
304 | </property> | ||
305 | </widget> | ||
129 | </vbox> | 306 | </vbox> |
130 | </widget> | 307 | </widget> |
308 | <connections> | ||
309 | <connection> | ||
310 | <sender>Add_TB</sender> | ||
311 | <signal>clicked()</signal> | ||
312 | <receiver>BluetoothRFCOMM_FRM</receiver> | ||
313 | <slot>SLOT_AddServer()</slot> | ||
314 | </connection> | ||
315 | <connection> | ||
316 | <sender>Remove_TB</sender> | ||
317 | <signal>clicked()</signal> | ||
318 | <receiver>BluetoothRFCOMM_FRM</receiver> | ||
319 | <slot>SLOT_RemoveServer()</slot> | ||
320 | </connection> | ||
321 | <connection> | ||
322 | <sender>FindDevice_TB</sender> | ||
323 | <signal>clicked()</signal> | ||
324 | <receiver>BluetoothRFCOMM_FRM</receiver> | ||
325 | <slot>SLOT_FindDevice()</slot> | ||
326 | </connection> | ||
327 | <slot access="public">SLOT_AddServer()</slot> | ||
328 | <slot access="public">SLOT_RemoveServer()</slot> | ||
329 | <slot access="public">SLOT_FindDevice()</slot> | ||
330 | </connections> | ||
131 | </UI> | 331 | </UI> |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp index 7ec8288..d19386e 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.cpp | |||
@@ -2,5 +2,7 @@ | |||
2 | #include "bluetoothRFCOMM_NNI.h" | 2 | #include "bluetoothRFCOMM_NNI.h" |
3 | #include "bluetooth_NN.h" | 3 | #include "bluetoothRFCOMM_NN.h" |
4 | 4 | ||
5 | ABluetoothRFCOMM::ABluetoothRFCOMM( BluetoothRFCOMMNetNode * PNN ) : ANetNodeInstance( PNN ) { | 5 | ABluetoothRFCOMM::ABluetoothRFCOMM( BluetoothRFCOMMNetNode * PNN ) : |
6 | ANetNodeInstance( PNN ), Data() { | ||
7 | Data.Devices.setAutoDelete( TRUE ); | ||
6 | GUI = 0; | 8 | GUI = 0; |
@@ -9,6 +11,23 @@ ABluetoothRFCOMM::ABluetoothRFCOMM( BluetoothRFCOMMNetNode * PNN ) : ANetNodeIns | |||
9 | 11 | ||
10 | void ABluetoothRFCOMM::setSpecificAttribute( QString & , QString & ) { | 12 | void ABluetoothRFCOMM::setSpecificAttribute( QString & A, QString & V) { |
13 | |||
14 | if( A == "bdaddress" ) { | ||
15 | Data.Devices.resize( Data.Devices.size() + 1 ); | ||
16 | Data.Devices.insert( Data.Devices.size() - 1, new RFCOMMChannel); | ||
17 | Data.Devices[ Data.Devices.size() - 1 ]->BDAddress = V; | ||
18 | } else if ( A == "channel" ) { | ||
19 | Data.Devices[ Data.Devices.size() - 1 ]->Channel = V.toLong(); | ||
20 | } else if ( A == "name" ) { | ||
21 | Data.Devices[ Data.Devices.size() - 1 ]->Name = V; | ||
22 | } | ||
11 | } | 23 | } |
12 | 24 | ||
13 | void ABluetoothRFCOMM::saveSpecificAttribute( QTextStream & ) { | 25 | void ABluetoothRFCOMM::saveSpecificAttribute( QTextStream & TS ) { |
26 | for( unsigned int i = 0 ; | ||
27 | i < Data.Devices.count(); | ||
28 | i ++ ) { | ||
29 | TS << "bdaddress=" << Data.Devices[i]->BDAddress << endl; | ||
30 | TS << "name=" << quote( Data.Devices[i]->Name ) << endl; | ||
31 | TS << "channel=" << Data.Devices[i]->Channel << endl; | ||
32 | } | ||
14 | } | 33 | } |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMdata.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMdata.h index 18f0d38..14cfeb0 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMdata.h +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMdata.h | |||
@@ -4,14 +4,18 @@ | |||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qvector.h> | ||
5 | 6 | ||
6 | typedef struct BluetoothRFCOMMData { | 7 | class RFCOMMChannel { |
7 | QString Device; | ||
8 | QString LockFile; | ||
9 | long Speed; | ||
10 | short Parity; | ||
11 | short DataBits; | ||
12 | short StopBits; | ||
13 | bool HardwareControl; | ||
14 | bool SoftwareControl; | ||
15 | 8 | ||
16 | } BluetoothRFCOMMData_t; | 9 | public : |
10 | QString BDAddress; | ||
11 | QString Name; | ||
12 | int Channel; | ||
13 | }; | ||
14 | |||
15 | class BluetoothRFCOMMData { | ||
16 | |||
17 | public : | ||
18 | |||
19 | QVector<RFCOMMChannel> Devices; | ||
20 | }; | ||
17 | 21 | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.cpp index d3ddab4..7cac13f 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.cpp +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.cpp | |||
@@ -1 +1,12 @@ | |||
1 | #include <qlistview.h> | ||
2 | #include <qdialog.h> | ||
3 | #include <qlabel.h> | ||
4 | #include <qlineedit.h> | ||
5 | #include <qtoolbutton.h> | ||
6 | #include <qcheckbox.h> | ||
7 | #include <qspinbox.h> | ||
8 | #include <OTPeer.h> | ||
9 | #include <OTGateway.h> | ||
10 | #include <Opietooth.h> | ||
11 | #include <resources.h> | ||
1 | #include <GUIUtils.h> | 12 | #include <GUIUtils.h> |
@@ -3,5 +14,45 @@ | |||
3 | 14 | ||
15 | using namespace Opietooth2; | ||
16 | |||
17 | class PeerLBI : public QListViewItem { | ||
18 | |||
19 | public : | ||
20 | |||
21 | PeerLBI( OTPeer * P, int Ch, QListView * LV ) : QListViewItem( LV ) { | ||
22 | Peer = P; | ||
23 | Channel = Ch; | ||
24 | |||
25 | setText( 0, (P->name().isEmpty()) ? | ||
26 | P->address().toString() : | ||
27 | P->name() ); | ||
28 | QString S; | ||
29 | S.setNum( Ch ); | ||
30 | setText( 1, S ); | ||
31 | setText( 2, P->address().toString() ); | ||
32 | } | ||
33 | ~PeerLBI( ) { | ||
34 | } | ||
35 | |||
36 | inline int channel( void ) const | ||
37 | { return Channel; } | ||
38 | inline OTPeer * peer( void ) const | ||
39 | { return Peer; } | ||
40 | |||
41 | int Channel; | ||
42 | OTPeer * Peer; | ||
43 | }; | ||
44 | |||
4 | BluetoothRFCOMMEdit::BluetoothRFCOMMEdit( QWidget * Parent ) : | 45 | BluetoothRFCOMMEdit::BluetoothRFCOMMEdit( QWidget * Parent ) : |
5 | BluetoothRFCOMMGUI( Parent ){ | 46 | BluetoothRFCOMMGUI( Parent ){ |
47 | Modified = 0; | ||
48 | OT = OTGateway::getOTGateway(); | ||
49 | |||
50 | Add_TB->setPixmap( NSResources->getPixmap( "add" ) ); | ||
51 | Remove_TB->setPixmap( NSResources->getPixmap( "remove" ) ); | ||
52 | FindDevice_TB->setPixmap( NSResources->getPixmap( "Devices/bluetooth" ) ); | ||
53 | Addresses_LV->setColumnAlignment( 1, Qt::AlignRight ); | ||
54 | } | ||
6 | 55 | ||
56 | BluetoothRFCOMMEdit::~BluetoothRFCOMMEdit( void ) { | ||
57 | OTGateway::releaseOTGateway(); | ||
7 | } | 58 | } |
@@ -12,7 +63,94 @@ QString BluetoothRFCOMMEdit::acceptable( void ) { | |||
12 | 63 | ||
64 | bool BluetoothRFCOMMEdit::commit( BluetoothRFCOMMData & Data ) { | ||
65 | int ct = 0; | ||
66 | PeerLBI * I; | ||
67 | |||
68 | if( Modified ) { | ||
69 | QListViewItem * it = Addresses_LV->firstChild(); | ||
70 | |||
71 | Data.Devices.resize( 0 ); | ||
72 | while( it ) { | ||
73 | |||
74 | ct ++; | ||
75 | Data.Devices.resize( ct ); | ||
76 | I = (PeerLBI * )it; | ||
77 | |||
78 | Data.Devices.insert( ct-1, new RFCOMMChannel ); | ||
79 | |||
80 | Data.Devices[ct-1]->BDAddress = I->peer()->address().toString(); | ||
81 | Data.Devices[ct-1]->Name = I->peer()->name(); | ||
82 | Data.Devices[ct-1]->Channel = I->channel(); | ||
83 | |||
84 | it = it->nextSibling(); | ||
85 | } | ||
86 | } | ||
87 | |||
88 | return Modified; | ||
89 | } | ||
90 | |||
13 | void BluetoothRFCOMMEdit::showData( BluetoothRFCOMMData & Data ) { | 91 | void BluetoothRFCOMMEdit::showData( BluetoothRFCOMMData & Data ) { |
92 | |||
93 | OTPeer * P; | ||
94 | |||
95 | for( unsigned int i = 0; | ||
96 | i < Data.Devices.count(); | ||
97 | i ++ ) { | ||
98 | P = new OTPeer( OT ); | ||
99 | P->setAddress( OTDeviceAddress( Data.Devices[i]->BDAddress ) ); | ||
100 | P->setName( Data.Devices[i]->Name ); | ||
101 | |||
102 | new PeerLBI( P, Data.Devices[i]->Channel, Addresses_LV ); | ||
103 | } | ||
104 | Modified = 0; | ||
14 | } | 105 | } |
15 | 106 | ||
16 | bool BluetoothRFCOMMEdit::commit( BluetoothRFCOMMData & Data ) { | 107 | void BluetoothRFCOMMEdit::SLOT_AddServer( void ) { |
17 | return 0; | 108 | QListViewItem * it = Addresses_LV->firstChild(); |
109 | |||
110 | while( it ) { | ||
111 | // check address | ||
112 | if( it->text(2) == Address_LE->text() ) { | ||
113 | // already in table | ||
114 | return; | ||
115 | } | ||
116 | it = it->nextSibling(); | ||
117 | } | ||
118 | |||
119 | // new server | ||
120 | Modified = 1; | ||
121 | OTPeer * P = new OTPeer( OT ); | ||
122 | P->setAddress( OTDeviceAddress( Address_LE->text() ) ); | ||
123 | P->setName( Name_LBL->text() ); | ||
124 | new PeerLBI( P, Channel_SB->value(), Addresses_LV ); | ||
125 | |||
126 | Address_LE->setText(""); | ||
127 | Name_LBL->setText(""); | ||
128 | Channel_SB->setValue(1); | ||
129 | } | ||
130 | |||
131 | void BluetoothRFCOMMEdit::SLOT_RemoveServer( void ) { | ||
132 | |||
133 | QListViewItem * it = Addresses_LV->firstChild(); | ||
134 | |||
135 | while( it ) { | ||
136 | // check address | ||
137 | if( it->isSelected() ) { | ||
138 | delete it; | ||
139 | Modified = 1; | ||
140 | return; | ||
141 | } | ||
142 | it = it->nextSibling(); | ||
143 | } | ||
144 | } | ||
145 | |||
146 | void BluetoothRFCOMMEdit::SLOT_FindDevice( void ) { | ||
147 | OTPeer * Peer; | ||
148 | int Channel; | ||
149 | |||
150 | // find device in Opietooth | ||
151 | if( OTScan::getDevice( Peer, Channel, OT ) == QDialog::Accepted ) { | ||
152 | Address_LE->setText( Peer->address().toString() ); | ||
153 | Name_LBL->setText( Peer->name() ); | ||
154 | Channel_SB->setValue( Channel ); | ||
155 | } | ||
18 | } | 156 | } |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h index 14a6d64..9ad8f2a 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMedit.h | |||
@@ -3,2 +3,5 @@ | |||
3 | 3 | ||
4 | #include <Opietooth.h> | ||
5 | using namespace Opietooth2; | ||
6 | |||
4 | class BluetoothRFCOMMEdit : public BluetoothRFCOMMGUI { | 7 | class BluetoothRFCOMMEdit : public BluetoothRFCOMMGUI { |
@@ -8,2 +11,3 @@ public : | |||
8 | BluetoothRFCOMMEdit( QWidget * parent ); | 11 | BluetoothRFCOMMEdit( QWidget * parent ); |
12 | virtual ~BluetoothRFCOMMEdit( void ); | ||
9 | 13 | ||
@@ -12,2 +16,12 @@ public : | |||
12 | bool commit( BluetoothRFCOMMData & Data ); | 16 | bool commit( BluetoothRFCOMMData & Data ); |
17 | |||
18 | bool Modified; | ||
19 | OTGateway * OT; | ||
20 | |||
21 | public slots : | ||
22 | |||
23 | void SLOT_AddServer( void ); | ||
24 | void SLOT_RemoveServer( void ); | ||
25 | void SLOT_FindDevice( void ); | ||
26 | |||
13 | }; | 27 | }; |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h index 65fd686..24e3dae 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h | |||
@@ -1,5 +1,8 @@ | |||
1 | #include <asline.h> | 1 | #include <netnode.h> |
2 | #include "bluetoothRFCOMMdata.h" | 2 | #include "bluetoothRFCOMMdata.h" |
3 | 3 | ||
4 | class BluetoothRFCOMMRun : public AsLine { | 4 | #include <OTGateway.h> |
5 | using namespace Opietooth2; | ||
6 | |||
7 | class BluetoothRFCOMMRun : public RuntimeInfo { | ||
5 | 8 | ||
@@ -8,10 +11,11 @@ public : | |||
8 | BluetoothRFCOMMRun( ANetNodeInstance * NNI, | 11 | BluetoothRFCOMMRun( ANetNodeInstance * NNI, |
9 | BluetoothRFCOMMData & Data ) : AsLine( NNI ) | 12 | BluetoothRFCOMMData & D ) : RuntimeInfo( NNI ) |
10 | { } | 13 | { DeviceNr = -1; Data = &D; OT = 0; } |
14 | virtual ~BluetoothRFCOMMRun( void ); | ||
11 | 15 | ||
12 | virtual AsLine * asLine( void ) | 16 | virtual RuntimeInfo * line( void ) |
13 | { return (AsLine *)this; } | 17 | { return this; } |
18 | virtual QString deviceFile( void ); | ||
14 | 19 | ||
15 | virtual QString deviceFile( void ) | 20 | State_t detectState( void ); |
16 | { return QString( "/dev/rfcomm..." ); } | ||
17 | 21 | ||
@@ -19,10 +23,11 @@ protected : | |||
19 | 23 | ||
20 | void detectState( NodeCollection * ) | 24 | QString setMyState( NodeCollection * , Action_t, bool ); |
21 | { } | ||
22 | 25 | ||
23 | bool setState( NodeCollection * , Action_t, bool ) | 26 | private : |
24 | { return 0; } | ||
25 | 27 | ||
26 | bool canSetState( State_t , Action_t ) | 28 | int deviceNrOfConnection( void ); |
27 | { return 0; } | 29 | RFCOMMChannel * getChannel( void ); |
30 | BluetoothRFCOMMData * Data; | ||
31 | Opietooth2::OTGateway * OT; | ||
32 | int DeviceNr; // cached from detection | ||
28 | }; | 33 | }; |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp index 443a627..9be6b16 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp +++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp | |||
@@ -14,2 +14,7 @@ static const char * BluetoothBNEPNeeds[] = | |||
14 | 14 | ||
15 | static const char * BluetoothBNEPProvides[] = | ||
16 | { "device", | ||
17 | 0 | ||
18 | }; | ||
19 | |||
15 | /** | 20 | /** |
@@ -44,4 +49,4 @@ const char ** BluetoothBNEPNetNode::needs( void ) { | |||
44 | 49 | ||
45 | const char * BluetoothBNEPNetNode::provides( void ) { | 50 | const char ** BluetoothBNEPNetNode::provides( void ) { |
46 | return "device"; | 51 | return BluetoothBNEPProvides; |
47 | } | 52 | } |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h index 4d6a3c1..b93342e 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h +++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h | |||
@@ -24,3 +24,3 @@ public: | |||
24 | virtual ANetNodeInstance * createInstance( void ); | 24 | virtual ANetNodeInstance * createInstance( void ); |
25 | virtual const char * provides( void ); | 25 | virtual const char ** provides( void ); |
26 | virtual const char ** needs( void ); | 26 | virtual const char ** needs( void ); |
diff --git a/noncore/settings/networksettings2/bluetooth/config.in b/noncore/settings/networksettings2/bluetooth/config.in index 6968ac8..398cff1 100644 --- a/noncore/settings/networksettings2/bluetooth/config.in +++ b/noncore/settings/networksettings2/bluetooth/config.in | |||
@@ -3,2 +3,2 @@ | |||
3 | default "n" if NS2 | 3 | default "n" if NS2 |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2CORE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && NS2CORE && NS2OPIETOOTH |
diff --git a/noncore/settings/networksettings2/bluetooth/opie-networksettings2plugin-bluetooth.control b/noncore/settings/networksettings2/bluetooth/opie-networksettings2plugin-bluetooth.control index ea77bd7..c4d29f2 100644 --- a/noncore/settings/networksettings2/bluetooth/opie-networksettings2plugin-bluetooth.control +++ b/noncore/settings/networksettings2/bluetooth/opie-networksettings2plugin-bluetooth.control | |||
@@ -1,2 +1,2 @@ | |||
1 | Package: opie-networksettingsplugin2-bluetooth | 1 | Package: opie-networksettings2plugin-bluetooth |
2 | Files: plugins/networksettings2/libbluetooth.so* | 2 | Files: plugins/networksettings2/libbluetooth.so* |
@@ -6,3 +6,3 @@ Maintainer: Wim Delvaux <wimpie@handhelds.org> | |||
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: opie-networksettings2, libopiecore2, libopienet2 | 7 | Depends: opie-networksettings2, libopietooth2, libopiecore2, libopienet2 |
8 | Description: Network settings bluetooth plugin. | 8 | Description: Network settings bluetooth plugin. |