summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/lib/bt-serial.c308
-rw-r--r--noncore/net/opietooth/lib/bt-serial.h57
-rw-r--r--noncore/net/opietooth/lib/forwarder.cc203
-rw-r--r--noncore/net/opietooth/lib/forwarder.h45
-rw-r--r--noncore/net/opietooth/lib/lib.pro6
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp61
-rw-r--r--noncore/net/opietooth/manager/bluebase.h4
-rw-r--r--noncore/net/opietooth/manager/bluetoothbase.ui182
8 files changed, 851 insertions, 15 deletions
diff --git a/noncore/net/opietooth/lib/bt-serial.c b/noncore/net/opietooth/lib/bt-serial.c
new file mode 100644
index 0000000..d1a65a2
--- a/dev/null
+++ b/noncore/net/opietooth/lib/bt-serial.c
@@ -0,0 +1,308 @@
1/* $Id$
2 *Bluetooth serial forwarder functions implementation
3 *
4 *(c) Copyright 2006 GPL
5 *
6 *This software is provided under the GNU public license, incorporated
7 *herein by reference. The software is provided without warranty or
8 *support.
9 */
10#include "bt-serial.h"
11#include <errno.h>
12#include <unistd.h>
13#include <sys/time.h>
14#include <sys/types.h>
15#include <sys/socket.h>
16#include <bluetooth/bluetooth.h>
17#include <bluetooth/rfcomm.h>
18#include <bluetooth/sdp.h>
19#include <bluetooth/sdp_lib.h>
20#include <termios.h>
21#include <sys/stat.h>
22#include <fcntl.h>
23#include <stdio.h>
24
25static int hserv = -1; //Server socket
26sdp_session_t* session = NULL; //session with an SDP server
27
28static sdp_session_t* register_service(uint8_t rfchannel)
29{
30 int err = 0;
31 sdp_profile_desc_t profile[1];
32 uint32_t service_uuid_int[] = { 0, 0, 0, 0xABCD };
33 const char *service_name = "Serial forwarder";
34 const char *service_dsc = "Serial forwarder";
35 const char *service_prov = "OPIE team";
36 uuid_t root_uuid, l2cap_uuid, rfcomm_uuid, svc_uuid, service_uuid;
37 sdp_list_t* l2cap_list = 0;
38 sdp_list_t* rfcomm_list = 0;
39 sdp_list_t* root_list = 0;
40 sdp_list_t* proto_list = 0;
41 sdp_list_t* access_proto_list = 0;
42 sdp_list_t* profile_list = 0;
43 sdp_list_t* service_list = 0;
44 sdp_data_t* channel = 0;
45 sdp_record_t* record = sdp_record_alloc();
46 sdp_session_t* lsession = 0;
47
48 // set the general service ID
49 sdp_uuid128_create(&svc_uuid, &service_uuid_int);
50 sdp_set_service_id(record, svc_uuid);
51 // make the service record publicly browsable
52 sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
53 root_list = sdp_list_append(0, &root_uuid);
54 sdp_set_browse_groups( record, root_list );
55
56 // set l2cap information
57 sdp_uuid16_create(&l2cap_uuid, L2CAP_UUID);
58 l2cap_list = sdp_list_append( 0, &l2cap_uuid );
59 proto_list = sdp_list_append( 0, l2cap_list );
60
61 // set rfcomm information
62 sdp_uuid16_create(&rfcomm_uuid, RFCOMM_UUID);
63 channel = sdp_data_alloc(SDP_UINT8, &rfchannel);
64 rfcomm_list = sdp_list_append( 0, &rfcomm_uuid );
65 sdp_list_append( rfcomm_list, channel );
66 sdp_list_append( proto_list, rfcomm_list );
67
68 // attach protocol information to service record
69 access_proto_list = sdp_list_append( 0, proto_list );
70 sdp_set_access_protos( record, access_proto_list );
71
72 sdp_uuid16_create(&service_uuid, SERIAL_PORT_SVCLASS_ID);
73 service_list = sdp_list_append( 0, &service_uuid );
74 sdp_set_service_classes(record, service_list);
75
76 profile[0].version = 0x0100;
77 sdp_uuid16_create(&profile[0].uuid, SERIAL_PORT_PROFILE_ID);
78 profile_list = sdp_list_append(0, &profile[0]);
79 sdp_set_profile_descs(record, profile_list);
80
81 // set the name, provider, and description
82 sdp_set_info_attr(record, service_name, service_prov, service_dsc);
83
84 // connect to the local SDP server, register the service record, and
85 // disconnect
86 lsession = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, SDP_RETRY_IF_BUSY);
87 if (lsession == NULL)
88 goto errout;
89 err = sdp_record_register(lsession, record, 0);
90 if (err) {
91 sdp_close(lsession);
92 lsession = NULL;
93 }
94errout:
95 // cleanup
96 sdp_data_free( channel );
97 sdp_list_free( l2cap_list, 0 );
98 sdp_list_free( rfcomm_list, 0 );
99 sdp_list_free( root_list, 0 );
100 sdp_list_free( access_proto_list, 0 );
101 sdp_list_free( profile_list, 0 );
102 sdp_list_free( service_list, 0 );
103
104 return lsession;
105}
106
107/*
108 * Function opens and configures serial port
109 * portName - name of the serial port
110 * return 0 on success, -1 on error
111 */
112int openSerial(const char* portName)
113{
114 struct termios tc; //port attributes
115 int hserial = -1; //serial port handler
116 int result; //function call result
117 if ((hserial = open(portName, O_RDWR)) < 0)
118 goto errout;
119 if ((result = tcgetattr(hserial, &tc)) < 0)
120 goto errout;
121 cfmakeraw(&tc);
122 cfsetispeed(&tc, B9600);
123 cfsetospeed(&tc, B9600);
124 if ((result = tcsetattr(hserial, TCSANOW, &tc)) < 0)
125 goto errout;
126 if (result == 0)
127 errno = 0;
128errout:
129 if (errno) {
130 if (hserial >= 0) {
131 close(hserial);
132 hserial = -1;
133 }
134 }
135 return hserial;
136}
137
138/*
139 * bt_serialStart
140 * Function starts bt-serial service
141 * return 0 success -1 on error
142 */
143int bt_serialStart(void)
144{
145 struct sockaddr_rc loc_addr; //server address
146 int i; //just an index variable
147 int result = 0; //function call result
148 if (hserv >= 0)
149 return 0;
150 hserv = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
151 // bind socket to port 1 of the first available
152 // local bluetooth adapter
153 memset(&loc_addr, 0, sizeof(struct sockaddr_rc));
154 loc_addr.rc_family = AF_BLUETOOTH;
155 loc_addr.rc_bdaddr = *BDADDR_ANY;
156 for (i = 1; i < 32; i++) {
157 loc_addr.rc_channel = (uint8_t)i;
158 if (!(result = bind(hserv,
159 (struct sockaddr *)&loc_addr,
160 sizeof(loc_addr))) || errno == EINVAL) {
161 break;
162 }
163 }
164 if (result != 0)
165 goto errout;
166 else
167 errno = 0;
168 if (listen(hserv, 1) < 0)
169 goto errout;
170 session = register_service(loc_addr.rc_channel);
171errout:
172 if (errno) {
173 result = errno;
174 close(hserv);
175 hserv = -1;
176 if (session != NULL)
177 sdp_close(session);
178 errno = result;
179 result = -1;
180 }
181 return result;
182}
183
184/*
185 * bt_serialStop
186 * Function stops bt-serial service
187 * return device handler on success -1 on error
188 */
189int bt_serialStop(void)
190{
191 int result = 0; //Function call result
192
193 if (hserv >= 0) {
194 result = close(hserv);
195 hserv = -1;
196 if (session != NULL)
197 sdp_close(session);
198 }
199 return result;
200}
201
202/*
203 * btWrite
204 * hbt - handler of the BT connection
205 * buf - buffer to write
206 * plen - total length to write (and zero it!!!)
207 * return number of bytes written on success or -1
208 */
209int btWrite(int hbt, uint8_t* buf, int* plen)
210{
211 int result; //Function call result
212 const suseconds_t writeDelay = 100000L; //wait after writing
213 result = write(hbt, buf, *plen);
214#ifdef _DEBUG_
215 printf("ser->bt %d\n", *plen);
216#endif
217 *plen = 0;
218 usleep(writeDelay);
219 return result;
220}
221
222/*
223 * bt_serialForward
224 * Function forwards data received from bt-connection to serial and backward
225 * conn - connection handler
226 * portName - name of the serial port to open
227 * return 0 success -1 on error
228 */
229/*
230 * This function has a hack. My BT adapter hangs if you try to write small
231 * portions of data to it to often. That's why we either wait for big enough
232 * (> wrThresh) portion of data from a serial port and write it to BT or
233 * wait for a timeout (tv).
234 */
235int bt_serialForward(BTSerialConn* conn, const char* portName)
236{
237 int result; //Function call result
238 fd_set inSet; //Set we scan for input
239 uint8_t inBuf[1500]; //buffer we read and write
240 uint8_t outBuf[1500]; //buffer we read and write
241 int outBytes; //bytes to be written to bt
242 int nbytes = 0; //number of bytes we could read
243 int maxfd; //maximal filehandler
244 struct timeval tv; //time we shall wait for select
245 const int wrThresh = 250; //threshold after which we send packet to bt
246 const suseconds_t waitDelay = 200000L; //Time (us) we wait for data
247 struct sockaddr_rc rem_addr; //client address
248 int len = sizeof(rem_addr); //argument length
249
250 if (conn == NULL) {
251 errno = EINVAL;
252 return -1;
253 }
254 memset(&rem_addr, 0, sizeof(struct sockaddr_rc));
255 conn->bt_handler = -1;
256 conn->ser_handler = -1;
257 conn->bt_handler = accept(hserv, (struct sockaddr *)&rem_addr, &len);
258 if (conn->bt_handler < 0)
259 return -1;
260 conn->ser_handler = openSerial(portName);
261 if (conn->ser_handler < 0)
262 return -1;
263#ifdef _DEBUG_
264 printf("Connect!\n");
265#endif
266
267 FD_ZERO(&inSet);
268 maxfd = (conn->bt_handler > conn->ser_handler)? conn->bt_handler:
269 conn->ser_handler;
270 outBytes = 0;
271 do {
272 FD_SET(conn->bt_handler, &inSet);
273 FD_SET(conn->ser_handler, &inSet);
274 tv.tv_sec = 0;
275 tv.tv_usec = waitDelay;
276 result = select(maxfd + 1, &inSet, NULL, NULL, &tv);
277 if (result > 0) {
278 if (FD_ISSET(conn->bt_handler, &inSet)) {
279 if ((nbytes = read(conn->bt_handler, inBuf, sizeof(inBuf))) > 0)
280 result = write(conn->ser_handler, inBuf, nbytes);
281#ifdef _DEBUG_
282 printf("bt->ser %d\n", nbytes);
283#endif
284 }
285 if (FD_ISSET(conn->ser_handler, &inSet)) {
286 if ((nbytes = read(conn->ser_handler,
287 outBuf + outBytes, sizeof(outBuf) - outBytes)) > 0) {
288 outBytes += nbytes;
289 if (outBytes > wrThresh)
290 result = btWrite(conn->bt_handler, outBuf, &outBytes);
291 }
292 }
293 } else if (result == 0) {
294 if (outBytes > 0)
295 result = btWrite(conn->bt_handler, outBuf, &outBytes);
296 }
297 } while (result == 0 || (result > 0 && nbytes > 0));
298 if (nbytes <= 0)
299 result = -1;
300 close(conn->bt_handler);
301 close(conn->ser_handler);
302#ifdef _DEBUG_
303 printf("Disconnect!\n");
304#endif
305 return 0;
306}
307
308//eof
diff --git a/noncore/net/opietooth/lib/bt-serial.h b/noncore/net/opietooth/lib/bt-serial.h
new file mode 100644
index 0000000..737e2a0
--- a/dev/null
+++ b/noncore/net/opietooth/lib/bt-serial.h
@@ -0,0 +1,57 @@
1/* $Id$
2 *Bluetooth serial forwarder functions declaration
3 *
4 *(c) Copyright 2006 GPL
5 *
6 *This software is provided under the GNU public license, incorporated
7 *herein by reference. The software is provided without warranty or
8 *support.
9 */
10#ifndef _BT_SERIAL_H_
11#define _BT_SERIAL_H_
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16typedef struct //bt-serial connection handler
17{
18 int bt_handler; //Bluetooth connection handler
19 int ser_handler; //serial port handler
20} BTSerialConn;
21
22/*
23 * bt_serialStart
24 * Function starts bt-serial service
25 * return 0 success -1 on error
26 */
27int bt_serialStart(void);
28
29/*
30 * bt_serialForward
31 * Function forwards data received from bt-connection to serial and backward
32 * conn - connection handler
33 * portName - name of the port to connect
34 * return 0 success -1 on error
35 */
36int bt_serialForward(BTSerialConn* conn, const char* portName);
37
38/*
39 * bt_serialStop
40 * Function stops bt-serial service
41 * return device handler on success -1 on error
42 */
43int bt_serialStop(void);
44
45/*
46 * Function opens and configures serial port
47 * portName - name of the serial port
48 * return 0 on success, -1 on error
49 */
50int openSerial(const char* portName);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57//eof
diff --git a/noncore/net/opietooth/lib/forwarder.cc b/noncore/net/opietooth/lib/forwarder.cc
new file mode 100644
index 0000000..c38f5b8
--- a/dev/null
+++ b/noncore/net/opietooth/lib/forwarder.cc
@@ -0,0 +1,203 @@
1/* $Id$
2 *Bluetooth serial forwarder class implementation
3 *
4 *(c) Copyright 2006 GPL
5 *
6 *This software is provided under the GNU public license, incorporated
7 *herein by reference. The software is provided without warranty or
8 *support.
9 */
10#include "bt-serial.h"
11#include <sys/types.h>
12#include <sys/wait.h>
13#include <errno.h>
14#include <stdlib.h>
15#include <fcntl.h>
16#include <qapplication.h>
17#include <opie2/oprocctrl.h>
18#include "forwarder.h"
19using namespace OpieTooth;
20using namespace Opie::Core;
21using namespace Opie::Core::Internal;
22
23SerialForwarder::SerialForwarder(QString& devName, int dspeed) :
24 OProcess(), device(devName), speed(dspeed)
25{
26 status = false;
27}
28
29SerialForwarder::~SerialForwarder()
30{
31 stop();
32}
33
34
35bool SerialForwarder::start(RunMode runmode, Communication comm)
36{
37 int htmp; //temporary device
38 int result; //call result
39
40 if ( runs )
41 {
42 return false; // cannot start a process that is already running
43 // or if no executable has been assigned
44 }
45 //First, check if serial device is usable
46 htmp = ::openSerial(device);
47 if (htmp < 0)
48 return false;
49 close(htmp);
50
51 run_mode = runmode;
52 status = 0;
53
54 if(::bt_serialStart() < 0)
55 return false;
56
57 if ( !setupCommunication( comm ) )
58 qWarning( "Could not setup Communication!" );
59
60 // We do this in the parent because if we do it in the child process
61 // gdb gets confused when the application runs from gdb.
62 uid_t uid = getuid();
63 gid_t gid = getgid();
64#ifdef HAVE_INITGROUPS
65
66 struct passwd *pw = getpwuid( uid );
67#endif
68
69 int fd[ 2 ];
70 if ( 0 > pipe( fd ) )
71 {
72 fd[ 0 ] = fd[ 1 ] = 0; // Pipe failed.. continue
73 }
74
75 runs = true;
76
77 QApplication::flushX();
78
79 // WABA: Note that we use fork() and not vfork() because
80 // vfork() has unclear semantics and is not standardized.
81 pid_ = fork();
82
83 if ( 0 == pid_ )
84 {
85 if ( fd[ 0 ] )
86 close( fd[ 0 ] );
87 if ( !runPrivileged() )
88 {
89 setgid( gid );
90#if defined( HAVE_INITGROUPS)
91
92 if ( pw )
93 initgroups( pw->pw_name, pw->pw_gid );
94#endif
95
96 setuid( uid );
97 }
98 // The child process
99 if ( !commSetupDoneC() )
100 qWarning( "Could not finish comm setup in child!" );
101
102 setupEnvironment();
103
104 // Matthias
105 if ( run_mode == DontCare )
106 setpgid( 0, 0 );
107 // restore default SIGPIPE handler (Harri)
108 struct sigaction act;
109 sigemptyset( &( act.sa_mask ) );
110 sigaddset( &( act.sa_mask ), SIGPIPE );
111 act.sa_handler = SIG_DFL;
112 act.sa_flags = 0;
113 sigaction( SIGPIPE, &act, 0L );
114
115 // We set the close on exec flag.
116 // Closing of fd[1] indicates that the execvp succeeded!
117 if ( fd[ 1 ] )
118 fcntl( fd[ 1 ], F_SETFD, FD_CLOEXEC );
119 do {
120 BTSerialConn conn; //Connection handler
121 if ( fd[ 1 ] ) {
122 ::close(fd[1]);
123 fd[1] = 0;
124 }
125 result = ::bt_serialForward(&conn, device);
126 } while(result == 0);
127
128 char resultByte = 1;
129 if ( fd[ 1 ] )
130 write( fd[ 1 ], &resultByte, 1 );
131 _exit( -1 );
132 }
133 else if ( -1 == pid_ )
134 {
135 // forking failed
136
137 runs = false;
138 return false;
139 }
140 else
141 {
142 if ( fd[ 1 ] )
143 close( fd[ 1 ] );
144 // the parent continues here
145
146 // Discard any data for stdin that might still be there
147 input_data = 0;
148
149 // Check whether client could be started.
150 if ( fd[ 0 ] )
151 for ( ;; )
152 {
153 char resultByte;
154 int n = ::read( fd[ 0 ], &resultByte, 1 );
155 if ( n == 1 )
156 {
157 // Error
158 runs = false;
159 close( fd[ 0 ] );
160 pid_ = 0;
161 return false;
162 }
163 if ( n == -1 )
164 {
165 if ( ( errno == ECHILD ) || ( errno == EINTR ) )
166 continue; // Ignore
167 }
168 break; // success
169 }
170 if ( fd[ 0 ] )
171 close( fd[ 0 ] );
172
173 if ( !commSetupDoneP() ) // finish communication socket setup for the parent
174 qWarning( "Could not finish comm setup in parent!" );
175
176 if ( run_mode == Block )
177 {
178 commClose();
179
180 // The SIGCHLD handler of the process controller will catch
181 // the exit and set the status
182 while ( runs )
183 {
184 OProcessController::theOProcessController->
185 slotDoHousekeeping( 0 );
186 }
187 runs = FALSE;
188 emit processExited( this );
189 }
190 }
191 return true;
192}
193
194/*
195 * Stop forwarding process
196 */
197int SerialForwarder::stop()
198{
199 kill(SIGTERM);
200 ::bt_serialStop();
201 return 0;
202}
203//eof
diff --git a/noncore/net/opietooth/lib/forwarder.h b/noncore/net/opietooth/lib/forwarder.h
new file mode 100644
index 0000000..f90ed70
--- a/dev/null
+++ b/noncore/net/opietooth/lib/forwarder.h
@@ -0,0 +1,45 @@
1/* $Id$
2 *Bluetooth serial forwarder class declaration
3 *
4 *(c) Copyright 2006 GPL
5 *
6 *This software is provided under the GNU public license, incorporated
7 *herein by reference. The software is provided without warranty or
8 *support.
9 */
10#ifndef OpieTooth_Forwarder_H
11#define OpieTooth_Forwarder_H
12#include <qobject.h>
13#include <qstring.h>
14#include <unistd.h>
15#include <signal.h>
16#include <opie2/oprocess.h>
17namespace Opie {
18 namespace Core {
19 class OProcess;
20 namespace Internal {
21 class OProcessController;
22 }
23 }
24};
25
26namespace OpieTooth {
27 class SerialForwarder : public Opie::Core::OProcess {
28
29 Q_OBJECT
30
31 protected:
32 QString device; //Name of the device
33 int speed; //device speed to set
34 public:
35 SerialForwarder(QString& devName, int speed);
36 ~SerialForwarder();
37 //Function starts the forwarding process
38 virtual bool start( RunMode runmode = NotifyOnExit,
39 Communication comm = NoCommunication );
40 //Stop the forwarding process
41 int stop();
42 };
43};
44#endif
45//eof
diff --git a/noncore/net/opietooth/lib/lib.pro b/noncore/net/opietooth/lib/lib.pro
index 9d3c14d..781bf15 100644
--- a/noncore/net/opietooth/lib/lib.pro
+++ b/noncore/net/opietooth/lib/lib.pro
@@ -1,10 +1,12 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qte warn_on 2CONFIG += qte warn_on
3 HEADERS = connection.h parser.h device.h manager.h remotedevice.h services.h startpanconnection.h startdunconnection.h 3 HEADERS = connection.h parser.h device.h manager.h remotedevice.h services.h \
4 SOURCES = connection.cpp parser.cc device.cc manager.cc remotedevice.cc services.cc startpanconnection.cpp startdunconnection.cpp 4 startpanconnection.h startdunconnection.h bt-serial.h forwarder.h
5 SOURCES = connection.cpp parser.cc device.cc manager.cc remotedevice.cc services.cc \
6 startpanconnection.cpp startdunconnection.cpp bt-serial.c forwarder.cc
5 TARGET = opietooth1 7 TARGET = opietooth1
6INCLUDEPATH += $(OPIEDIR)/include . 8INCLUDEPATH += $(OPIEDIR)/include .
7 DESTDIR = $(OPIEDIR)/lib 9 DESTDIR = $(OPIEDIR)/lib
8LIBS += -lopiecore2 10LIBS += -lopiecore2
9 11
10include( $(OPIEDIR)/include.pro ) 12include( $(OPIEDIR)/include.pro )
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 0649514..9ec5bf8 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -1,682 +1,743 @@
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#include "rfcommassigndialogimpl.h" 23#include "rfcommassigndialogimpl.h"
24#include "forwarder.h"
25#include <termios.h>
26#include <string.h>
27#include <errno.h>
24 28
25/* OPIE */ 29/* OPIE */
26#include <qpe/qpeapplication.h> 30#include <qpe/qpeapplication.h>
27#include <qpe/resource.h> 31#include <qpe/resource.h>
28#include <qpe/config.h> 32#include <qpe/config.h>
29#include <opie2/odebug.h> 33#include <opie2/odebug.h>
30using namespace Opie::Core; 34using namespace Opie::Core;
31 35
32/* QT */ 36/* QT */
33#include <qframe.h> 37#include <qframe.h>
34#include <qlabel.h> 38#include <qlabel.h>
35#include <qpushbutton.h> 39#include <qpushbutton.h>
36#include <qlayout.h> 40#include <qlayout.h>
37#include <qvariant.h> 41#include <qvariant.h>
38#include <qimage.h> 42#include <qimage.h>
39#include <qpixmap.h> 43#include <qpixmap.h>
40#include <qtabwidget.h> 44#include <qtabwidget.h>
41#include <qscrollview.h> 45#include <qscrollview.h>
42#include <qvbox.h> 46#include <qvbox.h>
43#include <qmessagebox.h> 47#include <qmessagebox.h>
48#include <qcombobox.h>
44#include <qcheckbox.h> 49#include <qcheckbox.h>
45#include <qlineedit.h> 50#include <qlineedit.h>
46#include <qlistview.h> 51#include <qlistview.h>
47#include <qdir.h> 52#include <qdir.h>
48#include <qpopupmenu.h> 53#include <qpopupmenu.h>
49#include <qtimer.h> 54#include <qtimer.h>
50#include <qlist.h> 55#include <qlist.h>
51 56
52/* STD */ 57/* STD */
53#include <remotedevice.h> 58#include <remotedevice.h>
54#include <services.h> 59#include <services.h>
55#include <stdlib.h> 60#include <stdlib.h>
56 61
57using namespace OpieTooth; 62using namespace OpieTooth;
63//Array of possible speeds of the serial port
64struct SerSpeed {
65 const char* str; //string value
66 int val; //value itself
67} speeds[] = {
68 { "150", B150 }, { "300", B300 }, { "600", B600 }, { "1200", B1200 },
69 { "2400", B2400 }, { "4800", B4800 }, { "9600", B9600 },
70 { "19200", B19200 }, { "38400", B38400 }, { "57600", B57600 },
71 { "115200", B115200}
72};
58 73
59BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) 74BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
60 : BluetoothBase( parent, name, fl ) 75 : BluetoothBase( parent, name, fl )
61{ 76{
62 m_localDevice = new Manager( "hci0" ); 77 m_localDevice = new Manager( "hci0" );
63 78
64 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); 79 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) );
65 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); 80 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) );
66 81
67 connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) ); 82 connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) );
68 83
69 connect( devicesView, SIGNAL( clicked(QListViewItem*)), 84 connect( devicesView, SIGNAL( clicked(QListViewItem*)),
70 this, SLOT( startServiceActionClicked(QListViewItem*) ) ); 85 this, SLOT( startServiceActionClicked(QListViewItem*) ) );
71 connect( devicesView, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), 86 connect( devicesView, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ),
72 this, SLOT(startServiceActionHold(QListViewItem*,const QPoint&,int) ) ); 87 this, SLOT(startServiceActionHold(QListViewItem*,const QPoint&,int) ) );
73 connect( m_localDevice , SIGNAL( foundServices(const QString&,Services::ValueList) ), 88 connect( m_localDevice , SIGNAL( foundServices(const QString&,Services::ValueList) ),
74 this, SLOT( addServicesToDevice(const QString&,Services::ValueList) ) ); 89 this, SLOT( addServicesToDevice(const QString&,Services::ValueList) ) );
75 connect( m_localDevice, SIGNAL( available(const QString&,bool) ), 90 connect( m_localDevice, SIGNAL( available(const QString&,bool) ),
76 this, SLOT( deviceActive(const QString&,bool) ) ); 91 this, SLOT( deviceActive(const QString&,bool) ) );
77 connect( m_localDevice, SIGNAL( connections(ConnectionState::ValueList) ), 92 connect( m_localDevice, SIGNAL( connections(ConnectionState::ValueList) ),
78 this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) ); 93 this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) );
79 connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ), 94 connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ),
80 this, SLOT( addSignalStrength(const QString&,const QString&) ) ); 95 this, SLOT( addSignalStrength(const QString&,const QString&) ) );
96 connect(runButton, SIGNAL(clicked()), this, SLOT(doForward()));
81 97
82 // let hold be rightButtonClicked() 98 // let hold be rightButtonClicked()
83 QPEApplication::setStylusOperation( devicesView->viewport(), QPEApplication::RightOnHold); 99 QPEApplication::setStylusOperation( devicesView->viewport(), QPEApplication::RightOnHold);
84 QPEApplication::setStylusOperation( connectionsView->viewport(), QPEApplication::RightOnHold); 100 QPEApplication::setStylusOperation( connectionsView->viewport(), QPEApplication::RightOnHold);
85 101
86 //Load all icons needed 102 //Load all icons needed
87 m_offPix = Resource::loadPixmap( "opietooth/notconnected" ); 103 m_offPix = Resource::loadPixmap( "opietooth/notconnected" );
88 m_onPix = Resource::loadPixmap( "opietooth/connected" ); 104 m_onPix = Resource::loadPixmap( "opietooth/connected" );
89 m_findPix = Resource::loadPixmap( "opietooth/find" ); 105 m_findPix = Resource::loadPixmap( "opietooth/find" );
90 106
91 QPalette pal = this->palette(); 107 QPalette pal = this->palette();
92 QColor col = pal.color( QPalette::Active, QColorGroup::Background ); 108 QColor col = pal.color( QPalette::Active, QColorGroup::Background );
93 pal.setColor( QPalette::Active, QColorGroup::Button, col ); 109 pal.setColor( QPalette::Active, QColorGroup::Button, col );
94 pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); 110 pal.setColor( QPalette::Inactive, QColorGroup::Button, col );
95 pal.setColor( QPalette::Normal, QColorGroup::Button, col ); 111 pal.setColor( QPalette::Normal, QColorGroup::Button, col );
96 pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); 112 pal.setColor( QPalette::Disabled, QColorGroup::Button, col );
97 this->setPalette( pal ); 113 this->setPalette( pal );
98 114
99 setCaption( tr( "Bluetooth Manager" ) ); 115 setCaption( tr( "Bluetooth Manager" ) );
100 116
101 readConfig(); 117 readConfig();
102 initGui(); 118 initGui();
103 119
104 devicesView->setRootIsDecorated(true); 120 devicesView->setRootIsDecorated(true);
105 m_iconLoader = new BTIconLoader(); 121 m_iconLoader = new BTIconLoader();
106 writeToHciConfig(); 122 writeToHciConfig();
107 addConnectedDevices(); 123 addConnectedDevices();
108 readSavedDevices(); 124 readSavedDevices();
109 addServicesToDevices(); 125 addServicesToDevices();
110 QTimer::singleShot( 3000, this, SLOT( addServicesToDevices() ) ); 126 QTimer::singleShot( 3000, this, SLOT( addServicesToDevices() ) );
127 forwarder = NULL;
128 serDevName->setText(tr("/dev/ircomm0"));
129 for (unsigned int i = 0; i < (sizeof(speeds) / sizeof(speeds[0])); i++) {
130 serSpeed->insertItem(speeds[i].str);
131 }
132 serSpeed->setCurrentItem((sizeof(speeds) / sizeof(speeds[0])) - 1);
111} 133}
112 134
113/** 135/**
114 * Reads all options from the config file 136 * Reads all options from the config file
115 */ 137 */
116void BlueBase::readConfig() 138void BlueBase::readConfig()
117{ 139{
118 140
119 Config cfg( "bluetoothmanager" ); 141 Config cfg( "bluetoothmanager" );
120 cfg.setGroup( "bluezsettings" ); 142 cfg.setGroup( "bluezsettings" );
121 143
122 m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with 144 m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with
123 m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak 145 m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak
124 m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE ); 146 m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE );
125 m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE ); 147 m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE );
126 m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE ); 148 m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE );
127 m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE ); 149 m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE );
128} 150}
129 151
130/** 152/**
131 * Writes all options to the config file 153 * Writes all options to the config file
132 */ 154 */
133void BlueBase::writeConfig() 155void BlueBase::writeConfig()
134{ 156{
135 157
136 Config cfg( "bluetoothmanager" ); 158 Config cfg( "bluetoothmanager" );
137 cfg.setGroup( "bluezsettings" ); 159 cfg.setGroup( "bluezsettings" );
138 160
139 cfg.writeEntry( "name" , m_deviceName ); 161 cfg.writeEntry( "name" , m_deviceName );
140 cfg.writeEntryCrypt( "passkey" , m_defaultPasskey ); 162 cfg.writeEntryCrypt( "passkey" , m_defaultPasskey );
141 cfg.writeEntry( "useEncryption" , m_useEncryption ); 163 cfg.writeEntry( "useEncryption" , m_useEncryption );
142 cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); 164 cfg.writeEntry( "enableAuthentification" , m_enableAuthentification );
143 cfg.writeEntry( "enablePagescan" , m_enablePagescan ); 165 cfg.writeEntry( "enablePagescan" , m_enablePagescan );
144 cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); 166 cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan );
145 167
146 writeToHciConfig(); 168 writeToHciConfig();
147} 169}
148 170
149/** 171/**
150 * Modify the hcid.conf file to our needs 172 * Modify the hcid.conf file to our needs
151 */ 173 */
152void BlueBase::writeToHciConfig() 174void BlueBase::writeToHciConfig()
153{ 175{
154 owarn << "writeToHciConfig" << oendl; 176 owarn << "writeToHciConfig" << oendl;
155 HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); 177 HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" );
156 hciconf.load(); 178 hciconf.load();
157 hciconf.setPinHelper( QPEApplication::qpeDir() + "bin/bluepin" ); 179 hciconf.setPinHelper( QPEApplication::qpeDir() + "bin/bluepin" );
158 hciconf.setName( m_deviceName ); 180 hciconf.setName( m_deviceName );
159 hciconf.setEncrypt( m_useEncryption ); 181 hciconf.setEncrypt( m_useEncryption );
160 hciconf.setAuth( m_enableAuthentification ); 182 hciconf.setAuth( m_enableAuthentification );
161 hciconf.setPscan( m_enablePagescan ); 183 hciconf.setPscan( m_enablePagescan );
162 hciconf.setIscan( m_enableInquiryscan ); 184 hciconf.setIscan( m_enableInquiryscan );
163 hciconf.save(); 185 hciconf.save();
164} 186}
165 187
166 188
167/** 189/**
168 * Read the list of already known devices 190 * Read the list of already known devices
169 */ 191 */
170void BlueBase::readSavedDevices() 192void BlueBase::readSavedDevices()
171{ 193{
172 194
173 QValueList<RemoteDevice> loadedDevices; 195 QValueList<RemoteDevice> loadedDevices;
174 DeviceHandler handler; 196 DeviceHandler handler;
175 loadedDevices = handler.load(); 197 loadedDevices = handler.load();
176 198
177 addSearchedDevices( loadedDevices ); 199 addSearchedDevices( loadedDevices );
178} 200}
179 201
180 202
181/** 203/**
182 * Write the list of already known devices 204 * Write the list of already known devices
183 */ 205 */
184void BlueBase::writeSavedDevices() 206void BlueBase::writeSavedDevices()
185{ 207{
186 QListViewItemIterator it( devicesView ); 208 QListViewItemIterator it( devicesView );
187 BTListItem* item; 209 BTListItem* item;
188 BTDeviceItem* device; 210 BTDeviceItem* device;
189 RemoteDevice::ValueList list; 211 RemoteDevice::ValueList list;
190 for ( ; it.current(); ++it ) 212 for ( ; it.current(); ++it )
191 { 213 {
192 item = (BTListItem*)it.current(); 214 item = (BTListItem*)it.current();
193 if(item->typeId() != BTListItem::Device ) 215 if(item->typeId() != BTListItem::Device )
194 continue; 216 continue;
195 device = (BTDeviceItem*)item; 217 device = (BTDeviceItem*)item;
196 218
197 list.append( device->remoteDevice() ); 219 list.append( device->remoteDevice() );
198 } 220 }
199 /* 221 /*
200 * if not empty save the List through DeviceHandler 222 * if not empty save the List through DeviceHandler
201 */ 223 */
202 if ( list.isEmpty() ) 224 if ( list.isEmpty() )
203 return; 225 return;
204 DeviceHandler handler; 226 DeviceHandler handler;
205 handler.save( list ); 227 handler.save( list );
206} 228}
207 229
208 230
209/** 231/**
210 * Set up the gui 232 * Set up the gui
211 */ 233 */
212void BlueBase::initGui() 234void BlueBase::initGui()
213{ 235{
214 StatusLabel->setText( status() ); // maybe move it to getStatus() 236 StatusLabel->setText( status() ); // maybe move it to getStatus()
215 cryptCheckBox->setChecked( m_useEncryption ); 237 cryptCheckBox->setChecked( m_useEncryption );
216 authCheckBox->setChecked( m_enableAuthentification ); 238 authCheckBox->setChecked( m_enableAuthentification );
217 pagescanCheckBox->setChecked( m_enablePagescan ); 239 pagescanCheckBox->setChecked( m_enablePagescan );
218 inquiryscanCheckBox->setChecked( m_enableInquiryscan ); 240 inquiryscanCheckBox->setChecked( m_enableInquiryscan );
219 deviceNameLine->setText( m_deviceName ); 241 deviceNameLine->setText( m_deviceName );
220 passkeyLine->setText( m_defaultPasskey ); 242 passkeyLine->setText( m_defaultPasskey );
221 // set info tab 243 // set info tab
222 setInfo(); 244 setInfo();
223} 245}
224 246
225 247
226/** 248/**
227 * Get the status informations and returns it 249 * Get the status informations and returns it
228 * @return QString the status informations gathered 250 * @return QString the status informations gathered
229 */ 251 */
230QString BlueBase::status()const 252QString BlueBase::status()const
231{ 253{
232 QString infoString = tr( "<b>Device name : </b> Ipaq" ); 254 QString infoString = tr( "<b>Device name : </b> Ipaq" );
233 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); 255 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" );
234 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); 256 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" );
235 257
236 return (infoString); 258 return (infoString);
237} 259}
238 260
239 261
240/** 262/**
241 * Read the current values from the gui and invoke writeConfig() 263 * Read the current values from the gui and invoke writeConfig()
242 */ 264 */
243void BlueBase::applyConfigChanges() 265void BlueBase::applyConfigChanges()
244{ 266{
245 m_deviceName = deviceNameLine->text(); 267 m_deviceName = deviceNameLine->text();
246 m_defaultPasskey = passkeyLine->text(); 268 m_defaultPasskey = passkeyLine->text();
247 m_useEncryption = cryptCheckBox->isChecked(); 269 m_useEncryption = cryptCheckBox->isChecked();
248 m_enableAuthentification = authCheckBox->isChecked(); 270 m_enableAuthentification = authCheckBox->isChecked();
249 m_enablePagescan = pagescanCheckBox->isChecked(); 271 m_enablePagescan = pagescanCheckBox->isChecked();
250 m_enableInquiryscan = inquiryscanCheckBox->isChecked(); 272 m_enableInquiryscan = inquiryscanCheckBox->isChecked();
251 273
252 writeConfig(); 274 writeConfig();
253 275
254 QMessageBox::information( this, tr("Test") , tr("Changes were applied.") ); 276 QMessageBox::information( this, tr("Test") , tr("Changes were applied.") );
255} 277}
256 278
257/** 279/**
258 * Launch Rfcomm Bind dialog 280 * Launch Rfcomm Bind dialog
259 * 281 *
260 */ 282 */
261void BlueBase::rfcommDialog() 283void BlueBase::rfcommDialog()
262{ 284{
263 RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp ); 285 RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp );
264 286
265 if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted ) 287 if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted )
266 { 288 {
267 rfcommAssign.saveConfig(); 289 rfcommAssign.saveConfig();
268 } 290 }
269} 291}
270 292
271/** 293/**
272 * Add fresh found devices from scan dialog to the listing 294 * Add fresh found devices from scan dialog to the listing
273 * 295 *
274 */ 296 */
275void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) 297void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices )
276{ 298{
277 BTDeviceItem * deviceItem; 299 BTDeviceItem * deviceItem;
278 QValueList<RemoteDevice>::ConstIterator it; 300 QValueList<RemoteDevice>::ConstIterator it;
279 301
280 for( it = newDevices.begin(); it != newDevices.end() ; ++it ) 302 for( it = newDevices.begin(); it != newDevices.end() ; ++it )
281 { 303 {
282 304
283 if (find( (*it) )) // is already inserted 305 if (find( (*it) )) // is already inserted
284 continue; 306 continue;
285 307
286 deviceItem = new BTDeviceItem( devicesView , (*it) ); 308 deviceItem = new BTDeviceItem( devicesView , (*it) );
287 deviceItem->setPixmap( 1, m_findPix ); 309 deviceItem->setPixmap( 1, m_findPix );
288 deviceItem->setExpandable ( true ); 310 deviceItem->setExpandable ( true );
289 311
290 // look if device is avail. atm, async 312 // look if device is avail. atm, async
291 deviceActive( (*it) ); 313 deviceActive( (*it) );
292 } 314 }
293} 315}
294 316
295 317
296/** 318/**
297 * Action that is toggled on entrys on click 319 * Action that is toggled on entrys on click
298 */ 320 */
299void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) 321void BlueBase::startServiceActionClicked( QListViewItem */*item*/ )
300{} 322{}
301 323
302 324
303/** 325/**
304 * Action that are toggled on hold (mostly QPopups i guess) 326 * Action that are toggled on hold (mostly QPopups i guess)
305 */ 327 */
306void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) 328void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ )
307{ 329{
308 if (!item ) 330 if (!item )
309 return; 331 return;
310 332
311 QPopupMenu *menu = new QPopupMenu(); 333 QPopupMenu *menu = new QPopupMenu();
312 334
313 if ( static_cast<BTListItem*>( item )->type() == "device") 335 if ( static_cast<BTListItem*>( item )->type() == "device")
314 { 336 {
315 QPopupMenu *groups = new QPopupMenu(); 337 QPopupMenu *groups = new QPopupMenu();
316 338
317 menu->insertItem( static_cast<BTDeviceItem*>( item )->name(), 0 ); 339 menu->insertItem( static_cast<BTDeviceItem*>( item )->name(), 0 );
318 menu->insertSeparator( 1 ); 340 menu->insertSeparator( 1 );
319 menu->insertItem( tr( "&Rescan services" ), 2); 341 menu->insertItem( tr( "&Rescan services" ), 2);
320 // menu->insertItem( tr( "&Add to group" ), groups, 3); 342 // menu->insertItem( tr( "&Add to group" ), groups, 3);
321 menu->insertItem( tr( "&Delete"), 4); 343 menu->insertItem( tr( "&Delete"), 4);
322 int ret = menu->exec( point, 0); 344 int ret = menu->exec( point, 0);
323 345
324 switch(ret) 346 switch(ret)
325 { 347 {
326 case -1: 348 case -1:
327 break; 349 break;
328 case 2: 350 case 2:
329 addServicesToDevice( static_cast<BTDeviceItem*>( item ) ); 351 addServicesToDevice( static_cast<BTDeviceItem*>( item ) );
330 break; 352 break;
331 353
332 case 4: 354 case 4:
333 // deletes childs too 355 // deletes childs too
334 delete item; 356 delete item;
335 break; 357 break;
336 } 358 }
337 // delete groups; 359 // delete groups;
338 } 360 }
339 361
340 /* 362 /*
341 * We got service sensitive PopupMenus in our factory 363 * We got service sensitive PopupMenus in our factory
342 * We will create one through the factory and will insert 364 * We will create one through the factory and will insert
343 * our Separator + ShowInfo into the menu or create a new 365 * our Separator + ShowInfo into the menu or create a new
344 * one if the factory returns 0 366 * one if the factory returns 0
345 * PopupMenu deletion is kind of weird. 367 * PopupMenu deletion is kind of weird.
346 * If escaped( -1 ) or any of our items were chosen we'll 368 * If escaped( -1 ) or any of our items were chosen we'll
347 * delete the PopupMenu otherwise it's the responsibility of 369 * delete the PopupMenu otherwise it's the responsibility of
348 * the PopupMenu to delete itself 370 * the PopupMenu to delete itself
349 * 371 *
350 */ 372 */
351 else if ( ((BTListItem*)item)->type() == "service") 373 else if ( ((BTListItem*)item)->type() == "service")
352 { 374 {
353 BTServiceItem* service = (BTServiceItem*)item; 375 BTServiceItem* service = (BTServiceItem*)item;
354 QMap<int, QString> list = service->services().classIdList(); 376 QMap<int, QString> list = service->services().classIdList();
355 QMap<int, QString>::Iterator it = list.begin(); 377 QMap<int, QString>::Iterator it = list.begin();
356 QPopupMenu *popup =0l; 378 QPopupMenu *popup =0l;
357 if ( it != list.end() ) 379 if ( it != list.end() )
358 { 380 {
359 owarn << "Searching id " << it.key() << " " << it.data().latin1() << "" << oendl; 381 owarn << "Searching id " << it.key() << " " << it.data().latin1() << "" << oendl;
360 popup = m_popHelper.find( it.key(), 382 popup = m_popHelper.find( it.key(),
361 service->services(), 383 service->services(),
362 (BTDeviceItem*)service->parent() ); 384 (BTDeviceItem*)service->parent() );
363 } 385 }
364 else 386 else
365 { 387 {
366 owarn << "Empty" << oendl; 388 owarn << "Empty" << oendl;
367 } 389 }
368 390
369 if ( popup == 0l ) 391 if ( popup == 0l )
370 { 392 {
371 owarn << "factory returned 0l" << oendl; 393 owarn << "factory returned 0l" << oendl;
372 popup = new QPopupMenu(); 394 popup = new QPopupMenu();
373 } 395 }
374 int test1 = popup->insertItem( tr("Test1:"), 2); 396 int test1 = popup->insertItem( tr("Test1:"), 2);
375 397
376 int ret = popup->exec( point ); 398 int ret = popup->exec( point );
377 owarn << "returned from exec() " << oendl; 399 owarn << "returned from exec() " << oendl;
378 if ( ret == -1 ) 400 if ( ret == -1 )
379 { 401 {
380 ; 402 ;
381 } 403 }
382 else if ( ret == test1 ) 404 else if ( ret == test1 )
383 { 405 {
384 ; 406 ;
385 } 407 }
386 delete popup; 408 delete popup;
387 } 409 }
388 delete menu; 410 delete menu;
389} 411}
390 412
391 413
392void BlueBase::addServicesToDevices() 414void BlueBase::addServicesToDevices()
393{ 415{
394 odebug << "BlueBase::addServicesToDevices()" << oendl; 416 odebug << "BlueBase::addServicesToDevices()" << oendl;
395 BTDeviceItem* item = (BTDeviceItem*) devicesView->firstChild(); 417 BTDeviceItem* item = (BTDeviceItem*) devicesView->firstChild();
396 while ( item ) 418 while ( item )
397 { 419 {
398 addServicesToDevice( item ); 420 addServicesToDevice( item );
399 item = (BTDeviceItem*) static_cast<QListViewItem*>( item )->nextSibling(); 421 item = (BTDeviceItem*) static_cast<QListViewItem*>( item )->nextSibling();
400 } 422 }
401} 423}
402 424
403/** 425/**
404 * Search and display avail. services for a device (on expand from device listing) 426 * Search and display avail. services for a device (on expand from device listing)
405 * @param item the service item returned 427 * @param item the service item returned
406 */ 428 */
407void BlueBase::addServicesToDevice( BTDeviceItem * item ) 429void BlueBase::addServicesToDevice( BTDeviceItem * item )
408{ 430{
409 odebug << "BlueBase::addServicesToDevice" << oendl; 431 odebug << "BlueBase::addServicesToDevice" << oendl;
410 // row of mac adress text(3) 432 // row of mac adress text(3)
411 RemoteDevice device = item->remoteDevice(); 433 RemoteDevice device = item->remoteDevice();
412 m_deviceList.insert( item->mac() , item ); 434 m_deviceList.insert( item->mac() , item );
413 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back 435 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back
414 m_localDevice->searchServices( device ); 436 m_localDevice->searchServices( device );
415} 437}
416 438
417 439
418/** 440/**
419 * @param device the mac address of the remote device 441 * @param device the mac address of the remote device
420 * @param servicesList the list with the service the device has. 442 * @param servicesList the list with the service the device has.
421 */ 443 */
422void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) 444void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList )
423{ 445{
424 odebug << "BlueBase::fill services list" << oendl; 446 odebug << "BlueBase::fill services list" << oendl;
425 447
426 QMap<QString,BTDeviceItem*>::Iterator it; 448 QMap<QString,BTDeviceItem*>::Iterator it;
427 BTDeviceItem* deviceItem = 0; 449 BTDeviceItem* deviceItem = 0;
428 450
429 // get the right devices which requested the search 451 // get the right devices which requested the search
430 it = m_deviceList.find( device ); 452 it = m_deviceList.find( device );
431 if( it == m_deviceList.end() ) 453 if( it == m_deviceList.end() )
432 return; 454 return;
433 deviceItem = it.data(); 455 deviceItem = it.data();
434 456
435 // remove previous entries 457 // remove previous entries
436 QList<QListViewItem> tempList; 458 QList<QListViewItem> tempList;
437 tempList.setAutoDelete( true ); 459 tempList.setAutoDelete( true );
438 QListViewItem * child = deviceItem->firstChild(); 460 QListViewItem * child = deviceItem->firstChild();
439 while( child ) 461 while( child )
440 { 462 {
441 tempList.append( child ); 463 tempList.append( child );
442 child = child->nextSibling(); 464 child = child->nextSibling();
443 } 465 }
444 tempList.clear(); 466 tempList.clear();
445 467
446 QValueList<OpieTooth::Services>::Iterator it2; 468 QValueList<OpieTooth::Services>::Iterator it2;
447 BTServiceItem* serviceItem; 469 BTServiceItem* serviceItem;
448 470
449 471
450 if (!servicesList.isEmpty() ) 472 if (!servicesList.isEmpty() )
451 { 473 {
452 // add services 474 // add services
453 QMap<int, QString> list; 475 QMap<int, QString> list;
454 QMap<int, QString>::Iterator classIt; 476 QMap<int, QString>::Iterator classIt;
455 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) 477 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 )
456 { 478 {
457 serviceItem = new BTServiceItem( deviceItem, (*it2) ); 479 serviceItem = new BTServiceItem( deviceItem, (*it2) );
458 list = (*it2).classIdList(); 480 list = (*it2).classIdList();
459 classIt = list.begin(); 481 classIt = list.begin();
460 int classId=0; 482 int classId=0;
461 if ( classIt != list.end() ) 483 if ( classIt != list.end() )
462 { 484 {
463 classId = classIt.key(); 485 classId = classIt.key();
464 } 486 }
465 487
466 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) ); 488 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) );
467 } 489 }
468 } 490 }
469 else 491 else
470 { 492 {
471 Services s1; 493 Services s1;
472 s1.setServiceName( tr("no services found") ); 494 s1.setServiceName( tr("no services found") );
473 serviceItem = new BTServiceItem( deviceItem, s1 ); 495 serviceItem = new BTServiceItem( deviceItem, s1 );
474 } 496 }
475 // now remove them from the list 497 // now remove them from the list
476 m_deviceList.remove( it ); 498 m_deviceList.remove( it );
477} 499}
478 500
479void BlueBase::addSignalStrength() 501void BlueBase::addSignalStrength()
480{ 502{
481 503
482 QListViewItemIterator it( connectionsView ); 504 QListViewItemIterator it( connectionsView );
483 for ( ; it.current(); ++it ) 505 for ( ; it.current(); ++it )
484 { 506 {
485 m_localDevice->signalStrength( ((BTConnectionItem*)it.current() )->connection().mac() ); 507 m_localDevice->signalStrength( ((BTConnectionItem*)it.current() )->connection().mac() );
486 } 508 }
487 509
488 QTimer::singleShot( 5000, this, SLOT( addSignalStrength() ) ); 510 QTimer::singleShot( 5000, this, SLOT( addSignalStrength() ) );
489} 511}
490 512
491void BlueBase::addSignalStrength( const QString& mac, const QString& strength ) 513void BlueBase::addSignalStrength( const QString& mac, const QString& strength )
492{ 514{
493 515
494 QListViewItemIterator it( connectionsView ); 516 QListViewItemIterator it( connectionsView );
495 for ( ; it.current(); ++it ) 517 for ( ; it.current(); ++it )
496 { 518 {
497 if( ((BTConnectionItem*)it.current())->connection().mac() == mac ) 519 if( ((BTConnectionItem*)it.current())->connection().mac() == mac )
498 { 520 {
499 ((BTConnectionItem*)it.current() )->setSignalStrength( strength ); 521 ((BTConnectionItem*)it.current() )->setSignalStrength( strength );
500 } 522 }
501 } 523 }
502} 524}
503 525
504/** 526/**
505 * Add the existing connections (pairs) to the connections tab. 527 * Add the existing connections (pairs) to the connections tab.
506 * This one triggers the search 528 * This one triggers the search
507 */ 529 */
508void BlueBase::addConnectedDevices() 530void BlueBase::addConnectedDevices()
509{ 531{
510 m_localDevice->searchConnections(); 532 m_localDevice->searchConnections();
511 QTimer::singleShot( 5000, this, SLOT( addSignalStrength() ) ); 533 QTimer::singleShot( 5000, this, SLOT( addSignalStrength() ) );
512} 534}
513 535
514/** 536/**
515 * This adds the found connections to the connection tab. 537 * This adds the found connections to the connection tab.
516 * @param connectionList the ValueList with all current connections 538 * @param connectionList the ValueList with all current connections
517 */ 539 */
518void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) 540void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList )
519{ 541{
520 542
521 QValueList<OpieTooth::ConnectionState>::Iterator it; 543 QValueList<OpieTooth::ConnectionState>::Iterator it;
522 BTConnectionItem * connectionItem; 544 BTConnectionItem * connectionItem;
523 545
524 if ( !connectionList.isEmpty() ) 546 if ( !connectionList.isEmpty() )
525 { 547 {
526 548
527 for (it = connectionList.begin(); it != connectionList.end(); ++it) 549 for (it = connectionList.begin(); it != connectionList.end(); ++it)
528 { 550 {
529 551
530 QListViewItemIterator it2( connectionsView ); 552 QListViewItemIterator it2( connectionsView );
531 bool found = false; 553 bool found = false;
532 for ( ; it2.current(); ++it2 ) 554 for ( ; it2.current(); ++it2 )
533 { 555 {
534 if( ( (BTConnectionItem*)it2.current())->connection().mac() == (*it).mac() ) 556 if( ( (BTConnectionItem*)it2.current())->connection().mac() == (*it).mac() )
535 { 557 {
536 found = true; 558 found = true;
537 } 559 }
538 } 560 }
539 561
540 if ( found == false ) 562 if ( found == false )
541 { 563 {
542 connectionItem = new BTConnectionItem( connectionsView, (*it) ); 564 connectionItem = new BTConnectionItem( connectionsView, (*it) );
543 565
544 if( m_deviceList.find((*it).mac()).data() ) 566 if( m_deviceList.find((*it).mac()).data() )
545 { 567 {
546 connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() ); 568 connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() );
547 } 569 }
548 } 570 }
549 571
550 } 572 }
551 573
552 QListViewItemIterator it2( connectionsView ); 574 QListViewItemIterator it2( connectionsView );
553 for ( ; it2.current(); ++it2 ) 575 for ( ; it2.current(); ++it2 )
554 { 576 {
555 bool found = false; 577 bool found = false;
556 for (it = connectionList.begin(); it != connectionList.end(); ++it) 578 for (it = connectionList.begin(); it != connectionList.end(); ++it)
557 { 579 {
558 if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() ) 580 if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() )
559 { 581 {
560 found = true; 582 found = true;
561 } 583 }
562 } 584 }
563 585
564 if ( !found ) 586 if ( !found )
565 { 587 {
566 delete it2.current(); 588 delete it2.current();
567 } 589 }
568 590
569 } 591 }
570 592
571 593
572 } 594 }
573 else 595 else
574 { 596 {
575 connectionsView->clear(); 597 connectionsView->clear();
576 ConnectionState con; 598 ConnectionState con;
577 con.setMac( tr("No connections found") ); 599 con.setMac( tr("No connections found") );
578 connectionItem = new BTConnectionItem( connectionsView , con ); 600 connectionItem = new BTConnectionItem( connectionsView , con );
579 } 601 }
580 602
581 // recall connection search after some time 603 // recall connection search after some time
582 QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) ); 604 QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) );
583} 605}
584 606
585 607
586/** 608/**
587 * Find out if a device can currently be reached 609 * Find out if a device can currently be reached
588 * @param device 610 * @param device
589 */ 611 */
590void BlueBase::deviceActive( const RemoteDevice &device ) 612void BlueBase::deviceActive( const RemoteDevice &device )
591{ 613{
592 // search by mac, async, gets a signal back 614 // search by mac, async, gets a signal back
593 // We should have a BTDeviceItem there or where does it get added to the map -zecke 615 // We should have a BTDeviceItem there or where does it get added to the map -zecke
594 m_localDevice->isAvailable( device.mac() ); 616 m_localDevice->isAvailable( device.mac() );
595} 617}
596 618
597 619
598/** 620/**
599 * The signal catcher. Set the avail. status on device. 621 * The signal catcher. Set the avail. status on device.
600 * @param device - the mac address 622 * @param device - the mac address
601 * @param connected - if it is avail. or not 623 * @param connected - if it is avail. or not
602 */ 624 */
603void BlueBase::deviceActive( const QString& device, bool connected ) 625void BlueBase::deviceActive( const QString& device, bool connected )
604{ 626{
605 odebug << "deviceActive slot" << oendl; 627 odebug << "deviceActive slot" << oendl;
606 628
607 QMap<QString,BTDeviceItem*>::Iterator it; 629 QMap<QString,BTDeviceItem*>::Iterator it;
608 630
609 it = m_deviceList.find( device ); 631 it = m_deviceList.find( device );
610 if( it == m_deviceList.end() ) 632 if( it == m_deviceList.end() )
611 return; 633 return;
612 634
613 BTDeviceItem* deviceItem = it.data(); 635 BTDeviceItem* deviceItem = it.data();
614 636
615 if ( connected ) 637 if ( connected )
616 { 638 {
617 deviceItem->setPixmap( 1, m_onPix ); 639 deviceItem->setPixmap( 1, m_onPix );
618 } 640 }
619 else 641 else
620 { 642 {
621 deviceItem->setPixmap( 1, m_offPix ); 643 deviceItem->setPixmap( 1, m_offPix );
622 } 644 }
623 m_deviceList.remove( it ); 645 m_deviceList.remove( it );
624} 646}
625 647
626 648
627/** 649/**
628 * Open the "scan for devices" dialog 650 * Open the "scan for devices" dialog
629 */ 651 */
630void BlueBase::startScan() 652void BlueBase::startScan()
631{ 653{
632 ScanDialog *scan = new ScanDialog( this, "ScanDialog", 654 ScanDialog *scan = new ScanDialog( this, "ScanDialog",
633 true, WDestructiveClose ); 655 true, WDestructiveClose );
634 QObject::connect( scan, SIGNAL( selectedDevices(const QValueList<RemoteDevice>&) ), 656 QObject::connect( scan, SIGNAL( selectedDevices(const QValueList<RemoteDevice>&) ),
635 this, SLOT( addSearchedDevices(const QValueList<RemoteDevice>&) ) ); 657 this, SLOT( addSearchedDevices(const QValueList<RemoteDevice>&) ) );
636 658
637 QPEApplication::showDialog( scan ); 659 QPEApplication::showDialog( scan );
638} 660}
639 661
640 662
641/** 663/**
642 * Set the informations about the local device in information Tab 664 * Set the informations about the local device in information Tab
643 */ 665 */
644void BlueBase::setInfo() 666void BlueBase::setInfo()
645{ 667{
646 StatusLabel->setText( status() ); 668 StatusLabel->setText( status() );
647} 669}
648 670
649 671
650/** 672/**
651 * Decontructor 673 * Decontructor
652 */ 674 */
653BlueBase::~BlueBase() 675BlueBase::~BlueBase()
654{ 676{
655 writeSavedDevices(); 677 writeSavedDevices();
656 delete m_iconLoader; 678 delete m_iconLoader;
657} 679}
658 680
659 681
660/** 682/**
661 * find searches the ListView for a BTDeviceItem containig 683 * find searches the ListView for a BTDeviceItem containig
662 * the same Device if found return true else false 684 * the same Device if found return true else false
663 * @param dev RemoteDevice to find 685 * @param dev RemoteDevice to find
664 * @return returns true if found 686 * @return returns true if found
665 */ 687 */
666bool BlueBase::find( const RemoteDevice& rem ) 688bool BlueBase::find( const RemoteDevice& rem )
667{ 689{
668 QListViewItemIterator it( devicesView ); 690 QListViewItemIterator it( devicesView );
669 BTListItem* item; 691 BTListItem* item;
670 BTDeviceItem* device; 692 BTDeviceItem* device;
671 for (; it.current(); ++it ) 693 for (; it.current(); ++it )
672 { 694 {
673 item = (BTListItem*) it.current(); 695 item = (BTListItem*) it.current();
674 if ( item->typeId() != BTListItem::Device ) 696 if ( item->typeId() != BTListItem::Device )
675 continue; 697 continue;
676 698
677 device = (BTDeviceItem*)item; 699 device = (BTDeviceItem*)item;
678 if ( rem.equals( device->remoteDevice() ) ) 700 if ( rem.equals( device->remoteDevice() ) )
679 return true; 701 return true;
680 } 702 }
681 return false; // not found 703 return false; // not found
682} 704}
705
706/**
707 * Start process of the cell phone forwarding
708 */
709void BlueBase::doForward()
710{
711 if (forwarder && forwarder->isRunning()) {
712 runButton->setText("start gateway");
713 forwarder->stop();
714 delete forwarder;
715 forwarder = NULL;
716 return;
717 }
718 QString str = serDevName->text();
719 forwarder = new SerialForwarder(str, speeds[serSpeed->currentItem()].val);
720 connect(forwarder, SIGNAL(processExited(Opie::Core::OProcess*)),
721 this, SLOT(forwardExited(Opie::Core::OProcess*)));
722 if (forwarder->start(OProcess::NotifyOnExit) < 0) {
723 QMessageBox::critical(this, tr("Forwarder Error"),
724 tr("Forwarder start error:") + tr(strerror(errno)));
725 return;
726 }
727 runButton->setText("stop gateway");
728}
729
730/**
731 * React on the process end
732 */
733void BlueBase::forwardExit(Opie::Core::OProcess* proc)
734{
735 if (proc->exitStatus() != 0)
736 QMessageBox::critical(this, tr("Forwarder Error"),
737 tr("Forwarder start error"));
738 delete proc;
739 forwarder = NULL;
740 runButton->setText("start gateway");
741}
742
743//eof
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h
index 48883d2..0128a88 100644
--- a/noncore/net/opietooth/manager/bluebase.h
+++ b/noncore/net/opietooth/manager/bluebase.h
@@ -1,102 +1,106 @@
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
17#include "popuphelper.h" 17#include "popuphelper.h"
18 18
19#include "bticonloader.h" 19#include "bticonloader.h"
20#include "forwarder.h"
20 21
21#include <remotedevice.h> 22#include <remotedevice.h>
22#include <manager.h> 23#include <manager.h>
23 24
24class QVBox; 25class QVBox;
25class QHBoxLayout; 26class QHBoxLayout;
26class QGridLayout; 27class QGridLayout;
27class QFrame; 28class QFrame;
28class QLabel; 29class QLabel;
29class QPushButton; 30class QPushButton;
30class QTabWidget; 31class QTabWidget;
31class QCheckBox; 32class QCheckBox;
32class BTConnectionItem; 33class BTConnectionItem;
33 34
34 35
35namespace OpieTooth { 36namespace OpieTooth {
36 37
37 class BlueBase : public BluetoothBase { 38 class BlueBase : public BluetoothBase {
38 Q_OBJECT 39 Q_OBJECT
39 40
40 public: 41 public:
41 BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 42 BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
42 ~BlueBase(); 43 ~BlueBase();
43 44
44 static QString appName() { return QString::fromLatin1("bluetooth-manager"); } 45 static QString appName() { return QString::fromLatin1("bluetooth-manager"); }
45 46
46 protected: 47 protected:
47 48
48 49
49 private slots: 50 private slots:
50 void startScan(); 51 void startScan();
51 52
52 53
53 private: 54 private:
54 bool find( const RemoteDevice& device ); 55 bool find( const RemoteDevice& device );
55 void readConfig(); 56 void readConfig();
56 void writeConfig(); 57 void writeConfig();
57 void readSavedDevices(); 58 void readSavedDevices();
58 void writeSavedDevices(); 59 void writeSavedDevices();
59 void writeToHciConfig(); 60 void writeToHciConfig();
60 QString status()const; 61 QString status()const;
61 void initGui(); 62 void initGui();
62 void setInfo(); 63 void setInfo();
63 64
64 PopupHelper m_popHelper; 65 PopupHelper m_popHelper;
65 Manager *m_localDevice; 66 Manager *m_localDevice;
66 QMap<QString,BTDeviceItem*> m_deviceList; 67 QMap<QString,BTDeviceItem*> m_deviceList;
67 68
68 void deviceActive( const RemoteDevice &device ); 69 void deviceActive( const RemoteDevice &device );
69 70
70 QString m_deviceName; 71 QString m_deviceName;
71 QString m_defaultPasskey; 72 QString m_defaultPasskey;
72 bool m_useEncryption; 73 bool m_useEncryption;
73 bool m_enableAuthentification; 74 bool m_enableAuthentification;
74 bool m_enablePagescan; 75 bool m_enablePagescan;
75 bool m_enableInquiryscan; 76 bool m_enableInquiryscan;
76 77
77 QPixmap m_offPix; 78 QPixmap m_offPix;
78 QPixmap m_onPix; 79 QPixmap m_onPix;
79 QPixmap m_findPix; 80 QPixmap m_findPix;
80 81
81 BTIconLoader *m_iconLoader; 82 BTIconLoader *m_iconLoader;
83 SerialForwarder* forwarder;
82 84
83 private slots: 85 private slots:
84 void addSearchedDevices( const QValueList<RemoteDevice> &newDevices ); 86 void addSearchedDevices( const QValueList<RemoteDevice> &newDevices );
85 void addServicesToDevices(); 87 void addServicesToDevices();
86 void addServicesToDevice( BTDeviceItem *item ); 88 void addServicesToDevice( BTDeviceItem *item );
87 void addServicesToDevice( const QString& device, Services::ValueList ); 89 void addServicesToDevice( const QString& device, Services::ValueList );
88 void addConnectedDevices(); 90 void addConnectedDevices();
89 void addConnectedDevices( ConnectionState::ValueList ); 91 void addConnectedDevices( ConnectionState::ValueList );
90 void startServiceActionClicked( QListViewItem *item ); 92 void startServiceActionClicked( QListViewItem *item );
91 void startServiceActionHold( QListViewItem *, const QPoint &, int ); 93 void startServiceActionHold( QListViewItem *, const QPoint &, int );
92 void deviceActive( const QString& mac, bool connected ); 94 void deviceActive( const QString& mac, bool connected );
93 void applyConfigChanges(); 95 void applyConfigChanges();
96 void doForward();
97 void forwardExit(Opie::Core::OProcess* proc);
94 void addSignalStrength(); 98 void addSignalStrength();
95 void addSignalStrength( const QString& mac, const QString& strengh ); 99 void addSignalStrength( const QString& mac, const QString& strengh );
96 void rfcommDialog(); 100 void rfcommDialog();
97 101
98 }; 102 };
99 103
100} 104}
101 105
102#endif 106#endif
diff --git a/noncore/net/opietooth/manager/bluetoothbase.ui b/noncore/net/opietooth/manager/bluetoothbase.ui
index cbde3c6..a5e2c6f 100644
--- a/noncore/net/opietooth/manager/bluetoothbase.ui
+++ b/noncore/net/opietooth/manager/bluetoothbase.ui
@@ -1,382 +1,538 @@
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>293</width> 14 <width>268</width>
15 <height>382</height> 15 <height>368</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 <property> 22 <vbox>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <grid>
29 <property stdset="1"> 23 <property stdset="1">
30 <name>margin</name> 24 <name>margin</name>
31 <number>4</number> 25 <number>0</number>
32 </property> 26 </property>
33 <property stdset="1"> 27 <property stdset="1">
34 <name>spacing</name> 28 <name>spacing</name>
35 <number>2</number> 29 <number>0</number>
36 </property> 30 </property>
37 <widget row="0" column="0" > 31 <widget>
38 <class>QTabWidget</class> 32 <class>QTabWidget</class>
39 <property stdset="1"> 33 <property stdset="1">
40 <name>name</name> 34 <name>name</name>
41 <cstring>Status</cstring> 35 <cstring>Status</cstring>
42 </property> 36 </property>
43 <property> 37 <property>
44 <name>layoutMargin</name> 38 <name>layoutMargin</name>
45 </property> 39 </property>
46 <property> 40 <property>
47 <name>layoutSpacing</name> 41 <name>layoutSpacing</name>
48 </property> 42 </property>
49 <widget> 43 <widget>
50 <class>QWidget</class> 44 <class>QWidget</class>
51 <property stdset="1"> 45 <property stdset="1">
52 <name>name</name> 46 <name>name</name>
53 <cstring>tab</cstring> 47 <cstring>tab</cstring>
54 </property> 48 </property>
55 <attribute> 49 <attribute>
56 <name>title</name> 50 <name>title</name>
57 <string>Devices</string> 51 <string>Devices</string>
58 </attribute> 52 </attribute>
59 <vbox> 53 <vbox>
60 <property stdset="1"> 54 <property stdset="1">
61 <name>margin</name> 55 <name>margin</name>
62 <number>4</number> 56 <number>4</number>
63 </property> 57 </property>
64 <property stdset="1"> 58 <property stdset="1">
65 <name>spacing</name> 59 <name>spacing</name>
66 <number>2</number> 60 <number>2</number>
67 </property> 61 </property>
68 <widget> 62 <widget>
69 <class>QListView</class> 63 <class>QListView</class>
70 <column> 64 <column>
71 <property> 65 <property>
72 <name>text</name> 66 <name>text</name>
73 <string>Device Name</string> 67 <string>Device Name</string>
74 </property> 68 </property>
75 <property> 69 <property>
76 <name>clickable</name> 70 <name>clickable</name>
77 <bool>true</bool> 71 <bool>true</bool>
78 </property> 72 </property>
79 <property> 73 <property>
80 <name>resizeable</name> 74 <name>resizeable</name>
81 <bool>true</bool> 75 <bool>true</bool>
82 </property> 76 </property>
83 </column> 77 </column>
84 <column> 78 <column>
85 <property> 79 <property>
86 <name>text</name> 80 <name>text</name>
87 <string>Online</string> 81 <string>Online</string>
88 </property> 82 </property>
89 <property> 83 <property>
90 <name>clickable</name> 84 <name>clickable</name>
91 <bool>true</bool> 85 <bool>true</bool>
92 </property> 86 </property>
93 <property> 87 <property>
94 <name>resizeable</name> 88 <name>resizeable</name>
95 <bool>true</bool> 89 <bool>true</bool>
96 </property> 90 </property>
97 </column> 91 </column>
98 <property stdset="1"> 92 <property stdset="1">
99 <name>name</name> 93 <name>name</name>
100 <cstring>devicesView</cstring> 94 <cstring>devicesView</cstring>
101 </property> 95 </property>
102 </widget> 96 </widget>
103 <widget> 97 <widget>
104 <class>QPushButton</class> 98 <class>QPushButton</class>
105 <property stdset="1"> 99 <property stdset="1">
106 <name>name</name> 100 <name>name</name>
107 <cstring>PushButton2</cstring> 101 <cstring>PushButton2</cstring>
108 </property> 102 </property>
109 <property stdset="1"> 103 <property stdset="1">
110 <name>sizePolicy</name> 104 <name>sizePolicy</name>
111 <sizepolicy> 105 <sizepolicy>
112 <hsizetype>0</hsizetype> 106 <hsizetype>0</hsizetype>
113 <vsizetype>0</vsizetype> 107 <vsizetype>0</vsizetype>
114 </sizepolicy> 108 </sizepolicy>
115 </property> 109 </property>
116 <property stdset="1"> 110 <property stdset="1">
117 <name>text</name> 111 <name>text</name>
118 <string>&amp;Rescan Devices</string> 112 <string>&amp;Rescan Devices</string>
119 </property> 113 </property>
120 </widget> 114 </widget>
121 </vbox> 115 </vbox>
122 </widget> 116 </widget>
123 <widget> 117 <widget>
124 <class>QWidget</class> 118 <class>QWidget</class>
125 <property stdset="1"> 119 <property stdset="1">
126 <name>name</name> 120 <name>name</name>
127 <cstring>tab</cstring> 121 <cstring>tab</cstring>
128 </property> 122 </property>
129 <attribute> 123 <attribute>
130 <name>title</name> 124 <name>title</name>
131 <string>Connections</string> 125 <string>Connections</string>
132 </attribute> 126 </attribute>
133 <vbox> 127 <vbox>
134 <property stdset="1"> 128 <property stdset="1">
135 <name>margin</name> 129 <name>margin</name>
136 <number>4</number> 130 <number>4</number>
137 </property> 131 </property>
138 <property stdset="1"> 132 <property stdset="1">
139 <name>spacing</name> 133 <name>spacing</name>
140 <number>2</number> 134 <number>2</number>
141 </property> 135 </property>
142 <widget> 136 <widget>
143 <class>QListView</class> 137 <class>QListView</class>
144 <column> 138 <column>
145 <property> 139 <property>
146 <name>text</name> 140 <name>text</name>
147 <string>Device Name</string> 141 <string>Device Name</string>
148 </property> 142 </property>
149 <property> 143 <property>
150 <name>clickable</name> 144 <name>clickable</name>
151 <bool>true</bool> 145 <bool>true</bool>
152 </property> 146 </property>
153 <property> 147 <property>
154 <name>resizeable</name> 148 <name>resizeable</name>
155 <bool>true</bool> 149 <bool>true</bool>
156 </property> 150 </property>
157 </column> 151 </column>
158 <column> 152 <column>
159 <property> 153 <property>
160 <name>text</name> 154 <name>text</name>
161 <string>Connection type</string> 155 <string>Connection type</string>
162 </property> 156 </property>
163 <property> 157 <property>
164 <name>clickable</name> 158 <name>clickable</name>
165 <bool>true</bool> 159 <bool>true</bool>
166 </property> 160 </property>
167 <property> 161 <property>
168 <name>resizeable</name> 162 <name>resizeable</name>
169 <bool>true</bool> 163 <bool>true</bool>
170 </property> 164 </property>
171 </column> 165 </column>
172 <column> 166 <column>
173 <property> 167 <property>
174 <name>text</name> 168 <name>text</name>
175 <string>Signal</string> 169 <string>Signal</string>
176 </property> 170 </property>
177 <property> 171 <property>
178 <name>clickable</name> 172 <name>clickable</name>
179 <bool>true</bool> 173 <bool>true</bool>
180 </property> 174 </property>
181 <property> 175 <property>
182 <name>resizeable</name> 176 <name>resizeable</name>
183 <bool>true</bool> 177 <bool>true</bool>
184 </property> 178 </property>
185 </column> 179 </column>
186 <property stdset="1"> 180 <property stdset="1">
187 <name>name</name> 181 <name>name</name>
188 <cstring>connectionsView</cstring> 182 <cstring>connectionsView</cstring>
189 </property> 183 </property>
190 </widget> 184 </widget>
191 </vbox> 185 </vbox>
192 </widget> 186 </widget>
193 <widget> 187 <widget>
194 <class>QWidget</class> 188 <class>QWidget</class>
195 <property stdset="1"> 189 <property stdset="1">
196 <name>name</name> 190 <name>name</name>
197 <cstring>tab</cstring> 191 <cstring>tab</cstring>
198 </property> 192 </property>
199 <attribute> 193 <attribute>
200 <name>title</name> 194 <name>title</name>
201 <string>Config</string> 195 <string>Config</string>
202 </attribute> 196 </attribute>
203 <grid> 197 <grid>
204 <property stdset="1"> 198 <property stdset="1">
205 <name>margin</name> 199 <name>margin</name>
206 <number>4</number> 200 <number>4</number>
207 </property> 201 </property>
208 <property stdset="1"> 202 <property stdset="1">
209 <name>spacing</name> 203 <name>spacing</name>
210 <number>2</number> 204 <number>2</number>
211 </property> 205 </property>
212 <widget row="1" column="0" > 206 <widget row="1" column="0" >
213 <class>QPushButton</class> 207 <class>QPushButton</class>
214 <property stdset="1"> 208 <property stdset="1">
215 <name>name</name> 209 <name>name</name>
216 <cstring>rfcommBindButton</cstring> 210 <cstring>rfcommBindButton</cstring>
217 </property> 211 </property>
218 <property stdset="1"> 212 <property stdset="1">
219 <name>text</name> 213 <name>text</name>
220 <string>&amp;Edit RFCOMM Bind Table</string> 214 <string>&amp;Edit RFCOMM Bind Table</string>
221 </property> 215 </property>
222 </widget> 216 </widget>
223 <widget row="0" column="0" > 217 <widget row="0" column="0" >
224 <class>QGroupBox</class> 218 <class>QGroupBox</class>
225 <property stdset="1"> 219 <property stdset="1">
226 <name>name</name> 220 <name>name</name>
227 <cstring>GroupBox1</cstring> 221 <cstring>GroupBox1</cstring>
228 </property> 222 </property>
229 <property stdset="1"> 223 <property stdset="1">
230 <name>title</name> 224 <name>title</name>
231 <string>Bluetooth Basic Config</string> 225 <string>Bluetooth Basic Config</string>
232 </property> 226 </property>
233 <property> 227 <property>
234 <name>layoutMargin</name> 228 <name>layoutMargin</name>
235 </property> 229 </property>
236 <property> 230 <property>
237 <name>layoutSpacing</name> 231 <name>layoutSpacing</name>
238 </property> 232 </property>
239 <grid> 233 <grid>
240 <property stdset="1"> 234 <property stdset="1">
241 <name>margin</name> 235 <name>margin</name>
242 <number>4</number> 236 <number>4</number>
243 </property> 237 </property>
244 <property stdset="1"> 238 <property stdset="1">
245 <name>spacing</name> 239 <name>spacing</name>
246 <number>2</number> 240 <number>2</number>
247 </property> 241 </property>
248 <widget row="6" column="0" rowspan="1" colspan="2" > 242 <widget row="6" column="0" rowspan="1" colspan="2" >
249 <class>QPushButton</class> 243 <class>QPushButton</class>
250 <property stdset="1"> 244 <property stdset="1">
251 <name>name</name> 245 <name>name</name>
252 <cstring>configApplyButton</cstring> 246 <cstring>configApplyButton</cstring>
253 </property> 247 </property>
254 <property stdset="1"> 248 <property stdset="1">
255 <name>text</name> 249 <name>text</name>
256 <string>Apply</string> 250 <string>Apply</string>
257 </property> 251 </property>
258 </widget> 252 </widget>
259 <widget row="2" column="0" rowspan="1" colspan="2" > 253 <widget row="2" column="0" rowspan="1" colspan="2" >
260 <class>QCheckBox</class> 254 <class>QCheckBox</class>
261 <property stdset="1"> 255 <property stdset="1">
262 <name>name</name> 256 <name>name</name>
263 <cstring>authCheckBox</cstring> 257 <cstring>authCheckBox</cstring>
264 </property> 258 </property>
265 <property stdset="1"> 259 <property stdset="1">
266 <name>text</name> 260 <name>text</name>
267 <string>enable authentification</string> 261 <string>enable authentification</string>
268 </property> 262 </property>
269 </widget> 263 </widget>
270 <widget row="3" column="0" rowspan="1" colspan="2" > 264 <widget row="3" column="0" rowspan="1" colspan="2" >
271 <class>QCheckBox</class> 265 <class>QCheckBox</class>
272 <property stdset="1"> 266 <property stdset="1">
273 <name>name</name> 267 <name>name</name>
274 <cstring>cryptCheckBox</cstring> 268 <cstring>cryptCheckBox</cstring>
275 </property> 269 </property>
276 <property stdset="1"> 270 <property stdset="1">
277 <name>text</name> 271 <name>text</name>
278 <string>enable encryption</string> 272 <string>enable encryption</string>
279 </property> 273 </property>
280 </widget> 274 </widget>
281 <widget row="4" column="0" rowspan="1" colspan="2" > 275 <widget row="4" column="0" rowspan="1" colspan="2" >
282 <class>QCheckBox</class> 276 <class>QCheckBox</class>
283 <property stdset="1"> 277 <property stdset="1">
284 <name>name</name> 278 <name>name</name>
285 <cstring>pagescanCheckBox</cstring> 279 <cstring>pagescanCheckBox</cstring>
286 </property> 280 </property>
287 <property stdset="1"> 281 <property stdset="1">
288 <name>text</name> 282 <name>text</name>
289 <string>Enable Page scan</string> 283 <string>Enable Page scan</string>
290 </property> 284 </property>
291 </widget> 285 </widget>
292 <widget row="5" column="0" rowspan="1" colspan="2" > 286 <widget row="5" column="0" rowspan="1" colspan="2" >
293 <class>QCheckBox</class> 287 <class>QCheckBox</class>
294 <property stdset="1"> 288 <property stdset="1">
295 <name>name</name> 289 <name>name</name>
296 <cstring>inquiryscanCheckBox</cstring> 290 <cstring>inquiryscanCheckBox</cstring>
297 </property> 291 </property>
298 <property stdset="1"> 292 <property stdset="1">
299 <name>text</name> 293 <name>text</name>
300 <string>Enable Inquiry scan</string> 294 <string>Enable Inquiry scan</string>
301 </property> 295 </property>
302 </widget> 296 </widget>
303 <widget row="0" column="0" > 297 <widget row="0" column="0" >
304 <class>QLabel</class> 298 <class>QLabel</class>
305 <property stdset="1"> 299 <property stdset="1">
306 <name>name</name> 300 <name>name</name>
307 <cstring>deviceNameLabel</cstring> 301 <cstring>deviceNameLabel</cstring>
308 </property> 302 </property>
309 <property stdset="1"> 303 <property stdset="1">
310 <name>text</name> 304 <name>text</name>
311 <string>Device Name</string> 305 <string>Device Name</string>
312 </property> 306 </property>
313 </widget> 307 </widget>
314 <widget row="1" column="0" > 308 <widget row="1" column="0" >
315 <class>QLabel</class> 309 <class>QLabel</class>
316 <property stdset="1"> 310 <property stdset="1">
317 <name>name</name> 311 <name>name</name>
318 <cstring>passkeyLabel</cstring> 312 <cstring>passkeyLabel</cstring>
319 </property> 313 </property>
320 <property stdset="1"> 314 <property stdset="1">
321 <name>text</name> 315 <name>text</name>
322 <string>Default Passkey</string> 316 <string>Default Passkey</string>
323 </property> 317 </property>
324 </widget> 318 </widget>
325 <widget row="0" column="1" > 319 <widget row="0" column="1" >
326 <class>QLineEdit</class> 320 <class>QLineEdit</class>
327 <property stdset="1"> 321 <property stdset="1">
328 <name>name</name> 322 <name>name</name>
329 <cstring>deviceNameLine</cstring> 323 <cstring>deviceNameLine</cstring>
330 </property> 324 </property>
331 </widget> 325 </widget>
332 <widget row="1" column="1" > 326 <widget row="1" column="1" >
333 <class>QLineEdit</class> 327 <class>QLineEdit</class>
334 <property stdset="1"> 328 <property stdset="1">
335 <name>name</name> 329 <name>name</name>
336 <cstring>passkeyLine</cstring> 330 <cstring>passkeyLine</cstring>
337 </property> 331 </property>
338 <property stdset="1"> 332 <property stdset="1">
339 <name>echoMode</name> 333 <name>echoMode</name>
340 <enum>Password</enum> 334 <enum>Password</enum>
341 </property> 335 </property>
342 </widget> 336 </widget>
343 </grid> 337 </grid>
344 </widget> 338 </widget>
345 </grid> 339 </grid>
346 </widget> 340 </widget>
347 <widget> 341 <widget>
348 <class>QWidget</class> 342 <class>QWidget</class>
349 <property stdset="1"> 343 <property stdset="1">
350 <name>name</name> 344 <name>name</name>
351 <cstring>tab</cstring> 345 <cstring>tab</cstring>
352 </property> 346 </property>
353 <attribute> 347 <attribute>
354 <name>title</name> 348 <name>title</name>
355 <string>Status</string> 349 <string>Status</string>
356 </attribute> 350 </attribute>
357 <vbox> 351 <vbox>
358 <property stdset="1"> 352 <property stdset="1">
359 <name>margin</name> 353 <name>margin</name>
360 <number>4</number> 354 <number>4</number>
361 </property> 355 </property>
362 <property stdset="1"> 356 <property stdset="1">
363 <name>spacing</name> 357 <name>spacing</name>
364 <number>2</number> 358 <number>2</number>
365 </property> 359 </property>
366 <widget> 360 <widget>
367 <class>QLabel</class> 361 <class>QLabel</class>
368 <property stdset="1"> 362 <property stdset="1">
369 <name>name</name> 363 <name>name</name>
370 <cstring>StatusLabel</cstring> 364 <cstring>StatusLabel</cstring>
371 </property> 365 </property>
372 <property stdset="1"> 366 <property stdset="1">
373 <name>text</name> 367 <name>text</name>
374 <string>Status Label</string> 368 <string>Status Label</string>
375 </property> 369 </property>
376 </widget> 370 </widget>
377 </vbox> 371 </vbox>
378 </widget> 372 </widget>
373 <widget>
374 <class>QWidget</class>
375 <property stdset="1">
376 <name>name</name>
377 <cstring>tab</cstring>
378 </property>
379 <attribute>
380 <name>title</name>
381 <string>Phone</string>
382 </attribute>
383 <vbox>
384 <property stdset="1">
385 <name>margin</name>
386 <number>0</number>
387 </property>
388 <property stdset="1">
389 <name>spacing</name>
390 <number>0</number>
391 </property>
392 <widget>
393 <class>QGroupBox</class>
394 <property stdset="1">
395 <name>name</name>
396 <cstring>cellForwarder</cstring>
397 </property>
398 <property stdset="1">
399 <name>title</name>
400 <string>Cell Forwarder</string>
401 </property>
402 <vbox>
403 <property stdset="1">
404 <name>margin</name>
405 <number>11</number>
406 </property>
407 <property stdset="1">
408 <name>spacing</name>
409 <number>6</number>
410 </property>
411 <widget>
412 <class>QLayoutWidget</class>
413 <property stdset="1">
414 <name>name</name>
415 <cstring>Layout9</cstring>
416 </property>
417 <vbox>
418 <property stdset="1">
419 <name>margin</name>
420 <number>0</number>
421 </property>
422 <property stdset="1">
423 <name>spacing</name>
424 <number>6</number>
425 </property>
426 <widget>
427 <class>QLayoutWidget</class>
428 <property stdset="1">
429 <name>name</name>
430 <cstring>Layout5</cstring>
431 </property>
432 <hbox>
433 <property stdset="1">
434 <name>margin</name>
435 <number>0</number>
436 </property>
437 <property stdset="1">
438 <name>spacing</name>
439 <number>6</number>
440 </property>
441 <widget>
442 <class>QLabel</class>
443 <property stdset="1">
444 <name>name</name>
445 <cstring>serDevLabel</cstring>
446 </property>
447 <property stdset="1">
448 <name>text</name>
449 <string>Serial device:</string>
450 </property>
451 </widget>
452 <widget>
453 <class>QLineEdit</class>
454 <property stdset="1">
455 <name>name</name>
456 <cstring>serDevName</cstring>
457 </property>
458 </widget>
459 </hbox>
460 </widget>
461 <widget>
462 <class>QLayoutWidget</class>
463 <property stdset="1">
464 <name>name</name>
465 <cstring>Layout6</cstring>
466 </property>
467 <hbox>
468 <property stdset="1">
469 <name>margin</name>
470 <number>0</number>
471 </property>
472 <property stdset="1">
473 <name>spacing</name>
474 <number>6</number>
475 </property>
476 <widget>
477 <class>QLabel</class>
478 <property stdset="1">
479 <name>name</name>
480 <cstring>serSpeedLabel</cstring>
481 </property>
482 <property stdset="1">
483 <name>text</name>
484 <string>Speed:</string>
485 </property>
486 </widget>
487 <widget>
488 <class>QComboBox</class>
489 <property stdset="1">
490 <name>name</name>
491 <cstring>serSpeed</cstring>
492 </property>
493 </widget>
494 </hbox>
495 </widget>
496 <widget>
497 <class>QPushButton</class>
498 <property stdset="1">
499 <name>name</name>
500 <cstring>runButton</cstring>
501 </property>
502 <property stdset="1">
503 <name>text</name>
504 <string>start gateway</string>
505 </property>
506 </widget>
507 </vbox>
508 </widget>
509 </vbox>
510 </widget>
511 </vbox>
512 </widget>
379 </widget> 513 </widget>
380 </grid> 514 </vbox>
381</widget> 515</widget>
516<customwidgets>
517 <customwidget>
518 <class>QWidget</class>
519 <header location="local">qwidget.h</header>
520 <sizehint>
521 <width>100</width>
522 <height>100</height>
523 </sizehint>
524 <container>0</container>
525 <sizepolicy>
526 <hordata>7</hordata>
527 <verdata>7</verdata>
528 </sizepolicy>
529 <pixmap>image0</pixmap>
530 </customwidget>
531</customwidgets>
532<images>
533 <image>
534 <name>image0</name>
535 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
536 </image>
537</images>
382</UI> 538</UI>