summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-03-07 22:55:36 (UTC)
committer harlekin <harlekin>2003-03-07 22:55:36 (UTC)
commitee1d48a9a5f3672f329301a844e69f2e184afcac (patch) (unidiff)
treea549cd37f837e2704527b7b40a0f9f8ef9372a7b
parenteeb28ead6d3050d662783696661d9360a049104f (diff)
downloadopie-ee1d48a9a5f3672f329301a844e69f2e184afcac.zip
opie-ee1d48a9a5f3672f329301a844e69f2e184afcac.tar.gz
opie-ee1d48a9a5f3672f329301a844e69f2e184afcac.tar.bz2
show signal strength for connections
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/lib/manager.cc33
-rw-r--r--noncore/net/opietooth/lib/manager.h7
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp40
-rw-r--r--noncore/net/opietooth/manager/bluebase.h5
-rw-r--r--noncore/net/opietooth/manager/bluetoothbase.ui14
-rw-r--r--noncore/net/opietooth/manager/btconnectionitem.cpp18
-rw-r--r--noncore/net/opietooth/manager/btconnectionitem.h8
7 files changed, 119 insertions, 6 deletions
diff --git a/noncore/net/opietooth/lib/manager.cc b/noncore/net/opietooth/lib/manager.cc
index 8ddcfe8..c89d325 100644
--- a/noncore/net/opietooth/lib/manager.cc
+++ b/noncore/net/opietooth/lib/manager.cc
@@ -1,303 +1,334 @@
1 1
2 2
3#include <opie/oprocess.h> 3#include <opie/oprocess.h>
4 4
5#include "parser.h" 5#include "parser.h"
6#include "manager.h" 6#include "manager.h"
7 7
8 8
9using namespace OpieTooth; 9using namespace OpieTooth;
10 10
11Manager::Manager( const QString& dev ) 11Manager::Manager( const QString& dev )
12 : QObject() 12 : QObject()
13{ 13{
14 qWarning("created"); 14 qWarning("created");
15 m_device = dev; 15 m_device = dev;
16 m_hcitool = 0; 16 m_hcitool = 0;
17 m_sdp = 0; 17 m_sdp = 0;
18} 18}
19Manager::Manager( Device* /*dev*/ ) 19Manager::Manager( Device* /*dev*/ )
20 : QObject() 20 : QObject()
21{ 21{
22 m_hcitool = 0; 22 m_hcitool = 0;
23 m_sdp = 0; 23 m_sdp = 0;
24} 24}
25Manager::Manager() 25Manager::Manager()
26 : QObject() 26 : QObject()
27{ 27{
28 m_hcitool = 0; 28 m_hcitool = 0;
29 m_sdp = 0; 29 m_sdp = 0;
30} 30}
31Manager::~Manager(){ 31Manager::~Manager(){
32 delete m_hcitool; 32 delete m_hcitool;
33 delete m_sdp; 33 delete m_sdp;
34} 34}
35void Manager::setDevice( const QString& dev ){ 35void Manager::setDevice( const QString& dev ){
36 m_device = dev; 36 m_device = dev;
37} 37}
38void Manager::setDevice( Device* /*dev*/ ){ 38void Manager::setDevice( Device* /*dev*/ ){
39 39
40} 40}
41void Manager::isAvailable( const QString& device ){ 41void Manager::isAvailable( const QString& device ){
42 OProcess* l2ping = new OProcess(); 42 OProcess* l2ping = new OProcess();
43 l2ping->setName( device.latin1() ); 43 l2ping->setName( device.latin1() );
44 *l2ping << "l2ping" << "-c1" << device; 44 *l2ping << "l2ping" << "-c1" << device;
45 connect(l2ping, SIGNAL(processExited(OProcess* ) ), 45 connect(l2ping, SIGNAL(processExited(OProcess* ) ),
46 this, SLOT(slotProcessExited(OProcess*) ) ); 46 this, SLOT(slotProcessExited(OProcess*) ) );
47 if (!l2ping->start() ) { 47 if (!l2ping->start() ) {
48 emit available( device, false ); 48 emit available( device, false );
49 delete l2ping; 49 delete l2ping;
50 } 50 }
51 51
52} 52}
53 53
54void Manager::isAvailable( Device* /*dev*/ ){ 54void Manager::isAvailable( Device* /*dev*/ ){
55 55
56 56
57} 57}
58void Manager::searchDevices( const QString& device ){ 58void Manager::searchDevices( const QString& device ){
59 qWarning("search devices"); 59 qWarning("search devices");
60 OProcess* hcitool = new OProcess(); 60 OProcess* hcitool = new OProcess();
61 hcitool->setName( device.isEmpty() ? "hci0" : device.latin1() ); 61 hcitool->setName( device.isEmpty() ? "hci0" : device.latin1() );
62 *hcitool << "hcitool" << "scan"; 62 *hcitool << "hcitool" << "scan";
63 connect( hcitool, SIGNAL(processExited(OProcess*) ) , 63 connect( hcitool, SIGNAL(processExited(OProcess*) ) ,
64 this, SLOT(slotHCIExited(OProcess* ) ) ); 64 this, SLOT(slotHCIExited(OProcess* ) ) );
65 connect( hcitool, SIGNAL(receivedStdout(OProcess*, char*, int ) ), 65 connect( hcitool, SIGNAL(receivedStdout(OProcess*, char*, int ) ),
66 this, SLOT(slotHCIOut(OProcess*, char*, int ) ) ); 66 this, SLOT(slotHCIOut(OProcess*, char*, int ) ) );
67 if (!hcitool->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { 67 if (!hcitool->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
68 qWarning("could not start"); 68 qWarning("could not start");
69 RemoteDevice::ValueList list; 69 RemoteDevice::ValueList list;
70 emit foundDevices( device, list ); 70 emit foundDevices( device, list );
71 delete hcitool; 71 delete hcitool;
72 } 72 }
73} 73}
74 74
75void Manager::searchDevices(Device* /*d*/ ){ 75void Manager::searchDevices(Device* /*d*/ ){
76 76
77 77
78} 78}
79void Manager::addService(const QString& name ){ 79void Manager::addService(const QString& name ){
80 OProcess proc; 80 OProcess proc;
81 proc << "sdptool" << "add" << name; 81 proc << "sdptool" << "add" << name;
82 bool bo = true; 82 bool bo = true;
83 if (!proc.start(OProcess::DontCare ) ) 83 if (!proc.start(OProcess::DontCare ) )
84 bo = false; 84 bo = false;
85 emit addedService( name, bo ); 85 emit addedService( name, bo );
86} 86}
87void Manager::addServices(const QStringList& list){ 87void Manager::addServices(const QStringList& list){
88 QStringList::ConstIterator it; 88 QStringList::ConstIterator it;
89 for (it = list.begin(); it != list.end(); ++it ) 89 for (it = list.begin(); it != list.end(); ++it )
90 addService( (*it) ); 90 addService( (*it) );
91} 91}
92void Manager::removeService( const QString& name ){ 92void Manager::removeService( const QString& name ){
93 OProcess prc; 93 OProcess prc;
94 prc << "sdptool" << "del" << name; 94 prc << "sdptool" << "del" << name;
95 bool bo = true; 95 bool bo = true;
96 if (!prc.start(OProcess::DontCare ) ) 96 if (!prc.start(OProcess::DontCare ) )
97 bo = false; 97 bo = false;
98 emit removedService( name, bo ); 98 emit removedService( name, bo );
99} 99}
100void Manager::removeServices( const QStringList& list){ 100void Manager::removeServices( const QStringList& list){
101 QStringList::ConstIterator it; 101 QStringList::ConstIterator it;
102 for (it = list.begin(); it != list.end(); ++it ) 102 for (it = list.begin(); it != list.end(); ++it )
103 removeService( (*it) ); 103 removeService( (*it) );
104} 104}
105void Manager::searchServices( const QString& remDevice ){ 105void Manager::searchServices( const QString& remDevice ){
106 OProcess *m_sdp =new OProcess(); 106 OProcess *m_sdp =new OProcess();
107 *m_sdp << "sdptool" << "browse" << remDevice; 107 *m_sdp << "sdptool" << "browse" << remDevice;
108 m_sdp->setName( remDevice.latin1() ); 108 m_sdp->setName( remDevice.latin1() );
109 qWarning("search Services for %s", remDevice.latin1() ); 109 qWarning("search Services for %s", remDevice.latin1() );
110 connect(m_sdp, SIGNAL(processExited(OProcess*) ), 110 connect(m_sdp, SIGNAL(processExited(OProcess*) ),
111 this, SLOT(slotSDPExited(OProcess* ) ) ); 111 this, SLOT(slotSDPExited(OProcess* ) ) );
112 connect(m_sdp, SIGNAL(receivedStdout(OProcess*, char*, int ) ), 112 connect(m_sdp, SIGNAL(receivedStdout(OProcess*, char*, int ) ),
113 this, SLOT(slotSDPOut(OProcess*, char*, int) ) ); 113 this, SLOT(slotSDPOut(OProcess*, char*, int) ) );
114 if (!m_sdp->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { 114 if (!m_sdp->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
115 qWarning("could not start sdptool" ); 115 qWarning("could not start sdptool" );
116 delete m_sdp; 116 delete m_sdp;
117 Services::ValueList list; 117 Services::ValueList list;
118 emit foundServices( remDevice, list ); 118 emit foundServices( remDevice, list );
119 } 119 }
120} 120}
121void Manager::searchServices( const RemoteDevice& dev){ 121void Manager::searchServices( const RemoteDevice& dev){
122 searchServices( dev.mac() ); 122 searchServices( dev.mac() );
123} 123}
124QString Manager::toDevice( const QString& /*mac*/ ){ 124QString Manager::toDevice( const QString& /*mac*/ ){
125 return QString::null; 125 return QString::null;
126} 126}
127QString Manager::toMac( const QString &/*device*/ ){ 127QString Manager::toMac( const QString &/*device*/ ){
128 return QString::null; 128 return QString::null;
129} 129}
130void Manager::slotProcessExited(OProcess* proc ) { 130void Manager::slotProcessExited(OProcess* proc ) {
131 bool conn= false; 131 bool conn= false;
132 if (proc->normalExit() && proc->exitStatus() == 0 ) 132 if (proc->normalExit() && proc->exitStatus() == 0 )
133 conn = true; 133 conn = true;
134 134
135 QString name = QString::fromLatin1(proc->name() ); 135 QString name = QString::fromLatin1(proc->name() );
136 emit available( name, conn ); 136 emit available( name, conn );
137 delete proc; 137 delete proc;
138} 138}
139void Manager::slotSDPOut(OProcess* proc, char* ch, int len) 139void Manager::slotSDPOut(OProcess* proc, char* ch, int len)
140{ 140{
141 QCString str(ch, len+1 ); 141 QCString str(ch, len+1 );
142 qWarning("SDP:%s", str.data() ); 142 qWarning("SDP:%s", str.data() );
143 QMap<QString, QString>::Iterator it; 143 QMap<QString, QString>::Iterator it;
144 it = m_out.find(proc->name() ); 144 it = m_out.find(proc->name() );
145 QString string; 145 QString string;
146 if ( it != m_out.end() ) { 146 if ( it != m_out.end() ) {
147 string = it.data(); 147 string = it.data();
148 } 148 }
149 string.append( str ); 149 string.append( str );
150 m_out.replace( proc->name(), string ); 150 m_out.replace( proc->name(), string );
151 151
152} 152}
153void Manager::slotSDPExited( OProcess* proc) 153void Manager::slotSDPExited( OProcess* proc)
154{ 154{
155 qWarning("proc name %s", proc->name() ); 155 qWarning("proc name %s", proc->name() );
156 Services::ValueList list; 156 Services::ValueList list;
157 if (proc->normalExit() ) { 157 if (proc->normalExit() ) {
158 QMap<QString, QString>::Iterator it = m_out.find( proc->name() ); 158 QMap<QString, QString>::Iterator it = m_out.find( proc->name() );
159 if ( it != m_out.end() ) { 159 if ( it != m_out.end() ) {
160 qWarning("found process" ); 160 qWarning("found process" );
161 list = parseSDPOutput( it.data() ); 161 list = parseSDPOutput( it.data() );
162 m_out.remove( it ); 162 m_out.remove( it );
163 } 163 }
164 } 164 }
165 emit foundServices( proc->name(), list ); 165 emit foundServices( proc->name(), list );
166 delete proc; 166 delete proc;
167} 167}
168Services::ValueList Manager::parseSDPOutput( const QString& out ) { 168Services::ValueList Manager::parseSDPOutput( const QString& out ) {
169 Services::ValueList list; 169 Services::ValueList list;
170 qWarning("parsing output" ); 170 qWarning("parsing output" );
171 Parser parser( out ); 171 Parser parser( out );
172 list = parser.services(); 172 list = parser.services();
173 return list; 173 return list;
174} 174}
175 175
176void Manager::slotHCIExited(OProcess* proc ) { 176void Manager::slotHCIExited(OProcess* proc ) {
177 qWarning("process exited"); 177 qWarning("process exited");
178 RemoteDevice::ValueList list; 178 RemoteDevice::ValueList list;
179 if (proc->normalExit() ) { 179 if (proc->normalExit() ) {
180 qWarning("normalExit %s", proc->name() ); 180 qWarning("normalExit %s", proc->name() );
181 QMap<QString, QString>::Iterator it = m_devices.find(proc->name() ); 181 QMap<QString, QString>::Iterator it = m_devices.find(proc->name() );
182 if (it != m_devices.end() ) { 182 if (it != m_devices.end() ) {
183 qWarning("!= end ;)"); 183 qWarning("!= end ;)");
184 list = parseHCIOutput( it.data() ); 184 list = parseHCIOutput( it.data() );
185 m_devices.remove( it ); 185 m_devices.remove( it );
186 } 186 }
187 } 187 }
188 emit foundDevices( proc->name(), list ); 188 emit foundDevices( proc->name(), list );
189 delete proc; 189 delete proc;
190} 190}
191void Manager::slotHCIOut(OProcess* proc, char* ch, int len) { 191void Manager::slotHCIOut(OProcess* proc, char* ch, int len) {
192 QCString str( ch, len+1 ); 192 QCString str( ch, len+1 );
193 qWarning("hci: %s", str.data() ); 193 qWarning("hci: %s", str.data() );
194 QMap<QString, QString>::Iterator it; 194 QMap<QString, QString>::Iterator it;
195 it = m_devices.find( proc->name() ); 195 it = m_devices.find( proc->name() );
196 qWarning("proc->name %s", proc->name() ); 196 qWarning("proc->name %s", proc->name() );
197 QString string; 197 QString string;
198 if (it != m_devices.end() ) { 198 if (it != m_devices.end() ) {
199 qWarning("slotHCIOut "); 199 qWarning("slotHCIOut ");
200 string = it.data(); 200 string = it.data();
201 } 201 }
202 string.append( str ); 202 string.append( str );
203 203
204 m_devices.replace( proc->name(), string ); 204 m_devices.replace( proc->name(), string );
205} 205}
206RemoteDevice::ValueList Manager::parseHCIOutput(const QString& output ) { 206RemoteDevice::ValueList Manager::parseHCIOutput(const QString& output ) {
207 qWarning("parseHCI %s", output.latin1() ); 207 qWarning("parseHCI %s", output.latin1() );
208 RemoteDevice::ValueList list; 208 RemoteDevice::ValueList list;
209 QStringList strList = QStringList::split('\n', output ); 209 QStringList strList = QStringList::split('\n', output );
210 QStringList::Iterator it; 210 QStringList::Iterator it;
211 QString str; 211 QString str;
212 for ( it = strList.begin(); it != strList.end(); ++it ) { 212 for ( it = strList.begin(); it != strList.end(); ++it ) {
213 str = (*it).stripWhiteSpace(); 213 str = (*it).stripWhiteSpace();
214 qWarning("OpieTooth %s", str.latin1() ); 214 qWarning("OpieTooth %s", str.latin1() );
215 int pos = str.findRev(':' ); 215 int pos = str.findRev(':' );
216 if ( pos > 0 ) { 216 if ( pos > 0 ) {
217 QString mac = str.left(17 ); 217 QString mac = str.left(17 );
218 str.remove( 0, 17 ); 218 str.remove( 0, 17 );
219 qWarning("mac %s", mac.latin1() ); 219 qWarning("mac %s", mac.latin1() );
220 qWarning("rest:%s", str.latin1() ); 220 qWarning("rest:%s", str.latin1() );
221 RemoteDevice rem( mac , str.stripWhiteSpace() ); 221 RemoteDevice rem( mac , str.stripWhiteSpace() );
222 list.append( rem ); 222 list.append( rem );
223 } 223 }
224 } 224 }
225 return list; 225 return list;
226} 226}
227 227
228////// hcitool cc and hcitool con 228////// hcitool cc and hcitool con
229 229
230/** 230/**
231 * Create it on the stack as don't care 231 * Create it on the stack as don't care
232 * so we don't need to care for it 232 * so we don't need to care for it
233 * cause hcitool gets reparented 233 * cause hcitool gets reparented
234 */ 234 */
235void Manager::connectTo( const QString& mac) { 235void Manager::connectTo( const QString& mac) {
236 OProcess proc; 236 OProcess proc;
237 proc << "hcitool"; 237 proc << "hcitool";
238 proc << "cc"; 238 proc << "cc";
239 proc << mac; 239 proc << mac;
240 proc.start(OProcess::DontCare); // the lib does not care at this point 240 proc.start(OProcess::DontCare); // the lib does not care at this point
241} 241}
242 242
243 243
244void Manager::searchConnections() { 244void Manager::searchConnections() {
245 qWarning("searching connections?"); 245 qWarning("searching connections?");
246 OProcess* proc = new OProcess(); 246 OProcess* proc = new OProcess();
247 m_hcitoolCon = QString::null; 247 m_hcitoolCon = QString::null;
248 248
249 connect(proc, SIGNAL(processExited(OProcess*) ), 249 connect(proc, SIGNAL(processExited(OProcess*) ),
250 this, SLOT(slotConnectionExited( OProcess*) ) ); 250 this, SLOT(slotConnectionExited( OProcess*) ) );
251 connect(proc, SIGNAL(receivedStdout(OProcess*, char*, int) ), 251 connect(proc, SIGNAL(receivedStdout(OProcess*, char*, int) ),
252 this, SLOT(slotConnectionOutput(OProcess*, char*, int) ) ); 252 this, SLOT(slotConnectionOutput(OProcess*, char*, int) ) );
253 *proc << "hcitool"; 253 *proc << "hcitool";
254 *proc << "con"; 254 *proc << "con";
255 255
256 if (!proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { 256 if (!proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
257 ConnectionState::ValueList list; 257 ConnectionState::ValueList list;
258 emit connections( list ); 258 emit connections( list );
259 delete proc; 259 delete proc;
260 } 260 }
261} 261}
262void Manager::slotConnectionExited( OProcess* proc ) { 262void Manager::slotConnectionExited( OProcess* proc ) {
263 qWarning("<<<<<<<<<<<<<<<<<exited");
264 ConnectionState::ValueList list; 263 ConnectionState::ValueList list;
265 list = parseConnections( m_hcitoolCon ); 264 list = parseConnections( m_hcitoolCon );
266 emit connections(list ); 265 emit connections(list );
267 delete proc; 266 delete proc;
268} 267}
269void Manager::slotConnectionOutput(OProcess* /*proc*/, char* cha, int len) { 268void Manager::slotConnectionOutput(OProcess* /*proc*/, char* cha, int len) {
270 QCString str(cha, len ); 269 QCString str(cha, len );
271 m_hcitoolCon.append( str ); 270 m_hcitoolCon.append( str );
272 //delete proc; 271 //delete proc;
273} 272}
274ConnectionState::ValueList Manager::parseConnections( const QString& out ) { 273ConnectionState::ValueList Manager::parseConnections( const QString& out ) {
275 ConnectionState::ValueList list2; 274 ConnectionState::ValueList list2;
276 QStringList list = QStringList::split('\n', out ); 275 QStringList list = QStringList::split('\n', out );
277 QStringList::Iterator it; 276 QStringList::Iterator it;
278 // remove the first line ( "Connections:") 277 // remove the first line ( "Connections:")
279 it = list.begin(); 278 it = list.begin();
280 it = list.remove( it ); 279 it = list.remove( it );
281 for (; it != list.end(); ++it ) { 280 for (; it != list.end(); ++it ) {
282 QString row = (*it).stripWhiteSpace(); 281 QString row = (*it).stripWhiteSpace();
283 QStringList value = QStringList::split(' ', row ); 282 QStringList value = QStringList::split(' ', row );
284 qWarning("0: %s", value[0].latin1() ); 283 qWarning("0: %s", value[0].latin1() );
285 qWarning("1: %s", value[1].latin1() ); 284 qWarning("1: %s", value[1].latin1() );
286 qWarning("2: %s", value[2].latin1() ); 285 qWarning("2: %s", value[2].latin1() );
287 qWarning("3: %s", value[3].latin1() ); 286 qWarning("3: %s", value[3].latin1() );
288 qWarning("4: %s", value[4].latin1() ); 287 qWarning("4: %s", value[4].latin1() );
289 qWarning("5: %s", value[5].latin1() ); 288 qWarning("5: %s", value[5].latin1() );
290 qWarning("6: %s", value[6].latin1() ); 289 qWarning("6: %s", value[6].latin1() );
291 qWarning("7: %s", value[7].latin1() ); 290 qWarning("7: %s", value[7].latin1() );
292 qWarning("8: %s", value[8].latin1() ); 291 qWarning("8: %s", value[8].latin1() );
293 ConnectionState con; 292 ConnectionState con;
294 con.setDirection( value[0] == QString::fromLatin1("<") ? Outgoing : Incoming ); 293 con.setDirection( value[0] == QString::fromLatin1("<") ? Outgoing : Incoming );
295 con.setConnectionMode( value[1] ); 294 con.setConnectionMode( value[1] );
296 con.setMac( value[2] ); 295 con.setMac( value[2] );
297 con.setHandle( value[4].toInt() ); 296 con.setHandle( value[4].toInt() );
298 con.setState( value[6].toInt() ); 297 con.setState( value[6].toInt() );
299 con.setLinkMode( value[8] == QString::fromLatin1("MASTER") ? Master : Client ); 298 con.setLinkMode( value[8] == QString::fromLatin1("MASTER") ? Master : Client );
300 list2.append( con ); 299 list2.append( con );
301 } 300 }
302 return list2; 301 return list2;
303} 302}
303
304void Manager::signalStrength( const QString &mac ) {
305
306 OProcess* sig_proc = new OProcess();
307
308 connect(sig_proc, SIGNAL(processExited(OProcess*) ),
309 this, SLOT(slotSignalStrengthExited( OProcess*) ) );
310 connect(sig_proc, SIGNAL(receivedStdout(OProcess*, char*, int) ),
311 this, SLOT(slotSignalStrengthOutput(OProcess*, char*, int) ) );
312 *sig_proc << "hcitool";
313 *sig_proc << "lq";
314 *sig_proc << mac;
315
316 sig_proc->setName( mac.latin1() );
317
318 if (!sig_proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
319 emit signalStrength( mac, "-1" );
320 delete sig_proc;
321 }
322}
323
324void Manager::slotSignalStrengthOutput(OProcess* proc, char* cha, int len) {
325 QCString str(cha, len );
326 QString temp = QString(str).stripWhiteSpace();
327 QStringList value = QStringList::split(' ', temp );
328 emit signalStrength( proc->name(), value[2].latin1() );
329}
330
331
332void Manager::slotSignalStrengthExited( OProcess* proc ) {
333 delete proc;
334}
diff --git a/noncore/net/opietooth/lib/manager.h b/noncore/net/opietooth/lib/manager.h
index 0ebe1b3..abc8ba1 100644
--- a/noncore/net/opietooth/lib/manager.h
+++ b/noncore/net/opietooth/lib/manager.h
@@ -1,166 +1,173 @@
1 1
2#ifndef OpieToothManager_H 2#ifndef OpieToothManager_H
3#define OpieToothManager_H 3#define OpieToothManager_H
4 4
5#include <qobject.h> 5#include <qobject.h>
6#include <qstring.h> 6#include <qstring.h>
7#include <qmap.h> 7#include <qmap.h>
8#include <qvaluelist.h> 8#include <qvaluelist.h>
9 9
10#include "connection.h" 10#include "connection.h"
11#include "remotedevice.h" 11#include "remotedevice.h"
12#include "services.h" 12#include "services.h"
13 13
14class OProcess; 14class OProcess;
15namespace OpieTooth { 15namespace OpieTooth {
16 class Device; 16 class Device;
17 /** Manager manages a blueZ device (hci0 for example) 17 /** Manager manages a blueZ device (hci0 for example)
18 * without Manager you can control the things you 18 * without Manager you can control the things you
19 * could do from command line in a OO and asynchronus 19 * could do from command line in a OO and asynchronus
20 * way. 20 * way.
21 */ 21 */
22 class Manager : public QObject { 22 class Manager : public QObject {
23 Q_OBJECT 23 Q_OBJECT
24 public: 24 public:
25 /** c'tor whichs create a new Manager 25 /** c'tor whichs create a new Manager
26 * @param device is the device to use. Either a mac or blueZ device name 26 * @param device is the device to use. Either a mac or blueZ device name
27 * 27 *
28 */ 28 */
29 Manager( const QString &device ); 29 Manager( const QString &device );
30 30
31 /** c'tor 31 /** c'tor
32 * @param dev The Device to be managed 32 * @param dev The Device to be managed
33 * We don't care of Device so you need to delete it 33 * We don't care of Device so you need to delete it
34 */ 34 */
35 Manager( Device* dev ); 35 Manager( Device* dev );
36 36
37 /** 37 /**
38 * c'tor 38 * c'tor
39 */ 39 */
40 Manager(); 40 Manager();
41 41
42 ~Manager(); 42 ~Manager();
43 43
44 /** Set the manager to control a new device 44 /** Set the manager to control a new device
45 * @param device the new device to control (hci0 ) 45 * @param device the new device to control (hci0 )
46 */ 46 */
47 void setDevice( const QString& device ); 47 void setDevice( const QString& device );
48 48
49 /** 49 /**
50 * Convience functions for setting a new device 50 * Convience functions for setting a new device
51 */ 51 */
52 void setDevice( Device *dev ); 52 void setDevice( Device *dev );
53 53
54 /** 54 /**
55 * Wether or not a device is connected. The function 55 * Wether or not a device is connected. The function
56 * is asynchron 56 * is asynchron
57 * If device is empty it will take the currently managed 57 * If device is empty it will take the currently managed
58 * device and see if it's up 58 * device and see if it's up
59 * for Remote devices it will ping and see. 59 * for Remote devices it will ping and see.
60 * @param either mac or hciX 60 * @param either mac or hciX
61 */ 61 */
62 void isAvailable(const QString& device= QString::null ); 62 void isAvailable(const QString& device= QString::null );
63 63
64 /** 64 /**
65 * same as above 65 * same as above
66 */ 66 */
67 void isAvailable(Device *dev ); 67 void isAvailable(Device *dev );
68 68
69 /** this searchs for devices reachable from the 69 /** this searchs for devices reachable from the
70 * currently managed device 70 * currently managed device
71 * or from device if @param device is not empty 71 * or from device if @param device is not empty
72 */ 72 */
73 void searchDevices(const QString& device= QString::null ); 73 void searchDevices(const QString& device= QString::null );
74 /** same as above 74 /** same as above
75 * 75 *
76 */ 76 */
77 void searchDevices(Device *d ); 77 void searchDevices(Device *d );
78 78
79 /** 79 /**
80 * This will add the service @param name 80 * This will add the service @param name
81 * to the sdpd daemon 81 * to the sdpd daemon
82 * It will start the daemon if necessary 82 * It will start the daemon if necessary
83 */ 83 */
84 void addService(const QString &name ); 84 void addService(const QString &name );
85 85
86 /** 86 /**
87 * This will add the services @param names 87 * This will add the services @param names
88 * to the sdpd daemon 88 * to the sdpd daemon
89 * It will start the daemon if necessary 89 * It will start the daemon if necessary
90 */ 90 */
91 void addServices( const QStringList& names ); 91 void addServices( const QStringList& names );
92 92
93 /** 93 /**
94 * This removes a service from the sdps 94 * This removes a service from the sdps
95 */ 95 */
96 void removeService(const QString &name ); 96 void removeService(const QString &name );
97 97
98 /** 98 /**
99 * Removes a list from the sdpd 99 * Removes a list from the sdpd
100 */ 100 */
101 void removeServices(const QStringList& ); 101 void removeServices(const QStringList& );
102 102
103 /** 103 /**
104 * search for services on a remote device 104 * search for services on a remote device
105 * 105 *
106 */ 106 */
107 void searchServices( const QString& remDevice ); 107 void searchServices( const QString& remDevice );
108 108
109 /** 109 /**
110 * search for services on a remote device 110 * search for services on a remote device
111 */ 111 */
112 void searchServices( const RemoteDevice& ); 112 void searchServices( const RemoteDevice& );
113 113
114 /** 114 /**
115 * Starts to connect to the device 115 * Starts to connect to the device
116 * in @param 116 * in @param
117 */ 117 */
118 void connectTo(const QString& ); 118 void connectTo(const QString& );
119 119
120 /** 120 /**
121 * Searches for active connections 121 * Searches for active connections
122 * the result is emitted with the 122 * the result is emitted with the
123 * connections signal 123 * connections signal
124 */ 124 */
125 void searchConnections(); 125 void searchConnections();
126 126
127 void signalStrength( const QString &mac );
127//// not implemented yet 128//// not implemented yet
128 /*static*/ QString toDevice( const QString& mac ); 129 /*static*/ QString toDevice( const QString& mac );
129 /*static*/ QString toMac( const QString &device ); 130 /*static*/ QString toMac( const QString &device );
130//// not implemented yet over 131//// not implemented yet over
131 132
132 signals: 133 signals:
133 // device either mac or dev name 134 // device either mac or dev name
134 // the first device is the device which you access 135 // the first device is the device which you access
135 void available( const QString& device, bool connected ); 136 void available( const QString& device, bool connected );
136 void addedService( const QString& service, bool added ); 137 void addedService( const QString& service, bool added );
137 void removedService( const QString& service, bool removed ); 138 void removedService( const QString& service, bool removed );
138 void foundServices( const QString& device, Services::ValueList ); 139 void foundServices( const QString& device, Services::ValueList );
139 void foundDevices( const QString& device, RemoteDevice::ValueList ); 140 void foundDevices( const QString& device, RemoteDevice::ValueList );
140 void connections( ConnectionState::ValueList ); 141 void connections( ConnectionState::ValueList );
142 void signalStrength( const QString& mac, const QString& strengh );
141 143
142private slots: 144private slots:
143 void slotProcessExited(OProcess* ); 145 void slotProcessExited(OProcess* );
144 146
145 void slotSDPExited(OProcess*); 147 void slotSDPExited(OProcess*);
146 void slotSDPOut(OProcess*, char*, int); 148 void slotSDPOut(OProcess*, char*, int);
147 149
148 void slotHCIExited(OProcess* ); 150 void slotHCIExited(OProcess* );
149 void slotHCIOut(OProcess*, char*, int ); 151 void slotHCIOut(OProcess*, char*, int );
150 152
151 void slotConnectionExited(OProcess* ); 153 void slotConnectionExited(OProcess* );
152 void slotConnectionOutput(OProcess*, char*, int ); 154 void slotConnectionOutput(OProcess*, char*, int );
155
156 void slotSignalStrengthOutput( OProcess*, char*, int );
157 void slotSignalStrengthExited( OProcess* );
153 private: 158 private:
154 Services::ValueList parseSDPOutput( const QString& ); 159 Services::ValueList parseSDPOutput( const QString& );
155 RemoteDevice::ValueList parseHCIOutput( const QString& ); 160 RemoteDevice::ValueList parseHCIOutput( const QString& );
156 ConnectionState::ValueList parseConnections( const QString& ); 161 ConnectionState::ValueList parseConnections( const QString& );
157 OProcess *m_hcitool; 162 OProcess *m_hcitool;
158 OProcess *m_sdp; // not only one 163 OProcess *m_sdp; // not only one
159 QString m_device; 164 QString m_device;
165 QMap<QString, int> m_signalStrength;
160 QMap<QString, QString> m_out; 166 QMap<QString, QString> m_out;
161 QMap<QString, QString> m_devices; 167 QMap<QString, QString> m_devices;
168 QMap<OProcess*, QString> m_signalMac;
162 QString m_hcitoolCon; 169 QString m_hcitoolCon;
163 }; 170 };
164}; 171};
165 172
166#endif 173#endif
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 8b15c4f..9663b52 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -1,552 +1,584 @@
1/* 1/*
2 * bluebase.cpp * 2 * bluebase.cpp *
3 * --------------------- 3 * ---------------------
4 * 4 *
5 * copyright : (c) 2002 by Maximilian Reiß 5 * copyright : (c) 2002 by Maximilian Reiß
6 * email : max.reiss@gmx.de 6 * email : max.reiss@gmx.de
7 * 7 *
8 */ 8 */
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include "bluebase.h" 18#include "bluebase.h"
19#include "scandialog.h" 19#include "scandialog.h"
20#include "hciconfwrapper.h" 20#include "hciconfwrapper.h"
21#include "devicehandler.h" 21#include "devicehandler.h"
22#include "btconnectionitem.h" 22#include "btconnectionitem.h"
23 23
24#include <remotedevice.h> 24#include <remotedevice.h>
25#include <services.h> 25#include <services.h>
26 26
27#include <stdlib.h> 27#include <stdlib.h>
28 28
29#include <qframe.h> 29#include <qframe.h>
30#include <qlabel.h> 30#include <qlabel.h>
31#include <qpushbutton.h> 31#include <qpushbutton.h>
32#include <qlayout.h> 32#include <qlayout.h>
33#include <qvariant.h> 33#include <qvariant.h>
34#include <qimage.h> 34#include <qimage.h>
35#include <qpixmap.h> 35#include <qpixmap.h>
36#include <qtabwidget.h> 36#include <qtabwidget.h>
37#include <qscrollview.h> 37#include <qscrollview.h>
38#include <qvbox.h> 38#include <qvbox.h>
39#include <qmessagebox.h> 39#include <qmessagebox.h>
40#include <qcheckbox.h> 40#include <qcheckbox.h>
41#include <qlineedit.h> 41#include <qlineedit.h>
42#include <qlistview.h> 42#include <qlistview.h>
43#include <qdir.h> 43#include <qdir.h>
44#include <qpopupmenu.h> 44#include <qpopupmenu.h>
45#include <qtimer.h> 45#include <qtimer.h>
46#include <qlist.h> 46#include <qlist.h>
47 47
48#include <qpe/qpeapplication.h> 48#include <qpe/qpeapplication.h>
49#include <qpe/resource.h> 49#include <qpe/resource.h>
50#include <qpe/config.h> 50#include <qpe/config.h>
51 51
52 52
53using namespace OpieTooth; 53using namespace OpieTooth;
54 54
55BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) 55BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
56 : BluetoothBase( parent, name, fl ) { 56 : BluetoothBase( parent, name, fl ) {
57 57
58 m_localDevice = new Manager( "hci0" ); 58 m_localDevice = new Manager( "hci0" );
59 59
60 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); 60 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) );
61 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); 61 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) );
62 // not good since lib is async 62 // not good since lib is async
63 // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), 63 // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ),
64 // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); 64 // this, SLOT( addServicesToDevice( QListViewItem * ) ) );
65 connect( ListView2, SIGNAL( clicked( QListViewItem* )), 65 connect( ListView2, SIGNAL( clicked( QListViewItem* )),
66 this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); 66 this, SLOT( startServiceActionClicked( QListViewItem* ) ) );
67 connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), 67 connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ),
68 this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) ); 68 this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) );
69 connect( m_localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), 69 connect( m_localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ),
70 this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); 70 this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) );
71 connect( m_localDevice, SIGNAL( available( const QString&, bool ) ), 71 connect( m_localDevice, SIGNAL( available( const QString&, bool ) ),
72 this, SLOT( deviceActive( const QString& , bool ) ) ); 72 this, SLOT( deviceActive( const QString& , bool ) ) );
73 connect( m_localDevice, SIGNAL( connections( ConnectionState::ValueList ) ), 73 connect( m_localDevice, SIGNAL( connections( ConnectionState::ValueList ) ),
74 this, SLOT( addConnectedDevices( ConnectionState::ValueList ) ) ); 74 this, SLOT( addConnectedDevices( ConnectionState::ValueList ) ) );
75 connect( m_localDevice, SIGNAL( signalStrength( const QString&, const QString& ) ),
76 this, SLOT( addSignalStrength( const QString&, const QString& ) ) );
75 77
76 78
77 // let hold be rightButtonClicked() 79 // let hold be rightButtonClicked()
78 QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold); 80 QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold);
79 QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold); 81 QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold);
80 82
81 //Load all icons needed 83 //Load all icons needed
82 m_offPix = Resource::loadPixmap( "opietooth/notconnected" ); 84 m_offPix = Resource::loadPixmap( "opietooth/notconnected" );
83 m_onPix = Resource::loadPixmap( "opietooth/connected" ); 85 m_onPix = Resource::loadPixmap( "opietooth/connected" );
84 m_findPix = Resource::loadPixmap( "opietooth/find" ); 86 m_findPix = Resource::loadPixmap( "opietooth/find" );
85 87
86 QPalette pal = this->palette(); 88 QPalette pal = this->palette();
87 QColor col = pal.color( QPalette::Active, QColorGroup::Background ); 89 QColor col = pal.color( QPalette::Active, QColorGroup::Background );
88 pal.setColor( QPalette::Active, QColorGroup::Button, col ); 90 pal.setColor( QPalette::Active, QColorGroup::Button, col );
89 pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); 91 pal.setColor( QPalette::Inactive, QColorGroup::Button, col );
90 pal.setColor( QPalette::Normal, QColorGroup::Button, col ); 92 pal.setColor( QPalette::Normal, QColorGroup::Button, col );
91 pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); 93 pal.setColor( QPalette::Disabled, QColorGroup::Button, col );
92 this->setPalette( pal ); 94 this->setPalette( pal );
93 95
94 setCaption( tr( "Bluetooth Manager" ) ); 96 setCaption( tr( "Bluetooth Manager" ) );
95 97
96 readConfig(); 98 readConfig();
97 initGui(); 99 initGui();
98 100
99 ListView2->setRootIsDecorated(true); 101 ListView2->setRootIsDecorated(true);
100 102
103
101 writeToHciConfig(); 104 writeToHciConfig();
102 // search conncetions 105 // search conncetions
103 addConnectedDevices(); 106 addConnectedDevices();
107 addSignalStrength();
104 m_iconLoader = new BTIconLoader(); 108 m_iconLoader = new BTIconLoader();
105 readSavedDevices(); 109 readSavedDevices();
106} 110}
107 111
108/** 112/**
109 * Reads all options from the config file 113 * Reads all options from the config file
110 */ 114 */
111void BlueBase::readConfig() { 115void BlueBase::readConfig() {
112 116
113 Config cfg( "bluetoothmanager" ); 117 Config cfg( "bluetoothmanager" );
114 cfg.setGroup( "bluezsettings" ); 118 cfg.setGroup( "bluezsettings" );
115 119
116 m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with 120 m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with
117 m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak 121 m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak
118 m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE ); 122 m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE );
119 m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE ); 123 m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE );
120 m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE ); 124 m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE );
121 m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE ); 125 m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE );
122} 126}
123 127
124/** 128/**
125 * Writes all options to the config file 129 * Writes all options to the config file
126 */ 130 */
127void BlueBase::writeConfig() { 131void BlueBase::writeConfig() {
128 132
129 Config cfg( "bluetoothmanager" ); 133 Config cfg( "bluetoothmanager" );
130 cfg.setGroup( "bluezsettings" ); 134 cfg.setGroup( "bluezsettings" );
131 135
132 cfg.writeEntry( "name" , m_deviceName ); 136 cfg.writeEntry( "name" , m_deviceName );
133 cfg.writeEntryCrypt( "passkey" , m_defaultPasskey ); 137 cfg.writeEntryCrypt( "passkey" , m_defaultPasskey );
134 cfg.writeEntry( "useEncryption" , m_useEncryption ); 138 cfg.writeEntry( "useEncryption" , m_useEncryption );
135 cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); 139 cfg.writeEntry( "enableAuthentification" , m_enableAuthentification );
136 cfg.writeEntry( "enablePagescan" , m_enablePagescan ); 140 cfg.writeEntry( "enablePagescan" , m_enablePagescan );
137 cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); 141 cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan );
138 142
139 writeToHciConfig(); 143 writeToHciConfig();
140} 144}
141 145
142/** 146/**
143 * Modify the hcid.conf file to our needs 147 * Modify the hcid.conf file to our needs
144 */ 148 */
145void BlueBase::writeToHciConfig() { 149void BlueBase::writeToHciConfig() {
146 qWarning("writeToHciConfig"); 150 qWarning("writeToHciConfig");
147 HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); 151 HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" );
148 hciconf.load(); 152 hciconf.load();
149 hciconf.setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); 153 hciconf.setPinHelper( "/bin/QtPalmtop/bin/blue-pin" );
150 hciconf.setName( m_deviceName ); 154 hciconf.setName( m_deviceName );
151 hciconf.setEncrypt( m_useEncryption ); 155 hciconf.setEncrypt( m_useEncryption );
152 hciconf.setAuth( m_enableAuthentification ); 156 hciconf.setAuth( m_enableAuthentification );
153 hciconf.setPscan( m_enablePagescan ); 157 hciconf.setPscan( m_enablePagescan );
154 hciconf.setIscan( m_enableInquiryscan ); 158 hciconf.setIscan( m_enableInquiryscan );
155 hciconf.save(); 159 hciconf.save();
156} 160}
157 161
158 162
159/** 163/**
160 * Read the list of allready known devices 164 * Read the list of allready known devices
161 */ 165 */
162void BlueBase::readSavedDevices() { 166void BlueBase::readSavedDevices() {
163 167
164 QValueList<RemoteDevice> loadedDevices; 168 QValueList<RemoteDevice> loadedDevices;
165 DeviceHandler handler; 169 DeviceHandler handler;
166 loadedDevices = handler.load(); 170 loadedDevices = handler.load();
167 171
168 addSearchedDevices( loadedDevices ); 172 addSearchedDevices( loadedDevices );
169} 173}
170 174
171 175
172/** 176/**
173 * Write the list of allready known devices 177 * Write the list of allready known devices
174 */ 178 */
175void BlueBase::writeSavedDevices() { 179void BlueBase::writeSavedDevices() {
176 QListViewItemIterator it( ListView2 ); 180 QListViewItemIterator it( ListView2 );
177 BTListItem* item; 181 BTListItem* item;
178 BTDeviceItem* device; 182 BTDeviceItem* device;
179 RemoteDevice::ValueList list; 183 RemoteDevice::ValueList list;
180 for ( ; it.current(); ++it ) { 184 for ( ; it.current(); ++it ) {
181 item = (BTListItem*)it.current(); 185 item = (BTListItem*)it.current();
182 if(item->typeId() != BTListItem::Device ) 186 if(item->typeId() != BTListItem::Device )
183 continue; 187 continue;
184 device = (BTDeviceItem*)item; 188 device = (BTDeviceItem*)item;
185 189
186 list.append( device->remoteDevice() ); 190 list.append( device->remoteDevice() );
187 } 191 }
188 /* 192 /*
189 * if not empty save the List through DeviceHandler 193 * if not empty save the List through DeviceHandler
190 */ 194 */
191 if ( list.isEmpty() ) 195 if ( list.isEmpty() )
192 return; 196 return;
193 DeviceHandler handler; 197 DeviceHandler handler;
194 handler.save( list ); 198 handler.save( list );
195} 199}
196 200
197 201
198/** 202/**
199 * Set up the gui 203 * Set up the gui
200 */ 204 */
201void BlueBase::initGui() { 205void BlueBase::initGui() {
202 StatusLabel->setText( status() ); // maybe move it to getStatus() 206 StatusLabel->setText( status() ); // maybe move it to getStatus()
203 cryptCheckBox->setChecked( m_useEncryption ); 207 cryptCheckBox->setChecked( m_useEncryption );
204 authCheckBox->setChecked( m_enableAuthentification ); 208 authCheckBox->setChecked( m_enableAuthentification );
205 pagescanCheckBox->setChecked( m_enablePagescan ); 209 pagescanCheckBox->setChecked( m_enablePagescan );
206 inquiryscanCheckBox->setChecked( m_enableInquiryscan ); 210 inquiryscanCheckBox->setChecked( m_enableInquiryscan );
207 deviceNameLine->setText( m_deviceName ); 211 deviceNameLine->setText( m_deviceName );
208 passkeyLine->setText( m_defaultPasskey ); 212 passkeyLine->setText( m_defaultPasskey );
209 // set info tab 213 // set info tab
210 setInfo(); 214 setInfo();
211} 215}
212 216
213 217
214/** 218/**
215 * Get the status informations and returns it 219 * Get the status informations and returns it
216 * @return QString the status informations gathered 220 * @return QString the status informations gathered
217 */ 221 */
218QString BlueBase::status()const{ 222QString BlueBase::status()const{
219 QString infoString = tr( "<b>Device name : </b> Ipaq" ); 223 QString infoString = tr( "<b>Device name : </b> Ipaq" );
220 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); 224 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" );
221 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); 225 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" );
222 226
223 return (infoString); 227 return (infoString);
224} 228}
225 229
226 230
227/** 231/**
228 * Read the current values from the gui and invoke writeConfig() 232 * Read the current values from the gui and invoke writeConfig()
229 */ 233 */
230void BlueBase::applyConfigChanges() { 234void BlueBase::applyConfigChanges() {
231 m_deviceName = deviceNameLine->text(); 235 m_deviceName = deviceNameLine->text();
232 m_defaultPasskey = passkeyLine->text(); 236 m_defaultPasskey = passkeyLine->text();
233 m_useEncryption = cryptCheckBox->isChecked(); 237 m_useEncryption = cryptCheckBox->isChecked();
234 m_enableAuthentification = authCheckBox->isChecked(); 238 m_enableAuthentification = authCheckBox->isChecked();
235 m_enablePagescan = pagescanCheckBox->isChecked(); 239 m_enablePagescan = pagescanCheckBox->isChecked();
236 m_enableInquiryscan = inquiryscanCheckBox->isChecked(); 240 m_enableInquiryscan = inquiryscanCheckBox->isChecked();
237 241
238 writeConfig(); 242 writeConfig();
239 243
240 QMessageBox::information( this, tr("Test") , tr("Changes were applied.") ); 244 QMessageBox::information( this, tr("Test") , tr("Changes were applied.") );
241} 245}
242 246
243/** 247/**
244 * Add fresh found devices from scan dialog to the listing 248 * Add fresh found devices from scan dialog to the listing
245 * 249 *
246 */ 250 */
247void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) { 251void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) {
248 BTDeviceItem * deviceItem; 252 BTDeviceItem * deviceItem;
249 QValueList<RemoteDevice>::ConstIterator it; 253 QValueList<RemoteDevice>::ConstIterator it;
250 254
251 for( it = newDevices.begin(); it != newDevices.end() ; ++it ) { 255 for( it = newDevices.begin(); it != newDevices.end() ; ++it ) {
252 256
253 if (find( (*it) )) // is already inserted 257 if (find( (*it) )) // is already inserted
254 continue; 258 continue;
255 259
256 deviceItem = new BTDeviceItem( ListView2 , (*it) ); 260 deviceItem = new BTDeviceItem( ListView2 , (*it) );
257 deviceItem->setPixmap( 1, m_findPix ); 261 deviceItem->setPixmap( 1, m_findPix );
258 deviceItem->setExpandable ( true ); 262 deviceItem->setExpandable ( true );
259 263
260 // look if device is avail. atm, async 264 // look if device is avail. atm, async
261 deviceActive( (*it) ); 265 deviceActive( (*it) );
262 266
263 // ggf auch hier? 267 // ggf auch hier?
264 addServicesToDevice( deviceItem ); 268 addServicesToDevice( deviceItem );
265 } 269 }
266} 270}
267 271
268 272
269/** 273/**
270 * Action that is toggled on entrys on click 274 * Action that is toggled on entrys on click
271 */ 275 */
272void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) { 276void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) {
273} 277}
274 278
275 279
276/** 280/**
277 * Action that are toggled on hold (mostly QPopups i guess) 281 * Action that are toggled on hold (mostly QPopups i guess)
278 */ 282 */
279void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) { 283void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) {
280 if (!item ) 284 if (!item )
281 return; 285 return;
282 286
283 QPopupMenu *menu = new QPopupMenu(); 287 QPopupMenu *menu = new QPopupMenu();
284 int ret=0; 288 int ret=0;
285 289
286 if ( ((BTListItem*)item)->type() == "device") { 290 if ( ((BTListItem*)item)->type() == "device") {
287 291
288 QPopupMenu *groups = new QPopupMenu(); 292 QPopupMenu *groups = new QPopupMenu();
289 293
290 menu->insertItem( ((BTDeviceItem*)item)->name(),0 ); 294 menu->insertItem( ((BTDeviceItem*)item)->name(),0 );
291 menu->insertSeparator(1); 295 menu->insertSeparator(1);
292 menu->insertItem( tr("rescan sevices"), 2); 296 menu->insertItem( tr("rescan sevices"), 2);
293 menu->insertItem( tr("to group"), groups , 3); 297 menu->insertItem( tr("to group"), groups , 3);
294 menu->insertItem( tr("delete"), 4); 298 menu->insertItem( tr("delete"), 4);
295 299
296 ret = menu->exec( point , 0); 300 ret = menu->exec( point , 0);
297 301
298 switch(ret) { 302 switch(ret) {
299 case -1: 303 case -1:
300 break; 304 break;
301 case 2: 305 case 2:
302 addServicesToDevice( (BTDeviceItem*)item ); 306 addServicesToDevice( (BTDeviceItem*)item );
303 break; 307 break;
304 308
305 case 4: 309 case 4:
306 // deletes childs too 310 // deletes childs too
307 delete item; 311 delete item;
308 break; 312 break;
309 } 313 }
310 delete groups; 314 delete groups;
311 315
312 } 316 }
313 317
314 /* 318 /*
315 * We got service sensitive PopupMenus in our factory 319 * We got service sensitive PopupMenus in our factory
316 * We will create one through the factory and will insert 320 * We will create one through the factory and will insert
317 * our Separator + ShowInfo into the menu or create a new 321 * our Separator + ShowInfo into the menu or create a new
318 * one if the factory returns 0 322 * one if the factory returns 0
319 * PopupMenu deletion is kind of weird. 323 * PopupMenu deletion is kind of weird.
320 * If escaped( -1 ) or any of our items were chosen we'll 324 * If escaped( -1 ) or any of our items were chosen we'll
321 * delete the PopupMenu otherwise it's the responsibility of 325 * delete the PopupMenu otherwise it's the responsibility of
322 * the PopupMenu to delete itself 326 * the PopupMenu to delete itself
323 * 327 *
324 */ 328 */
325 else if ( ((BTListItem*)item)->type() == "service") { 329 else if ( ((BTListItem*)item)->type() == "service") {
326 BTServiceItem* service = (BTServiceItem*)item; 330 BTServiceItem* service = (BTServiceItem*)item;
327 QMap<int, QString> list = service->services().classIdList(); 331 QMap<int, QString> list = service->services().classIdList();
328 QMap<int, QString>::Iterator it = list.begin(); 332 QMap<int, QString>::Iterator it = list.begin();
329 QPopupMenu *popup =0l; 333 QPopupMenu *popup =0l;
330 if ( it != list.end() ) { 334 if ( it != list.end() ) {
331 qWarning("Searching id %d %s", it.key(), it.data().latin1() ); 335 qWarning("Searching id %d %s", it.key(), it.data().latin1() );
332 popup = m_popHelper.find( it.key() /*1*/, 336 popup = m_popHelper.find( it.key() /*1*/,
333 service->services(), 337 service->services(),
334 (BTDeviceItem*)service->parent() ); 338 (BTDeviceItem*)service->parent() );
335 }else { 339 }else {
336 qWarning("Empty"); 340 qWarning("Empty");
337 } 341 }
338 342
339 if ( popup == 0l ) { 343 if ( popup == 0l ) {
340 qWarning("factory returned 0l"); 344 qWarning("factory returned 0l");
341 popup = new QPopupMenu(); 345 popup = new QPopupMenu();
342 } 346 }
343 int test1 = popup->insertItem( tr("Test1:"), 2); 347 int test1 = popup->insertItem( tr("Test1:"), 2);
344 348
345 ret = popup->exec( point ); 349 ret = popup->exec( point );
346 qWarning("returned from exec() "); 350 qWarning("returned from exec() ");
347 if ( ret == -1 ) { 351 if ( ret == -1 ) {
348 ; 352 ;
349 } else if ( ret == test1 ) { 353 } else if ( ret == test1 ) {
350 ; 354 ;
351 } 355 }
352 delete popup; 356 delete popup;
353 } 357 }
354 delete menu; 358 delete menu;
355} 359}
356 360
357 361
358/** 362/**
359 * Search and display avail. services for a device (on expand from device listing) 363 * Search and display avail. services for a device (on expand from device listing)
360 * @param item the service item returned 364 * @param item the service item returned
361 */ 365 */
362void BlueBase::addServicesToDevice( BTDeviceItem * item ) { 366void BlueBase::addServicesToDevice( BTDeviceItem * item ) {
363 qDebug("addServicesToDevice"); 367 qDebug("addServicesToDevice");
364 // row of mac adress text(3) 368 // row of mac adress text(3)
365 RemoteDevice device = item->remoteDevice(); 369 RemoteDevice device = item->remoteDevice();
366 m_deviceList.insert( item->mac() , item ); 370 m_deviceList.insert( item->mac() , item );
367 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back 371 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back
368 m_localDevice->searchServices( device ); 372 m_localDevice->searchServices( device );
369} 373}
370 374
371 375
372/** 376/**
373 * Overloaded. This one it the one that is connected to the foundServices signal 377 * Overloaded. This one it the one that is
378 ted to the foundServices signal
374 * @param device the mac address of the remote device 379 * @param device the mac address of the remote device
375 * @param servicesList the list with the service the device has. 380 * @param servicesList the list with the service the device has.
376 */ 381 */
377void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { 382void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) {
378 qDebug("fill services list"); 383 qDebug("fill services list");
379 384
380 QMap<QString,BTDeviceItem*>::Iterator it; 385 QMap<QString,BTDeviceItem*>::Iterator it;
381 BTDeviceItem* deviceItem = 0; 386 BTDeviceItem* deviceItem = 0;
382 387
383 // get the right devices which requested the search 388 // get the right devices which requested the search
384 it = m_deviceList.find( device ); 389 it = m_deviceList.find( device );
385 if( it == m_deviceList.end() ) 390 if( it == m_deviceList.end() )
386 return; 391 return;
387 deviceItem = it.data(); 392 deviceItem = it.data();
388 393
389 // remove previous entries 394 // remove previous entries
390 QList<QListViewItem> tempList; 395 QList<QListViewItem> tempList;
391 tempList.setAutoDelete( true ); 396 tempList.setAutoDelete( true );
392 QListViewItem * child = deviceItem->firstChild(); 397 QListViewItem * child = deviceItem->firstChild();
393 while( child ) { 398 while( child ) {
394 tempList.append( child ); 399 tempList.append( child );
395 child = child->nextSibling(); 400 child = child->nextSibling();
396 } 401 }
397 tempList.clear(); 402 tempList.clear();
398 403
399 QValueList<OpieTooth::Services>::Iterator it2; 404 QValueList<OpieTooth::Services>::Iterator it2;
400 BTServiceItem* serviceItem; 405 BTServiceItem* serviceItem;
401 406
402 407
403 if (!servicesList.isEmpty() ) { 408 if (!servicesList.isEmpty() ) {
404 // add services 409 // add services
405 QMap<int, QString> list; 410 QMap<int, QString> list;
406 QMap<int, QString>::Iterator classIt; 411 QMap<int, QString>::Iterator classIt;
407 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { 412 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) {
408 serviceItem = new BTServiceItem( deviceItem, (*it2) ); 413 serviceItem = new BTServiceItem( deviceItem, (*it2) );
409 list = (*it2).classIdList(); 414 list = (*it2).classIdList();
410 classIt = list.begin(); 415 classIt = list.begin();
411 int classId=0; 416 int classId=0;
412 if ( classIt != list.end() ) { 417 if ( classIt != list.end() ) {
413 classId = classIt.key(); 418 classId = classIt.key();
414 } 419 }
415 420
416 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) ); 421 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) );
417 } 422 }
418 } else { 423 } else {
419 Services s1; 424 Services s1;
420 s1.setServiceName( tr("no services found") ); 425 s1.setServiceName( tr("no services found") );
421 serviceItem = new BTServiceItem( deviceItem, s1 ); 426 serviceItem = new BTServiceItem( deviceItem, s1 );
422 } 427 }
423 // now remove them from the list 428 // now remove them from the list
424 m_deviceList.remove( it ); 429 m_deviceList.remove( it );
425} 430}
426 431
427 432
433
434
435
436void BlueBase::addSignalStrength() {
437
438 QListViewItemIterator it( ListView4 );
439 for ( ; it.current(); ++it ) {
440 m_localDevice->signalStrength( ((BTConnectionItem*)it.current() )->connection().mac() );
441 }
442
443 QTimer::singleShot( 5000, this, SLOT( addSignalStrength() ) );
444}
445
446void BlueBase::addSignalStrength( const QString& mac, const QString& strength ) {
447
448 QListViewItemIterator it( ListView4 );
449 for ( ; it.current(); ++it ) {
450 if( ((BTConnectionItem*)it.current())->connection().mac() == mac ) {
451 ((BTConnectionItem*)it.current() )->setSignalStrength( strength );
452 }
453 }
454}
455
428/** 456/**
429 * Add the existing connections (pairs) to the connections tab. 457 * Add the existing connections (pairs) to the connections tab.
430 * This one triggers the search 458 * This one triggers the search
431 */ 459 */
432void BlueBase::addConnectedDevices() { 460void BlueBase::addConnectedDevices() {
433 m_localDevice->searchConnections(); 461 m_localDevice->searchConnections();
434} 462}
435 463
436
437/** 464/**
438 * This adds the found connections to the connection tab. 465 * This adds the found connections to the connection tab.
439 * @param connectionList the ValueList with all current connections 466 * @param connectionList the ValueList with all current connections
440 */ 467 */
441void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) { 468void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) {
442 469
443 // clear the ListView first 470 // clear the ListView first
444 ListView4->clear(); 471 ListView4->clear();
445 472
446 QValueList<OpieTooth::ConnectionState>::Iterator it; 473 QValueList<OpieTooth::ConnectionState>::Iterator it;
447 BTConnectionItem * connectionItem; 474 BTConnectionItem * connectionItem;
448 475
449 if ( !connectionList.isEmpty() ) { 476 if ( !connectionList.isEmpty() ) {
450 477
451 for (it = connectionList.begin(); it != connectionList.end(); ++it) { 478 for (it = connectionList.begin(); it != connectionList.end(); ++it) {
452 connectionItem = new BTConnectionItem( ListView4 , (*it) ); 479 connectionItem = new BTConnectionItem( ListView4, (*it) );
453 } 480
481 if( m_deviceList.find((*it).mac()).data() ) {
482
483 connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() );
484 }
485 }
454 } else { 486 } else {
455 ConnectionState con; 487 ConnectionState con;
456 con.setMac( tr("No connections found") ); 488 con.setMac( tr("No connections found") );
457 connectionItem = new BTConnectionItem( ListView4 , con ); 489 connectionItem = new BTConnectionItem( ListView4 , con );
458 } 490 }
459 491
460 // recall connection search after some time 492 // recall connection search after some time
461 QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) ); 493 QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) );
462} 494}
463 495
464 496
465/** 497/**
466 * Find out if a device can currently be reached 498 * Find out if a device can currently be reached
467 * @param device 499 * @param device
468 */ 500 */
469void BlueBase::deviceActive( const RemoteDevice &device ) { 501void BlueBase::deviceActive( const RemoteDevice &device ) {
470 // search by mac, async, gets a signal back 502 // search by mac, async, gets a signal back
471 // We should have a BTDeviceItem there or where does it get added to the map -zecke 503 // We should have a BTDeviceItem there or where does it get added to the map -zecke
472 m_localDevice->isAvailable( device.mac() ); 504 m_localDevice->isAvailable( device.mac() );
473} 505}
474 506
475 507
476/** 508/**
477 * The signal catcher. Set the avail. status on device. 509 * The signal catcher. Set the avail. status on device.
478 * @param device - the mac address 510 * @param device - the mac address
479 * @param connected - if it is avail. or not 511 * @param connected - if it is avail. or not
480 */ 512 */
481void BlueBase::deviceActive( const QString& device, bool connected ) { 513void BlueBase::deviceActive( const QString& device, bool connected ) {
482 qDebug("deviceActive slot"); 514 qDebug("deviceActive slot");
483 515
484 QMap<QString,BTDeviceItem*>::Iterator it; 516 QMap<QString,BTDeviceItem*>::Iterator it;
485 517
486 it = m_deviceList.find( device ); 518 it = m_deviceList.find( device );
487 if( it == m_deviceList.end() ) 519 if( it == m_deviceList.end() )
488 return; 520 return;
489 521
490 BTDeviceItem* deviceItem = it.data(); 522 BTDeviceItem* deviceItem = it.data();
491 523
492 524
493 if ( connected ) { 525 if ( connected ) {
494 deviceItem->setPixmap( 1, m_onPix ); 526 deviceItem->setPixmap( 1, m_onPix );
495 } else { 527 } else {
496 deviceItem->setPixmap( 1, m_offPix ); 528 deviceItem->setPixmap( 1, m_offPix );
497 } 529 }
498 m_deviceList.remove( it ); 530 m_deviceList.remove( it );
499} 531}
500 532
501 533
502/** 534/**
503 * Open the "scan for devices" dialog 535 * Open the "scan for devices" dialog
504 */ 536 */
505void BlueBase::startScan() { 537void BlueBase::startScan() {
506 ScanDialog *scan = new ScanDialog( this, "ScanDialog", 538 ScanDialog *scan = new ScanDialog( this, "ScanDialog",
507 true, WDestructiveClose ); 539 true, WDestructiveClose );
508 QObject::connect( scan, SIGNAL( selectedDevices( const QValueList<RemoteDevice>& ) ), 540 QObject::connect( scan, SIGNAL( selectedDevices( const QValueList<RemoteDevice>& ) ),
509 this, SLOT( addSearchedDevices( const QValueList<RemoteDevice>& ) ) ); 541 this, SLOT( addSearchedDevices( const QValueList<RemoteDevice>& ) ) );
510 542
511 scan->showMaximized(); 543 scan->showMaximized();
512} 544}
513 545
514 546
515/** 547/**
516 * Set the informations about the local device in information Tab 548 * Set the informations about the local device in information Tab
517 */ 549 */
518void BlueBase::setInfo() { 550void BlueBase::setInfo() {
519 StatusLabel->setText( status() ); 551 StatusLabel->setText( status() );
520} 552}
521 553
522 554
523/** 555/**
524 * Decontructor 556 * Decontructor
525 */ 557 */
526BlueBase::~BlueBase() { 558BlueBase::~BlueBase() {
527 writeSavedDevices(); 559 writeSavedDevices();
528 delete m_iconLoader; 560 delete m_iconLoader;
529} 561}
530 562
531 563
532/** 564/**
533 * find searches the ListView for a BTDeviceItem containig 565 * find searches the ListView for a BTDeviceItem containig
534 * the same Device if found return true else false 566 * the same Device if found return true else false
535 * @param dev RemoteDevice to find 567 * @param dev RemoteDevice to find
536 * @return returns true if found 568 * @return returns true if found
537 */ 569 */
538bool BlueBase::find( const RemoteDevice& rem ) { 570bool BlueBase::find( const RemoteDevice& rem ) {
539 QListViewItemIterator it( ListView2 ); 571 QListViewItemIterator it( ListView2 );
540 BTListItem* item; 572 BTListItem* item;
541 BTDeviceItem* device; 573 BTDeviceItem* device;
542 for (; it.current(); ++it ) { 574 for (; it.current(); ++it ) {
543 item = (BTListItem*) it.current(); 575 item = (BTListItem*) it.current();
544 if ( item->typeId() != BTListItem::Device ) 576 if ( item->typeId() != BTListItem::Device )
545 continue; 577 continue;
546 578
547 device = (BTDeviceItem*)item; 579 device = (BTDeviceItem*)item;
548 if ( rem.equals( device->remoteDevice() ) ) 580 if ( rem.equals( device->remoteDevice() ) )
549 return true; 581 return true;
550 } 582 }
551 return false; // not found 583 return false; // not found
552} 584}
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h
index 0326daf..743062c 100644
--- a/noncore/net/opietooth/manager/bluebase.h
+++ b/noncore/net/opietooth/manager/bluebase.h
@@ -1,92 +1,97 @@
1 1
2#ifndef BLUEBASE_H 2#ifndef BLUEBASE_H
3#define BLUEBASE_H 3#define BLUEBASE_H
4 4
5#include <qvariant.h> 5#include <qvariant.h>
6#include <qwidget.h> 6#include <qwidget.h>
7#include <qscrollview.h> 7#include <qscrollview.h>
8#include <qsplitter.h> 8#include <qsplitter.h>
9#include <qlist.h> 9#include <qlist.h>
10#include <qpixmap.h> 10#include <qpixmap.h>
11 11
12#include "bluetoothbase.h" 12#include "bluetoothbase.h"
13 13
14#include "btserviceitem.h" 14#include "btserviceitem.h"
15#include "btdeviceitem.h" 15#include "btdeviceitem.h"
16
16#include "popuphelper.h" 17#include "popuphelper.h"
17 18
18#include "bticonloader.h" 19#include "bticonloader.h"
19 20
20#include <remotedevice.h> 21#include <remotedevice.h>
21#include <manager.h> 22#include <manager.h>
22 23
23class QVBox; 24class QVBox;
24class QHBoxLayout; 25class QHBoxLayout;
25class QGridLayout; 26class QGridLayout;
26class QFrame; 27class QFrame;
27class QLabel; 28class QLabel;
28class QPushButton; 29class QPushButton;
29class QTabWidget; 30class QTabWidget;
30class QCheckBox; 31class QCheckBox;
32class BTConnectionItem;
31 33
32 34
33namespace OpieTooth { 35namespace OpieTooth {
34 36
35 class BlueBase : public BluetoothBase { 37 class BlueBase : public BluetoothBase {
36 Q_OBJECT 38 Q_OBJECT
37 39
38 public: 40 public:
39 BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 41 BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
40 ~BlueBase(); 42 ~BlueBase();
41 43
42 protected: 44 protected:
43 45
44 46
45 private slots: 47 private slots:
46 void startScan(); 48 void startScan();
47 49
48 private: 50 private:
49 bool find( const RemoteDevice& device ); 51 bool find( const RemoteDevice& device );
50 void readConfig(); 52 void readConfig();
51 void writeConfig(); 53 void writeConfig();
52 void readSavedDevices(); 54 void readSavedDevices();
53 void writeSavedDevices(); 55 void writeSavedDevices();
54 void writeToHciConfig(); 56 void writeToHciConfig();
55 QString status()const; 57 QString status()const;
56 void initGui(); 58 void initGui();
57 void setInfo(); 59 void setInfo();
60
58 PopupHelper m_popHelper; 61 PopupHelper m_popHelper;
59 Manager *m_localDevice; 62 Manager *m_localDevice;
60 QMap<QString,BTDeviceItem*> m_deviceList; 63 QMap<QString,BTDeviceItem*> m_deviceList;
61 64
62 void deviceActive( const RemoteDevice &device ); 65 void deviceActive( const RemoteDevice &device );
63 66
64 QString m_deviceName; 67 QString m_deviceName;
65 QString m_defaultPasskey; 68 QString m_defaultPasskey;
66 bool m_useEncryption; 69 bool m_useEncryption;
67 bool m_enableAuthentification; 70 bool m_enableAuthentification;
68 bool m_enablePagescan; 71 bool m_enablePagescan;
69 bool m_enableInquiryscan; 72 bool m_enableInquiryscan;
70 73
71 QPixmap m_offPix; 74 QPixmap m_offPix;
72 QPixmap m_onPix; 75 QPixmap m_onPix;
73 QPixmap m_findPix; 76 QPixmap m_findPix;
74 77
75 BTIconLoader *m_iconLoader; 78 BTIconLoader *m_iconLoader;
76 79
77 private slots: 80 private slots:
78 void addSearchedDevices( const QValueList<RemoteDevice> &newDevices ); 81 void addSearchedDevices( const QValueList<RemoteDevice> &newDevices );
79 void addServicesToDevice( BTDeviceItem *item ); 82 void addServicesToDevice( BTDeviceItem *item );
80 void addServicesToDevice( const QString& device, Services::ValueList ); 83 void addServicesToDevice( const QString& device, Services::ValueList );
81 void addConnectedDevices(); 84 void addConnectedDevices();
82 void addConnectedDevices( ConnectionState::ValueList ); 85 void addConnectedDevices( ConnectionState::ValueList );
83 void startServiceActionClicked( QListViewItem *item ); 86 void startServiceActionClicked( QListViewItem *item );
84 void startServiceActionHold( QListViewItem *, const QPoint &, int ); 87 void startServiceActionHold( QListViewItem *, const QPoint &, int );
85 void deviceActive( const QString& mac, bool connected ); 88 void deviceActive( const QString& mac, bool connected );
86 void applyConfigChanges(); 89 void applyConfigChanges();
90 void addSignalStrength();
91 void addSignalStrength( const QString& mac, const QString& strengh );
87 92
88 }; 93 };
89 94
90} 95}
91 96
92#endif 97#endif
diff --git a/noncore/net/opietooth/manager/bluetoothbase.ui b/noncore/net/opietooth/manager/bluetoothbase.ui
index 869a9cb..b51c8c6 100644
--- a/noncore/net/opietooth/manager/bluetoothbase.ui
+++ b/noncore/net/opietooth/manager/bluetoothbase.ui
@@ -1,426 +1,440 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>BluetoothBase</class> 2<class>BluetoothBase</class>
3<widget> 3<widget>
4 <class>QWidget</class> 4 <class>QWidget</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>BluetoothBase</cstring> 7 <cstring>BluetoothBase</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>228</width> 14 <width>228</width>
15 <height>320</height> 15 <height>320</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>Form1</string> 20 <string>Form1</string>
21 </property> 21 </property>
22 <widget> 22 <widget>
23 <class>QTabWidget</class> 23 <class>QTabWidget</class>
24 <property stdset="1"> 24 <property stdset="1">
25 <name>name</name> 25 <name>name</name>
26 <cstring>Status</cstring> 26 <cstring>Status</cstring>
27 </property> 27 </property>
28 <property stdset="1"> 28 <property stdset="1">
29 <name>geometry</name> 29 <name>geometry</name>
30 <rect> 30 <rect>
31 <x>0</x> 31 <x>0</x>
32 <y>0</y> 32 <y>0</y>
33 <width>260</width> 33 <width>260</width>
34 <height>350</height> 34 <height>350</height>
35 </rect> 35 </rect>
36 </property> 36 </property>
37 <widget> 37 <widget>
38 <class>QWidget</class> 38 <class>QWidget</class>
39 <property stdset="1"> 39 <property stdset="1">
40 <name>name</name> 40 <name>name</name>
41 <cstring>tab</cstring> 41 <cstring>tab</cstring>
42 </property> 42 </property>
43 <attribute> 43 <attribute>
44 <name>title</name> 44 <name>title</name>
45 <string>Devices</string> 45 <string>Devices</string>
46 </attribute> 46 </attribute>
47 <spacer> 47 <spacer>
48 <property> 48 <property>
49 <name>name</name> 49 <name>name</name>
50 <cstring>Spacer3</cstring> 50 <cstring>Spacer3</cstring>
51 </property> 51 </property>
52 <property stdset="1"> 52 <property stdset="1">
53 <name>orientation</name> 53 <name>orientation</name>
54 <enum>Vertical</enum> 54 <enum>Vertical</enum>
55 </property> 55 </property>
56 <property stdset="1"> 56 <property stdset="1">
57 <name>sizeType</name> 57 <name>sizeType</name>
58 <enum>Expanding</enum> 58 <enum>Expanding</enum>
59 </property> 59 </property>
60 <property> 60 <property>
61 <name>sizeHint</name> 61 <name>sizeHint</name>
62 <size> 62 <size>
63 <width>20</width> 63 <width>20</width>
64 <height>20</height> 64 <height>20</height>
65 </size> 65 </size>
66 </property> 66 </property>
67 </spacer> 67 </spacer>
68 <spacer> 68 <spacer>
69 <property> 69 <property>
70 <name>name</name> 70 <name>name</name>
71 <cstring>Spacer1</cstring> 71 <cstring>Spacer1</cstring>
72 </property> 72 </property>
73 <property stdset="1"> 73 <property stdset="1">
74 <name>orientation</name> 74 <name>orientation</name>
75 <enum>Vertical</enum> 75 <enum>Vertical</enum>
76 </property> 76 </property>
77 <property stdset="1"> 77 <property stdset="1">
78 <name>sizeType</name> 78 <name>sizeType</name>
79 <enum>Fixed</enum> 79 <enum>Fixed</enum>
80 </property> 80 </property>
81 <property> 81 <property>
82 <name>sizeHint</name> 82 <name>sizeHint</name>
83 <size> 83 <size>
84 <width>20</width> 84 <width>20</width>
85 <height>20</height> 85 <height>20</height>
86 </size> 86 </size>
87 </property> 87 </property>
88 </spacer> 88 </spacer>
89 <widget> 89 <widget>
90 <class>QListView</class> 90 <class>QListView</class>
91 <column> 91 <column>
92 <property> 92 <property>
93 <name>text</name> 93 <name>text</name>
94 <string>Device Name</string> 94 <string>Device Name</string>
95 </property> 95 </property>
96 <property> 96 <property>
97 <name>clickable</name> 97 <name>clickable</name>
98 <bool>true</bool> 98 <bool>true</bool>
99 </property> 99 </property>
100 <property> 100 <property>
101 <name>resizeable</name> 101 <name>resizeable</name>
102 <bool>true</bool> 102 <bool>true</bool>
103 </property> 103 </property>
104 </column> 104 </column>
105 <column> 105 <column>
106 <property> 106 <property>
107 <name>text</name> 107 <name>text</name>
108 <string>Online</string> 108 <string>Online</string>
109 </property> 109 </property>
110 <property> 110 <property>
111 <name>clickable</name> 111 <name>clickable</name>
112 <bool>true</bool> 112 <bool>true</bool>
113 </property> 113 </property>
114 <property> 114 <property>
115 <name>resizeable</name> 115 <name>resizeable</name>
116 <bool>true</bool> 116 <bool>true</bool>
117 </property> 117 </property>
118 </column> 118 </column>
119 <property stdset="1"> 119 <property stdset="1">
120 <name>name</name> 120 <name>name</name>
121 <cstring>ListView2</cstring> 121 <cstring>ListView2</cstring>
122 </property> 122 </property>
123 <property stdset="1"> 123 <property stdset="1">
124 <name>geometry</name> 124 <name>geometry</name>
125 <rect> 125 <rect>
126 <x>0</x> 126 <x>0</x>
127 <y>0</y> 127 <y>0</y>
128 <width>230</width> 128 <width>230</width>
129 <height>230</height> 129 <height>230</height>
130 </rect> 130 </rect>
131 </property> 131 </property>
132 </widget> 132 </widget>
133 <widget> 133 <widget>
134 <class>QPushButton</class> 134 <class>QPushButton</class>
135 <property stdset="1"> 135 <property stdset="1">
136 <name>name</name> 136 <name>name</name>
137 <cstring>PushButton2</cstring> 137 <cstring>PushButton2</cstring>
138 </property> 138 </property>
139 <property stdset="1"> 139 <property stdset="1">
140 <name>geometry</name> 140 <name>geometry</name>
141 <rect> 141 <rect>
142 <x>40</x> 142 <x>40</x>
143 <y>231</y> 143 <y>231</y>
144 <width>154</width> 144 <width>154</width>
145 <height>30</height> 145 <height>30</height>
146 </rect> 146 </rect>
147 </property> 147 </property>
148 <property stdset="1"> 148 <property stdset="1">
149 <name>sizePolicy</name> 149 <name>sizePolicy</name>
150 <sizepolicy> 150 <sizepolicy>
151 <hsizetype>0</hsizetype> 151 <hsizetype>0</hsizetype>
152 <vsizetype>0</vsizetype> 152 <vsizetype>0</vsizetype>
153 </sizepolicy> 153 </sizepolicy>
154 </property> 154 </property>
155 <property stdset="1"> 155 <property stdset="1">
156 <name>text</name> 156 <name>text</name>
157 <string>Scan for Devices</string> 157 <string>Scan for Devices</string>
158 </property> 158 </property>
159 </widget> 159 </widget>
160 </widget> 160 </widget>
161 <widget> 161 <widget>
162 <class>QWidget</class> 162 <class>QWidget</class>
163 <property stdset="1"> 163 <property stdset="1">
164 <name>name</name> 164 <name>name</name>
165 <cstring>tab</cstring> 165 <cstring>tab</cstring>
166 </property> 166 </property>
167 <attribute> 167 <attribute>
168 <name>title</name> 168 <name>title</name>
169 <string>Connections</string> 169 <string>Connections</string>
170 </attribute> 170 </attribute>
171 <widget> 171 <widget>
172 <class>QListView</class> 172 <class>QListView</class>
173 <column> 173 <column>
174 <property> 174 <property>
175 <name>text</name> 175 <name>text</name>
176 <string>Device Name</string> 176 <string>Device Name</string>
177 </property> 177 </property>
178 <property> 178 <property>
179 <name>clickable</name> 179 <name>clickable</name>
180 <bool>true</bool> 180 <bool>true</bool>
181 </property> 181 </property>
182 <property> 182 <property>
183 <name>resizeable</name> 183 <name>resizeable</name>
184 <bool>true</bool> 184 <bool>true</bool>
185 </property> 185 </property>
186 </column> 186 </column>
187 <column> 187 <column>
188 <property> 188 <property>
189 <name>text</name> 189 <name>text</name>
190 <string>Connection type</string> 190 <string>Connection type</string>
191 </property> 191 </property>
192 <property> 192 <property>
193 <name>clickable</name> 193 <name>clickable</name>
194 <bool>true</bool> 194 <bool>true</bool>
195 </property> 195 </property>
196 <property> 196 <property>
197 <name>resizeable</name> 197 <name>resizeable</name>
198 <bool>true</bool> 198 <bool>true</bool>
199 </property> 199 </property>
200 </column> 200 </column>
201 <column>
202 <property>
203 <name>text</name>
204 <string>Signal</string>
205 </property>
206 <property>
207 <name>clickable</name>
208 <bool>true</bool>
209 </property>
210 <property>
211 <name>resizeable</name>
212 <bool>true</bool>
213 </property>
214 </column>
201 <property stdset="1"> 215 <property stdset="1">
202 <name>name</name> 216 <name>name</name>
203 <cstring>ListView4</cstring> 217 <cstring>ListView4</cstring>
204 </property> 218 </property>
205 <property stdset="1"> 219 <property stdset="1">
206 <name>geometry</name> 220 <name>geometry</name>
207 <rect> 221 <rect>
208 <x>0</x> 222 <x>0</x>
209 <y>0</y> 223 <y>0</y>
210 <width>240</width> 224 <width>240</width>
211 <height>240</height> 225 <height>240</height>
212 </rect> 226 </rect>
213 </property> 227 </property>
214 </widget> 228 </widget>
215 </widget> 229 </widget>
216 <widget> 230 <widget>
217 <class>QWidget</class> 231 <class>QWidget</class>
218 <property stdset="1"> 232 <property stdset="1">
219 <name>name</name> 233 <name>name</name>
220 <cstring>tab</cstring> 234 <cstring>tab</cstring>
221 </property> 235 </property>
222 <attribute> 236 <attribute>
223 <name>title</name> 237 <name>title</name>
224 <string>Config</string> 238 <string>Config</string>
225 </attribute> 239 </attribute>
226 <widget> 240 <widget>
227 <class>QLabel</class> 241 <class>QLabel</class>
228 <property stdset="1"> 242 <property stdset="1">
229 <name>name</name> 243 <name>name</name>
230 <cstring>deviceNameLabel</cstring> 244 <cstring>deviceNameLabel</cstring>
231 </property> 245 </property>
232 <property stdset="1"> 246 <property stdset="1">
233 <name>geometry</name> 247 <name>geometry</name>
234 <rect> 248 <rect>
235 <x>10</x> 249 <x>10</x>
236 <y>10</y> 250 <y>10</y>
237 <width>70</width> 251 <width>70</width>
238 <height>20</height> 252 <height>20</height>
239 </rect> 253 </rect>
240 </property> 254 </property>
241 <property stdset="1"> 255 <property stdset="1">
242 <name>text</name> 256 <name>text</name>
243 <string>Device Name</string> 257 <string>Device Name</string>
244 </property> 258 </property>
245 </widget> 259 </widget>
246 <widget> 260 <widget>
247 <class>QLabel</class> 261 <class>QLabel</class>
248 <property stdset="1"> 262 <property stdset="1">
249 <name>name</name> 263 <name>name</name>
250 <cstring>passkeyLabel</cstring> 264 <cstring>passkeyLabel</cstring>
251 </property> 265 </property>
252 <property stdset="1"> 266 <property stdset="1">
253 <name>geometry</name> 267 <name>geometry</name>
254 <rect> 268 <rect>
255 <x>10</x> 269 <x>10</x>
256 <y>50</y> 270 <y>50</y>
257 <width>80</width> 271 <width>80</width>
258 <height>20</height> 272 <height>20</height>
259 </rect> 273 </rect>
260 </property> 274 </property>
261 <property stdset="1"> 275 <property stdset="1">
262 <name>text</name> 276 <name>text</name>
263 <string>Default Passkey</string> 277 <string>Default Passkey</string>
264 </property> 278 </property>
265 </widget> 279 </widget>
266 <widget> 280 <widget>
267 <class>QLineEdit</class> 281 <class>QLineEdit</class>
268 <property stdset="1"> 282 <property stdset="1">
269 <name>name</name> 283 <name>name</name>
270 <cstring>passkeyLine</cstring> 284 <cstring>passkeyLine</cstring>
271 </property> 285 </property>
272 <property stdset="1"> 286 <property stdset="1">
273 <name>geometry</name> 287 <name>geometry</name>
274 <rect> 288 <rect>
275 <x>98</x> 289 <x>98</x>
276 <y>53</y> 290 <y>53</y>
277 <width>120</width> 291 <width>120</width>
278 <height>22</height> 292 <height>22</height>
279 </rect> 293 </rect>
280 </property> 294 </property>
281 <property stdset="1"> 295 <property stdset="1">
282 <name>echoMode</name> 296 <name>echoMode</name>
283 <enum>Password</enum> 297 <enum>Password</enum>
284 </property> 298 </property>
285 </widget> 299 </widget>
286 <widget> 300 <widget>
287 <class>QLayoutWidget</class> 301 <class>QLayoutWidget</class>
288 <property stdset="1"> 302 <property stdset="1">
289 <name>name</name> 303 <name>name</name>
290 <cstring>Layout5</cstring> 304 <cstring>Layout5</cstring>
291 </property> 305 </property>
292 <property stdset="1"> 306 <property stdset="1">
293 <name>geometry</name> 307 <name>geometry</name>
294 <rect> 308 <rect>
295 <x>10</x> 309 <x>10</x>
296 <y>100</y> 310 <y>100</y>
297 <width>188</width> 311 <width>188</width>
298 <height>120</height> 312 <height>120</height>
299 </rect> 313 </rect>
300 </property> 314 </property>
301 <vbox> 315 <vbox>
302 <property stdset="1"> 316 <property stdset="1">
303 <name>margin</name> 317 <name>margin</name>
304 <number>0</number> 318 <number>0</number>
305 </property> 319 </property>
306 <property stdset="1"> 320 <property stdset="1">
307 <name>spacing</name> 321 <name>spacing</name>
308 <number>6</number> 322 <number>6</number>
309 </property> 323 </property>
310 <widget> 324 <widget>
311 <class>QCheckBox</class> 325 <class>QCheckBox</class>
312 <property stdset="1"> 326 <property stdset="1">
313 <name>name</name> 327 <name>name</name>
314 <cstring>authCheckBox</cstring> 328 <cstring>authCheckBox</cstring>
315 </property> 329 </property>
316 <property stdset="1"> 330 <property stdset="1">
317 <name>text</name> 331 <name>text</name>
318 <string>enable authentification</string> 332 <string>enable authentification</string>
319 </property> 333 </property>
320 </widget> 334 </widget>
321 <widget> 335 <widget>
322 <class>QCheckBox</class> 336 <class>QCheckBox</class>
323 <property stdset="1"> 337 <property stdset="1">
324 <name>name</name> 338 <name>name</name>
325 <cstring>cryptCheckBox</cstring> 339 <cstring>cryptCheckBox</cstring>
326 </property> 340 </property>
327 <property stdset="1"> 341 <property stdset="1">
328 <name>text</name> 342 <name>text</name>
329 <string>enable encryption</string> 343 <string>enable encryption</string>
330 </property> 344 </property>
331 </widget> 345 </widget>
332 <widget> 346 <widget>
333 <class>QCheckBox</class> 347 <class>QCheckBox</class>
334 <property stdset="1"> 348 <property stdset="1">
335 <name>name</name> 349 <name>name</name>
336 <cstring>pagescanCheckBox</cstring> 350 <cstring>pagescanCheckBox</cstring>
337 </property> 351 </property>
338 <property stdset="1"> 352 <property stdset="1">
339 <name>text</name> 353 <name>text</name>
340 <string>Enable Page scan</string> 354 <string>Enable Page scan</string>
341 </property> 355 </property>
342 </widget> 356 </widget>
343 <widget> 357 <widget>
344 <class>QCheckBox</class> 358 <class>QCheckBox</class>
345 <property stdset="1"> 359 <property stdset="1">
346 <name>name</name> 360 <name>name</name>
347 <cstring>inquiryscanCheckBox</cstring> 361 <cstring>inquiryscanCheckBox</cstring>
348 </property> 362 </property>
349 <property stdset="1"> 363 <property stdset="1">
350 <name>text</name> 364 <name>text</name>
351 <string>Enable Inquiry scan</string> 365 <string>Enable Inquiry scan</string>
352 </property> 366 </property>
353 </widget> 367 </widget>
354 </vbox> 368 </vbox>
355 </widget> 369 </widget>
356 <widget> 370 <widget>
357 <class>QLineEdit</class> 371 <class>QLineEdit</class>
358 <property stdset="1"> 372 <property stdset="1">
359 <name>name</name> 373 <name>name</name>
360 <cstring>deviceNameLine</cstring> 374 <cstring>deviceNameLine</cstring>
361 </property> 375 </property>
362 <property stdset="1"> 376 <property stdset="1">
363 <name>geometry</name> 377 <name>geometry</name>
364 <rect> 378 <rect>
365 <x>98</x> 379 <x>98</x>
366 <y>13</y> 380 <y>13</y>
367 <width>120</width> 381 <width>120</width>
368 <height>22</height> 382 <height>22</height>
369 </rect> 383 </rect>
370 </property> 384 </property>
371 </widget> 385 </widget>
372 <widget> 386 <widget>
373 <class>QPushButton</class> 387 <class>QPushButton</class>
374 <property stdset="1"> 388 <property stdset="1">
375 <name>name</name> 389 <name>name</name>
376 <cstring>configApplyButton</cstring> 390 <cstring>configApplyButton</cstring>
377 </property> 391 </property>
378 <property stdset="1"> 392 <property stdset="1">
379 <name>geometry</name> 393 <name>geometry</name>
380 <rect> 394 <rect>
381 <x>60</x> 395 <x>60</x>
382 <y>230</y> 396 <y>230</y>
383 <width>99</width> 397 <width>99</width>
384 <height>32</height> 398 <height>32</height>
385 </rect> 399 </rect>
386 </property> 400 </property>
387 <property stdset="1"> 401 <property stdset="1">
388 <name>text</name> 402 <name>text</name>
389 <string>Apply</string> 403 <string>Apply</string>
390 </property> 404 </property>
391 </widget> 405 </widget>
392 </widget> 406 </widget>
393 <widget> 407 <widget>
394 <class>QWidget</class> 408 <class>QWidget</class>
395 <property stdset="1"> 409 <property stdset="1">
396 <name>name</name> 410 <name>name</name>
397 <cstring>tab</cstring> 411 <cstring>tab</cstring>
398 </property> 412 </property>
399 <attribute> 413 <attribute>
400 <name>title</name> 414 <name>title</name>
401 <string>Status</string> 415 <string>Status</string>
402 </attribute> 416 </attribute>
403 <widget> 417 <widget>
404 <class>QLabel</class> 418 <class>QLabel</class>
405 <property stdset="1"> 419 <property stdset="1">
406 <name>name</name> 420 <name>name</name>
407 <cstring>StatusLabel</cstring> 421 <cstring>StatusLabel</cstring>
408 </property> 422 </property>
409 <property stdset="1"> 423 <property stdset="1">
410 <name>geometry</name> 424 <name>geometry</name>
411 <rect> 425 <rect>
412 <x>10</x> 426 <x>10</x>
413 <y>10</y> 427 <y>10</y>
414 <width>220</width> 428 <width>220</width>
415 <height>250</height> 429 <height>250</height>
416 </rect> 430 </rect>
417 </property> 431 </property>
418 <property stdset="1"> 432 <property stdset="1">
419 <name>text</name> 433 <name>text</name>
420 <string>Status Label</string> 434 <string>Status Label</string>
421 </property> 435 </property>
422 </widget> 436 </widget>
423 </widget> 437 </widget>
424 </widget> 438 </widget>
425</widget> 439</widget>
426</UI> 440</UI>
diff --git a/noncore/net/opietooth/manager/btconnectionitem.cpp b/noncore/net/opietooth/manager/btconnectionitem.cpp
index b57d1b3..c565c47 100644
--- a/noncore/net/opietooth/manager/btconnectionitem.cpp
+++ b/noncore/net/opietooth/manager/btconnectionitem.cpp
@@ -1,24 +1,42 @@
1#include <connection.h> 1#include <connection.h>
2#include "btconnectionitem.h" 2#include "btconnectionitem.h"
3 3
4using namespace OpieTooth; 4using namespace OpieTooth;
5 5
6BTConnectionItem::BTConnectionItem( QListView* parent, const ConnectionState& con ) 6BTConnectionItem::BTConnectionItem( QListView* parent, const ConnectionState& con )
7 : BTListItem( parent ){ 7 : BTListItem( parent ){
8 m_con = con; 8 m_con = con;
9 setText(0, m_con.mac() ); 9 setText(0, m_con.mac() );
10 setText(1, m_con.connectionMode() ); 10 setText(1, m_con.connectionMode() );
11} 11}
12BTConnectionItem::~BTConnectionItem() { 12BTConnectionItem::~BTConnectionItem() {
13 13
14} 14}
15QString BTConnectionItem::type() const { 15QString BTConnectionItem::type() const {
16 return QString::fromLatin1("connection"); 16 return QString::fromLatin1("connection");
17} 17}
18int BTConnectionItem::typeId() const { 18int BTConnectionItem::typeId() const {
19 return Connection; 19 return Connection;
20} 20}
21ConnectionState BTConnectionItem::connection() const { 21ConnectionState BTConnectionItem::connection() const {
22 return m_con; 22 return m_con;
23} 23}
24 24
25void BTConnectionItem::setName( QString name ) {
26 m_name = name;
27 setText( 0, m_name );
28}
29
30QString BTConnectionItem::name() {
31 return m_name;
32}
33
34
35void BTConnectionItem::setSignalStrength( QString strength ) {
36 m_signalStrength = strength;
37 setText( 2, m_signalStrength );
38}
39
40QString BTConnectionItem::signalStrength() {
41 return m_signalStrength;
42}
diff --git a/noncore/net/opietooth/manager/btconnectionitem.h b/noncore/net/opietooth/manager/btconnectionitem.h
index 3c0cd79..9ab745e 100644
--- a/noncore/net/opietooth/manager/btconnectionitem.h
+++ b/noncore/net/opietooth/manager/btconnectionitem.h
@@ -1,26 +1,32 @@
1 1
2#ifndef OPIE_TOOTH_BT_CONNECTION_ITEM_H 2#ifndef OPIE_TOOTH_BT_CONNECTION_ITEM_H
3#define OPIE_TOOTH_BT_CONNECTION_ITEM_H 3#define OPIE_TOOTH_BT_CONNECTION_ITEM_H
4 4
5 5
6#include "btlistitem.h" 6#include "btlistitem.h"
7 7
8namespace OpieTooth { 8namespace OpieTooth {
9 9
10 class ConnectionState; 10 class ConnectionState;
11 class BTConnectionItem : public BTListItem { 11 class BTConnectionItem : public BTListItem {
12 public: 12 public:
13 BTConnectionItem( QListView* parent, const ConnectionState& state ); 13 BTConnectionItem( QListView* parent, const ConnectionState& state );
14 ~BTConnectionItem(); 14 ~BTConnectionItem();
15 QString type()const; 15 QString type()const;
16 QString name();
17 QString signalStrength();
16 int typeId() const; 18 int typeId() const;
17 ConnectionState connection()const; 19 ConnectionState connection()const;
20 void setSignalStrength( QString );
21 void setName( QString );
22
18 private: 23 private:
19 ConnectionState m_con; 24 ConnectionState m_con;
20 25 QString m_name;
26 QString m_signalStrength;
21 }; 27 };
22 28
23}; 29};
24 30
25 31
26#endif 32#endif