author | korovkin <korovkin> | 2006-04-14 19:22:37 (UTC) |
---|---|---|
committer | korovkin <korovkin> | 2006-04-14 19:22:37 (UTC) |
commit | a1bcbe41d45924713c4ead9b25ac5518473c9ca9 (patch) (unidiff) | |
tree | 3683eb401dd2d7cde4a7af15e72ecf7463b7208e | |
parent | bca53498f37ade8101611fecde82202e9ee1a55c (diff) | |
download | opie-a1bcbe41d45924713c4ead9b25ac5518473c9ca9.zip opie-a1bcbe41d45924713c4ead9b25ac5518473c9ca9.tar.gz opie-a1bcbe41d45924713c4ead9b25ac5518473c9ca9.tar.bz2 |
Added RFCOMM <-> serial line forwarding functionality.
-rw-r--r-- | noncore/net/opietooth/lib/bt-serial.c | 308 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/bt-serial.h | 57 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/forwarder.cc | 203 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/forwarder.h | 45 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/lib.pro | 6 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 61 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.h | 4 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluetoothbase.ui | 182 |
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 | |||
25 | static int hserv = -1; //Server socket | ||
26 | sdp_session_t* session = NULL; //session with an SDP server | ||
27 | |||
28 | static 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 | } | ||
94 | errout: | ||
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 | */ | ||
112 | int 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; | ||
128 | errout: | ||
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 | */ | ||
143 | int 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); | ||
171 | errout: | ||
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 | */ | ||
189 | int 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 | */ | ||
209 | int 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 | */ | ||
235 | int 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 | ||
13 | extern "C" { | ||
14 | #endif | ||
15 | |||
16 | typedef 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 | */ | ||
27 | int 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 | */ | ||
36 | int 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 | */ | ||
43 | int 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 | */ | ||
50 | int 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" | ||
19 | using namespace OpieTooth; | ||
20 | using namespace Opie::Core; | ||
21 | using namespace Opie::Core::Internal; | ||
22 | |||
23 | SerialForwarder::SerialForwarder(QString& devName, int dspeed) : | ||
24 | OProcess(), device(devName), speed(dspeed) | ||
25 | { | ||
26 | status = false; | ||
27 | } | ||
28 | |||
29 | SerialForwarder::~SerialForwarder() | ||
30 | { | ||
31 | stop(); | ||
32 | } | ||
33 | |||
34 | |||
35 | bool 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 | */ | ||
197 | int 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> | ||
17 | namespace Opie { | ||
18 | namespace Core { | ||
19 | class OProcess; | ||
20 | namespace Internal { | ||
21 | class OProcessController; | ||
22 | } | ||
23 | } | ||
24 | }; | ||
25 | |||
26 | namespace 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 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qte warn_on | 2 | CONFIG += 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 |
6 | INCLUDEPATH += $(OPIEDIR)/include . | 8 | INCLUDEPATH += $(OPIEDIR)/include . |
7 | DESTDIR = $(OPIEDIR)/lib | 9 | DESTDIR = $(OPIEDIR)/lib |
8 | LIBS += -lopiecore2 | 10 | LIBS += -lopiecore2 |
9 | 11 | ||
10 | include( $(OPIEDIR)/include.pro ) | 12 | include( $(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 | |||
@@ -12,81 +12,97 @@ | |||
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> |
30 | using namespace Opie::Core; | 34 | using 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 | ||
57 | using namespace OpieTooth; | 62 | using namespace OpieTooth; |
63 | //Array of possible speeds of the serial port | ||
64 | struct 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 | ||
59 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | 74 | BlueBase::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 ); |
@@ -99,24 +115,30 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | |||
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 | */ |
116 | void BlueBase::readConfig() | 138 | void 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 |
@@ -671,12 +693,51 @@ bool BlueBase::find( const RemoteDevice& rem ) | |||
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 | */ | ||
709 | void 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 | */ | ||
733 | void 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 | |||
@@ -8,24 +8,25 @@ | |||
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 | ||
24 | class QVBox; | 25 | class QVBox; |
25 | class QHBoxLayout; | 26 | class QHBoxLayout; |
26 | class QGridLayout; | 27 | class QGridLayout; |
27 | class QFrame; | 28 | class QFrame; |
28 | class QLabel; | 29 | class QLabel; |
29 | class QPushButton; | 30 | class QPushButton; |
30 | class QTabWidget; | 31 | class QTabWidget; |
31 | class QCheckBox; | 32 | class QCheckBox; |
@@ -70,33 +71,36 @@ namespace OpieTooth { | |||
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 | |||
@@ -2,48 +2,42 @@ | |||
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> |
@@ -367,16 +361,178 @@ | |||
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> | ||
379 | </widget> | 451 | </widget> |
380 | </grid> | 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> | ||
381 | </widget> | 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> | ||
513 | </widget> | ||
514 | </vbox> | ||
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> |