comparison g23m/condat/ms/src/mfw/mfw_bt.c @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
1 /*
2 +--------------------------------------------------------------------+
3 | PROJECT: MMI-Framework (8445) $Workfile:: mfw_bt.c $|
4 | $Author:: Rm $Revision:: 1 $|
5 | CREATED: 03.01.01 $Modtime:: 03.01.01 17:21 $|
6 | STATE : code |
7 +--------------------------------------------------------------------+
8
9
10 MODULE : MFW_BT
11
12 PURPOSE : This modul contains the functions for MFW-BT management.
13
14
15 */
16 #define ENTITY_MFW
17
18 #include <string.h>
19 #include <stdio.h>
20 #include <stdlib.h>
21
22 #include "typedefs.h"
23 #include "vsi.h"
24 #include "pei.h"
25 #include "custom.h"
26 #include "gsm.h"
27
28 #include "p_btp.h"
29 #include "Bti.h"
30 #include "bti_btp.h"
31 #include "bti_cb.h"
32
33 #include "mfw_mfw.h"
34 #include "mfw_bt.h"
35 #include "mfw_bta.h"
36 #include "mfw_acie.h"
37 #include "mfw_win.h"
38
39 /* static used structures/variables */
40 EXTERN MfwHdr * current_mfw_elem;
41
42 /*
43 +--------------------------------------------------------------------+
44 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
45 | STATE : code ROUTINE : bt_init |
46 +--------------------------------------------------------------------+
47
48 PURPOSE : initialize BT manager
49
50 */
51 int bt_init (void)
52 {
53 TRACE_FUNCTION("mfw_bt:bt_init()");
54 /*
55 * install prim handler (primitives directly to MFW)
56 */
57 pSlotBt = aci_create(bta_response_cb,NULL);
58 /*
59 * initialize internal lists for found services
60 */
61 found_headset.service = MFW_BT_HEADSET;
62 found_headset.device_id = NULL;
63 found_dial_up.service = MFW_BT_DIAL_UP;
64 found_dial_up.device_id = NULL;
65 found_fax.service = MFW_BT_FAX_GW;
66 found_fax.device_id = NULL;
67 found_opp.service = MFW_BT_OPP;
68 found_opp.device_id = NULL;
69 found_sync.service = MFW_BT_SYNC;
70 found_sync.device_id = NULL;
71 found_sync_cmd.service = MFW_BT_SYNC_CMD;
72 found_sync_cmd.device_id = NULL;
73 return TRUE;
74 }
75 /*
76 +--------------------------------------------------------------------+
77 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
78 | STATE : code ROUTINE : bt_exit |
79 +--------------------------------------------------------------------+
80
81 PURPOSE : finalize BT manager
82
83 */
84 void bt_exit (void)
85 {
86 TRACE_FUNCTION("bt_exit()");
87 /*
88 * remove prim handler
89 */
90 aci_delete(pSlotBt);
91 }
92 /*
93 +--------------------------------------------------------------------+
94 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
95 | STATE : code ROUTINE : bt_create |
96 +--------------------------------------------------------------------+
97
98 PURPOSE : create BT event handler and control block
99
100 */
101 T_MFW_HND bt_create (MfwHnd hWin, MfwEvt event, MfwCb cbfunc)
102 {
103 MfwHdr *hdr;
104 T_MFW_BT *bt_para;
105 MfwHdr *insert_status =0;
106
107 TRACE_FUNCTION("bt_create()");
108
109 hdr = (MfwHdr *) mfwAlloc(sizeof(MfwHdr));
110 bt_para = (T_MFW_BT *) mfwAlloc(sizeof(T_MFW_BT));
111
112 if (!hdr || !bt_para)
113 {
114 TRACE_ERROR("ERROR: bt_create() Mem Alloc Failed.");
115
116 if(hdr)
117 mfwFree((U8*)hdr,sizeof(MfwHdr));
118
119 if(bt_para)
120 mfwFree((U8*)bt_para,sizeof(T_MFW_BT));
121
122 return 0;
123 }
124
125 bt_para->emask = event;
126 bt_para->handler = cbfunc; /* event callback function */
127
128 hdr->data = bt_para;
129 hdr->type = MfwTypBt;
130
131 insert_status= mfwInsert((MfwHdr *) hWin,hdr); /* handle is brought in chain */
132 if(!insert_status)
133 {
134 TRACE_ERROR("ERROR: bt_create() Failed to Install Handler. ");
135 mfwFree((U8*)hdr,sizeof(MfwHdr));
136 mfwFree((U8*)bt_para,sizeof(T_MFW_BT));
137 return 0;
138 }
139 return insert_status;
140 }
141 /*
142 +--------------------------------------------------------------------+
143 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
144 | STATE : code ROUTINE : bt_delete |
145 +--------------------------------------------------------------------+
146
147 PURPOSE : delete BT event handler and control block, free Memory
148
149 */
150 MfwRes bt_delete (MfwHnd h)
151 {
152 TRACE_FUNCTION("bt_delete()");
153
154 if (!h || !((MfwHdr *) h)->data)
155 return MfwResIllHnd;
156
157 if (!mfwRemove((MfwHdr *) h))
158 return MfwResIllHnd;
159
160 mfwFree((U8 *) ((MfwHdr *) h)->data,sizeof(T_MFW_BT));
161 mfwFree((U8 *) h,sizeof(MfwHdr));
162
163 return MfwResOk;
164 }
165 /*
166 +--------------------------------------------------------------------+
167 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
168 | STATE : code ROUTINE : bt_signal |
169 +--------------------------------------------------------------------+
170
171 PURPOSE : Send a signal to MMI
172
173 */
174 void bt_signal (MfwEvt event, void *para)
175 { /*MC, SPR 1389, we have to enable the display whenever
176 we send an event up to the MMI*/
177 UBYTE temp = dspl_Enable(0);
178
179 TRACE_FUNCTION ("bt_signal()");
180
181 if (mfwSignallingMethod EQ 0) /* default search method (old bmi design) */
182 {
183 if (mfwFocus) /* look for element in focussed chain */
184 if (bt_sign_exec(mfwFocus,event,para))
185 { dspl_Enable(temp);/*MC, SPR 1389*/
186 return;
187 }
188 if (mfwRoot) /* look for element in root */
189 bt_sign_exec(mfwRoot,event,para);
190 }
191 else /* new bmi design */
192 {
193 MfwHdr * h = 0;
194 /*
195 * Focus set, then start here
196 */
197 if (mfwFocus)
198 h = mfwFocus;
199 /*
200 * Focus not set, then start root
201 */
202 if (!h)
203 h = mfwRoot;
204 /*
205 * No elements available, return
206 */
207 while (h)
208 {
209 /*
210 * Signal consumed, then return
211 */
212 if (bt_sign_exec (h, event, para))
213 { dspl_Enable(temp);/*MC, SPR 1389*/
214 return;
215 }
216 /*
217 * All windows tried inclusive root
218 */
219 if (h == mfwRoot)
220 { dspl_Enable(temp);/*MC, SPR 1389*/
221 return;
222 }
223 /*
224 * get parent window
225 */
226 h = mfwParent(mfwParent(h));
227 if(h)
228 h = ((MfwWin * )(h->data))->elems;
229 }
230 bt_sign_exec (mfwRoot, event, para);
231 }
232 dspl_Enable(temp);/*MC, SPR 1389*/
233
234 }
235 /*
236 +--------------------------------------------------------------------+
237 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
238 | STATE : code ROUTINE : bt_sign_exec |
239 +--------------------------------------------------------------------+
240
241 PURPOSE : Send a signal if BT management handler
242
243 */
244 int bt_sign_exec (MfwHdr *cur_elem, MfwEvt event, T_MFW_BT_PARA *para)
245 {
246 T_MFW_BT_SERVICE_SEARCH_CNF * search_confirmation_ptr;
247 T_MFW_BT_DEVICE_SEARCH_CNF * dev_search_conf_ptr;
248 T_MFW_BT_DISCONNECT_CNF * discon_ptr;
249 T_MFW_BT_DISCON_DUN_FAX_CNF * discon_dun_fax_ptr;
250 T_MFW_BT_DISCON_DUN_FAX_IND * discon_dun_fax_ind_ptr;
251 T_MFW_BT_DISCONNECT_IND * discon_i_ptr;
252 T_MFW_BT_CONNECT_CNF * connect_ptr;
253 T_MFW_BT_SRV_SYNC_CNF * srv_sync_complete;
254 T_MFW_BT_SRV_SYNC_AUTH_IND * srv_sync_auth_ind;
255 T_MFW_BT_SRV_SYNC_PULL_IND * srv_sync_pull_ind;
256 T_MFW_BT_SRV_SYNC_PUSH_IND * srv_sync_push_ind;
257 T_MFW_BT_SRV_SYNC_PUSH_CNF * srv_sync_push_cnf;
258 T_MFW_BT_BD_ADDR dummy_address[MFW_BT_ADDR_MAX_LEN];
259
260 memset(&dummy_address,0,sizeof(dummy_address));
261
262 TRACE_FUNCTION("bt_sign_exec()");
263
264 while (cur_elem)
265 {
266 if (cur_elem->type EQ MfwTypBt)
267 {
268 T_MFW_BT *bt_data;
269 bt_data = (T_MFW_BT *) cur_elem->data;
270 if (bt_data->emask & event)
271 {
272 bt_data->event = event;
273 switch (event)
274 {
275
276 case BT_CREATE_PROFILE_CNF:
277 memcpy(&bt_data->para.prof_create_cnf, para,sizeof(T_MFW_BT_PROFILE_CREATE_CNF));
278 break;
279
280 case BT_DELETE_PROFILE_CNF:
281 memcpy(&bt_data->para.prof_delete_cnf, para,sizeof(T_MFW_BT_PROFILE_DELETE_CNF));
282 break;
283
284 case BT_INIT_PROFILE_CNF: /* confirms initialize/reconfiguration of service profile */
285 memcpy(&bt_data->para.profile,
286 para,sizeof(T_MFW_BT_PROFILE_CNF));
287 /* service,result_bd,subtype(,mfw_opp_mode,mfw_sync_mode,mfw_syn_aut_mode) with event BT_INIT_PROFILE_CNF to MMI */
288 break;
289
290 case BT_DEINIT_PROFILE_CNF:/* confirms deinitialize profile */
291 memcpy(&bt_data->para.profile,
292 para,sizeof(T_MFW_BT_PROFILE_CNF));
293 /* service,result_bd,subtype(,mfw_opp_mode,mfw_sync_mode,mfw_syn_aut_mode) with event BT_DEINIT_PROFILE_CNF to MMI */
294 break;
295 }
296
297 switch (event)
298 {
299 case BT_RESTORE_LIST_RESULT:/* result restoring default service list */
300 memcpy(&bt_data->para.restore_conf,
301 para,sizeof(T_MFW_BT_REST_CONFIG));
302 /* service and cause with event BT_RESTORE_LIST_RESULT to MMI */
303 break;
304
305 case BT_RESTORE_CONF_RESULT:/* result restoring configuration parameter */
306 memcpy(&bt_data->para.restore_conf,
307 para,sizeof(T_MFW_BT_REST_CONFIG));
308 /* service and cause with event BT_RESTORE_CONF_RESULT to MMI */
309 break;
310
311 case BT_SERVICE_SEARCH_CNF:
312 search_confirmation_ptr = (T_MFW_BT_SERVICE_SEARCH_CNF *)para;
313 if(search_confirmation_ptr->service EQ MFW_BT_HEADSET)
314 {
315 /* pointer of list of detected hs to mmi */
316 bt_data->para.service_lst_p.list_ptr = &found_headset;
317 }
318 else if(search_confirmation_ptr->service EQ MFW_BT_DIAL_UP)
319 {
320 /* pointer of list of detected dial up to mmi */
321 bt_data->para.service_lst_p.list_ptr = &found_dial_up;
322 }
323 else if(search_confirmation_ptr->service EQ MFW_BT_FAX_GW)
324 {
325 /* pointer of list of detected fax to mmi */
326 bt_data->para.service_lst_p.list_ptr = &found_fax;
327 }
328 else if(search_confirmation_ptr->service EQ MFW_BT_OPP)
329 {
330 /* pointer of list of detected opp to mmi */
331 bt_data->para.service_lst_p.list_ptr = &found_opp;
332 }
333 else if(search_confirmation_ptr->service EQ MFW_BT_SYNC)
334 {
335 /* pointer of list of detected sync server to mmi */
336 bt_data->para.service_lst_p.list_ptr = &found_sync;
337 }
338 else if(search_confirmation_ptr->service EQ MFW_BT_SYNC_CMD)
339 {
340 /* pointer of list of detected sync server with command support to mmi */
341 bt_data->para.service_lst_p.list_ptr = &found_sync_cmd;
342 }
343 break;
344
345 case BT_DEVICE_SEARCH_CNF:
346 dev_search_conf_ptr = (T_MFW_BT_DEVICE_SEARCH_CNF *)para;
347 if(dev_search_conf_ptr->result EQ BTI_OK)
348 {/* pointer of list of found services to mmi */
349 bt_data->para.device_lst_p.list_ptr = &service_list;
350 }
351 break;
352
353 case BT_DEVICE_FOUND_IND: /* new device was found */
354 memcpy(&bt_data->para.device_ind, para, sizeof(T_MFW_BT_DEVICE_IND));
355 break;
356
357 case BT_SERVICE_FOUND_IND: /* new service was found */
358 memcpy(&bt_data->para.service_ind, para, sizeof(T_MFW_BT_SERVICE_IND));
359 break;
360
361 case BT_CONNECT_DEVICE_CNF:
362 connect_ptr = (T_MFW_BT_CONNECT_CNF *)para;
363 if(connect_ptr->service EQ MFW_BT_HEADSET)
364 {
365 memcpy(&bt_data->para.connect_cnf,
366 para,sizeof(T_MFW_BT_CONNECT_CNF));
367 }
368 else
369 return FALSE;
370 break;
371
372 case BT_SRV_SYNC_CNF:
373 srv_sync_complete = (T_MFW_BT_SRV_SYNC_CNF *)para;
374 if(srv_sync_complete->service EQ MFW_BT_SYNC)
375 {
376 memcpy(&bt_data->para.srv_sync_cnf,
377 para,sizeof(T_MFW_BT_SRV_SYNC_CNF));
378 }
379 else
380 return FALSE;
381 break;
382
383 case BT_SRV_SYNC_AUTH_IND:
384 srv_sync_auth_ind = (T_MFW_BT_SRV_SYNC_AUTH_IND *)para;
385 if(srv_sync_auth_ind->service EQ MFW_BT_SYNC)
386 {
387 memcpy(&bt_data->para.srv_sync_auth,
388 para,sizeof(T_MFW_BT_SRV_SYNC_AUTH_IND));
389 }
390 else
391 return FALSE;
392 break;
393
394 case BT_SRV_SYNC_PULL_IND:
395 srv_sync_pull_ind = (T_MFW_BT_SRV_SYNC_PULL_IND *)para;
396 if(srv_sync_pull_ind->service EQ MFW_BT_SYNC)
397 {
398 memcpy(&bt_data->para.sync_pull_ind,
399 para,sizeof(T_MFW_BT_SRV_SYNC_PULL_IND));
400 }
401 else
402 return FALSE;
403 break;
404
405 case BT_SRV_SYNC_PUSH_IND:
406 srv_sync_push_ind = (T_MFW_BT_SRV_SYNC_PUSH_IND *)para;
407 if(srv_sync_push_ind->service EQ MFW_BT_SYNC)
408 {
409 memcpy(&bt_data->para.sync_push_ind,
410 para,sizeof(T_MFW_BT_SRV_SYNC_PUSH_IND));
411 }
412 else
413 return FALSE;
414 break;
415
416 case BT_SRV_SYNC_PUSH_CNF:
417 srv_sync_push_cnf = (T_MFW_BT_SRV_SYNC_PUSH_CNF *)para;
418 if(srv_sync_push_cnf->service EQ MFW_BT_SYNC)
419 {
420 memcpy(&bt_data->para.sync_push_cnf,
421 para,sizeof(T_MFW_BT_SRV_SYNC_PUSH_CNF));
422 }
423 else
424 return FALSE;
425 break;
426 }
427
428 switch (event)
429 {
430
431 case BT_HSG_SPECIFIC_CMD_CFM:
432 memcpy(&bt_data->para.hsg_specific_cmd_cfm, para,sizeof(T_MFW_BT_HSG_SPECIFIC_CMD_CFM));
433 break;
434
435 case BT_HSG_HEADSET_CONNECTION_IND:
436 memcpy(&bt_data->para.hsg_headset_connection_ind, para,sizeof(T_MFW_BT_HSG_HEADSET_CONNECTION_IND));
437 break;
438
439 case BT_HSG_SAVE_LIST_CNF:
440 memcpy(&bt_data->para.hsg_save_list_cnf, para,sizeof(T_MFW_BT_HSG_SAVE_LIST_CNF));
441 break;
442 }
443
444 switch (event)
445 {
446 case BT_CONNECT_DEVICE_IND:
447 memcpy(&bt_data->para.connect_indication,
448 para,sizeof(T_MFW_BT_CONNECT_IND));
449 /* service with event BT_CONNECT_DEVICE_IND to MMI */
450 break;
451
452 case BT_CONNECT_DEVICE_INF:
453 memcpy(&bt_data->para.connect_information,
454 para,sizeof(T_MFW_BT_CONNECT_INF));
455 /* service with event BT_CONNECT_DEVICE_INF to MMI */
456 break;
457
458
459 case BT_DISCONNECT_DEVICE_CNF:
460 discon_ptr = (T_MFW_BT_DISCONNECT_CNF *)para;
461 if(discon_ptr->service EQ MFW_BT_HEADSET)
462 {
463 /* confirms disconnection */
464 memcpy(&bt_data->para.disconnect_cnf,
465 para,sizeof(T_MFW_BT_DISCONNECT_CNF));
466 /* service, addr with event BT_DISCONNECT_DEVICE_CNF to MMI */
467 break;
468 }
469 else
470 return FALSE;
471
472 case BT_DISCON_DUN_FAX_CNF:
473 discon_dun_fax_ptr = (T_MFW_BT_DISCON_DUN_FAX_CNF *)para;
474 if((discon_dun_fax_ptr->service EQ MFW_BT_DIAL_UP) OR
475 (discon_dun_fax_ptr->service EQ MFW_BT_FAX_GW))
476 {
477 /* confirms disconnection by remote dial up/fax */
478 memcpy(&bt_data->para.disc_dun_fax_cnf,
479 para,sizeof(T_MFW_BT_DISCON_DUN_FAX_CNF));
480 /* device, result with event BT_DISCON_DUN_FAX_CNF to MMI */
481 break;
482 }
483 else
484 return FALSE;
485
486 case BT_DISCONNECT_DEVICE_IND:
487 discon_i_ptr = (T_MFW_BT_DISCONNECT_IND *)para;
488 if(discon_i_ptr->service EQ MFW_BT_HEADSET)
489 {
490 /* confirms indication */
491 memcpy(&bt_data->para.disconnect_ind,
492 para,sizeof(T_MFW_BT_DISCONNECT_IND));
493 /* service, addr, error_cause with event BT_DISCONNECT_DEVICE_IND to MMI */
494 break;
495 }
496 else
497 return FALSE;
498
499 case BT_DISCON_DUN_FAX_IND:
500 discon_dun_fax_ind_ptr = (T_MFW_BT_DISCON_DUN_FAX_IND *)para;
501 if((discon_dun_fax_ind_ptr->service EQ MFW_BT_DIAL_UP) OR
502 (discon_dun_fax_ind_ptr->service EQ MFW_BT_FAX_GW))
503 {
504 /* indicats disconnection by remote dial up */
505 memcpy(&bt_data->para.con_dun_fax_ind,
506 para,sizeof(T_MFW_BT_DISCON_DUN_FAX_IND));
507 /* device, result with event BT_DISCON_DUN_FAX_IND to MMI */
508 break;
509 }
510 else
511 return FALSE;
512 }
513
514 switch (event) /* BT CTRL */
515 {
516 case BT_CHNG_LOCAL_NAME:
517 memcpy(&bt_data->para.chng_local_name, para, sizeof(T_MFW_BT_CHNG_LOCAL_NAME));
518 break;
519
520 case BT_READ_LOCAL_NAME:
521 memcpy(&bt_data->para.read_local_name, para, sizeof(T_MFW_BT_READ_LOCAL_NAME));
522 break;
523
524 case BT_REMOTE_DEV_INFO_RES:
525 memcpy(&bt_data->para.remote_dev_info, para, sizeof(T_MFW_BT_REMOTE_DEV_INFO_RES));
526 break;
527
528 case BT_CHNG_CONNECTABLE_MODE:
529 memcpy(&bt_data->para.chng_conn_mode, para, sizeof(T_MFW_BT_CHNG_CONNECTABLE_MODE));
530 break;
531
532 case BT_CHNG_DISCOVERABLE_MODE:
533 memcpy(&bt_data->para.chng_disc_mode, para, sizeof(T_MFW_BT_CHNG_DISCOVERABLE_MODE));
534 break;
535
536 case BT_READ_BD_ADDR:
537 memcpy(&bt_data->para.read_bd_addr, para, sizeof(T_MFW_BT_READ_BD_ADDR));
538 break;
539
540 case BT_TRUSTED_DEV_LIST_FULL:
541 break;
542
543 }
544
545 switch (event)
546 {
547
548 case BT_TRANSFER_AUDIO_IN_CNF:
549 /* confirms transfer audio out */
550 memcpy(&bt_data->para.audio_in_cnf,
551 para,sizeof(T_MFW_BT_TRANSFER_AUDIO_IN_CNF));
552 /* service, addr with event BT_TRANSFER_AUDIO_IN_CNF to MMI */
553 break;
554
555 case BT_TRANSFER_AUDIO_OUT_CNF:
556 /* confirms transfer audio in */
557 memcpy(&bt_data->para.audio_out_cnf,
558 para,sizeof(T_MFW_BT_TRANSFER_AUDIO_OUT_CNF));
559 /* service, addr with event BT_TRANSFER_AUDIO_OUT_CNF to MMI */
560 break;
561
562 case BT_AUTHORIZATION_IND:
563 /* indicats remote device authorization request */
564 memcpy(&bt_data->para.authoriz_ind,
565 para,sizeof(T_MFW_BT_AUTHORIZATION_IND));
566 /* addr,remote name,service name, authorization_mask,connection_dir with event BT_AUTHORIZATION_IND to MMI */
567 break;
568
569 case BT_PIN_IND:
570 /* indicats remote pin request */
571 memcpy(&bt_data->para.pin_ind,
572 para,sizeof(T_MFW_BT_PIN_IND));
573 /* addr,name with event BT_PIN_IND to MMI */
574 break;
575
576 case BT_RECONFIG_PROFILE_CNF:
577 /* confirm reconfiguration profile */
578 memcpy(&bt_data->para.profile,
579 para,sizeof(T_MFW_BT_PROFILE_CNF));
580 /* service, result_bd(,mfw_opp_mode,mfw_sync_mode,mfw_syn_aut_mode) with event BT_RECONFIG_PROFILE_CNF to MMI */
581 break;
582
583 case BT_DEVICE_PAIRED_IND:
584 /* confirm pairing procedure */
585 memcpy(&bt_data->para.pair_ind,
586 para,sizeof(T_MFW_BT_DEV_PAIR_IND));
587 /* remote addr, remote name and pair_res with event BT_DEVICE_PAIRED_IND to MMI */
588 break;
589
590 case BT_CALL_MONITORING_STATUS:
591 /* indicats call monitoring events by dun/fax */
592 memcpy(&bt_data->para.call_status,
593 para,sizeof(T_MFW_BT_CALL_STATUS_DUN_FAX));
594 /* device and call status with event BT_CALL_MONITORING_STATUS to MMI */
595 break;
596
597 case BT_OPP_SERV_PUT_IND:
598 /* indicats put request by opp server */
599 memcpy(&bt_data->para.opp_s_obj,
600 para,sizeof(T_MFW_BT_OPP_PUT_IND));
601 /* device,subtype,client_addr,object with event BT_OPP_SERV_PUT_IND to MMI */
602 break;
603
604 case BT_OPP_SERV_PUT_CNF:
605 /* indicats put request by opp server (server side) */
606 memcpy(&bt_data->para.opp_s_obj_cnf,
607 para,sizeof(T_MFW_BT_OPP_PUT_CNF));
608 /* device,subtype,client_addr,object,error with event BT_OPP_SERV_PUT_CNF to MMI */
609 break;
610
611 case BT_OPP_OBJECT_PUSH_CNF:
612 /* indicats push object to opp server (client side)*/
613 memcpy(&bt_data->para.opp_cl_push_ob_cnf,
614 para,sizeof(T_MFW_BT_OPP_PUSH_CNF));
615 /* device,subtype,server_addr,object,error with event BT_OPP_OBJECT_PUSH_CNF to MMI */
616 break;
617
618 case BT_OPP_OBJECT_PULL_CNF:
619 /* indicats push object from opp server (client side)*/
620 memcpy(&bt_data->para.opp_cl_pull_ob_cnf,
621 para,sizeof(T_MFW_BT_OPP_PULL_CNF));
622 /* device,subtype,server_addr,object,error with event BT_OPP_OBJECT_PULL_CNF to MMI */
623 break;
624 }
625
626 /*#ifdef PCA_6350*/
627 switch (event)
628 {
629 case BT_PCA_GW_STATUS_CFM:
630 memcpy(&bt_data->para.pca_gw_status, para, sizeof(T_MFW_BT_PCA_GW_STATUS_CFM));
631 break;
632 case BT_PCA_GW_LINK_MONITORING:
633 memcpy(&bt_data->para.pca_link_mon, para, sizeof(T_MFW_BT_PCA_GW_LINK_MONITORING));
634 break;
635 case BT_PCA_GW_CALL_MONITORING:
636 memcpy(&bt_data->para.pca_call_mon, para, sizeof(T_MFW_BT_PCA_GW_CALL_MONITORING));
637 break;
638 case BT_PCA_GW_HANGUP_CFM:
639 memcpy(&bt_data->para.pca_hangup, para, sizeof(T_MFW_BT_PCA_GW_HANGUP_CFM));
640 break;
641 }
642 /*#endif*/ /* PCA_6350 */
643 if (bt_data->handler)
644 {
645 current_mfw_elem = cur_elem;
646 /* to call back function in mmi */
647 if ((*(bt_data->handler))(bt_data->event,
648 (void *) &bt_data->para))
649 return TRUE;
650 }
651 }
652 }/* next element for look for type of handle */
653 cur_elem = cur_elem->next;
654 }
655 return FALSE;
656 }
657 /*
658 +--------------------------------------------------------------------+
659 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
660 | STATE : code ROUTINE : bt_init_profile_hsg_cl|
661 +--------------------------------------------------------------------+
662
663 PURPOSE : configure and initialize a BT headset profile in client mode
664
665 */
666 T_MFW_BT_RESULT_BT bt_init_profile_hsg_cl (T_MFW_BT_SERVICE_TYPE service,
667 T_MFW_BT_HSG_CLIENT_CONFIG mfw_config)
668 {
669 T_BTI_HSG_CLIENT_CONF bt_config;
670
671 TRACE_FUNCTION ("bt_init_profile_hsg_cl()");
672
673 memset(&bt_config,0,sizeof(bt_config));
674
675 if(service EQ MFW_BT_HEADSET)
676 {
677 /* type of connection:
678 *** MFW_BT_AUTO_OUTG_DEF_CONN_OFF or
679 MFW_BT_AUTO_OUTG_DEF_CONN_ON
680 (connection with default pre-defined headset as soon as it receives a
681 RING command from GSM)
682 ***
683 */
684 switch(mfw_config.config_mode)
685 {
686 case MFW_BT_AUTO_OUTG_DEF_CONN_OFF:
687 bt_config.config_mode = BTI_AUTO_OUTG_DEF_CONN_OFF;
688 break;
689 case MFW_BT_AUTO_OUTG_DEF_CONN_ON:
690 bt_config.config_mode = BTI_AUTO_OUTG_DEF_CONN_ON;
691 break;
692 }
693
694 bt_config.security = mfw_config.security;
695
696 switch(btibtp_init_profile_hsg_req_cl((T_BTI_DEVICE_TYPE)service,bt_config))
697 {/* BTP_INIT_PROFILE_REQ to BT */
698 case BTP_OK:
699 return MFW_BT_EXECUTE;
700 case BTP_INVALID_PARAMETER:
701 return MFW_BT_INVALID_PARA;
702 case BTP_NOT_SUPP:
703 return MFW_BT_NO_SUPP;
704 case BTP_NOT_READY:
705 return MFW_BT_NOT_READY;
706 case BTP_INT_ERR:
707 return MFW_BT_INT_ERR;
708 case BTP_MEMORY_ERR:
709 return MFW_BT_MEM_ERR;
710 case BTP_NOK:
711 return MFW_BT_NOK;
712 }
713 }
714 return MFW_BT_FAIL;
715 }
716
717 /*
718 +----------------------------------------------------------------------+
719 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
720 | STATE : code ROUTINE : bt_init_profile_hsg_serv|
721 +----------------------------------------------------------------------+
722
723 PURPOSE : configure and initialize a BT headset profile in server mode
724
725 */
726 T_MFW_BT_RESULT_BT bt_init_profile_hsg_serv (T_MFW_BT_SERVICE_TYPE service,
727 T_MFW_BT_HSG_SERVER_CONFIG mfw_config)
728 {
729 T_BTI_HSG_SERVER_CONF bt_config;
730
731 TRACE_FUNCTION ("bt_init_profile_hsg_serv()");
732
733 memset(&bt_config,0,sizeof(bt_config));
734
735 if(service EQ MFW_BT_HEADSET)
736 {
737 bt_config.conn_config = mfw_config.serv_con_conf;
738 /* length scan of connection requests of remote headsets *
739 /* default value: MFW_BT_CONN_SCAN_TIME_DEFAULT_VALUE */
740 bt_config.conn_time = mfw_config.conn_time;
741 /* period between 2 scans of connection of remote headsets */
742 /* default value: MFW_BT_CONN_SCAN_BREAK_DEFAULT_VALUE */
743 bt_config.conn_break= mfw_config.conn_break;
744 /* number of phone number in phone list */
745 bt_config.nb_phone = mfw_config.nb_phone;
746 /* phone number list of remote headset */
747 memcpy(bt_config.phon_list,mfw_config.mfw_phone_list,sizeof(mfw_config.mfw_phone_list));
748 /* associatd key list of remote headset */
749 memcpy(bt_config.key_list,mfw_config.mfw_key_list,sizeof(mfw_config.mfw_key_list));
750
751 bt_config.security = mfw_config.security;
752
753 switch(btibtp_init_profile_hsg_req_serv((T_BTI_DEVICE_TYPE)service,bt_config))
754 {/* BTP_INIT_PROFILE_REQ to BT */
755 case BTP_OK:
756 return MFW_BT_EXECUTE;
757 case BTP_INVALID_PARAMETER:
758 return MFW_BT_INVALID_PARA;
759 case BTP_NOT_SUPP:
760 return MFW_BT_NO_SUPP;
761 case BTP_NOT_READY:
762 return MFW_BT_NOT_READY;
763 case BTP_INT_ERR:
764 return MFW_BT_INT_ERR;
765 case BTP_MEMORY_ERR:
766 return MFW_BT_MEM_ERR;
767 case BTP_NOK:
768 return MFW_BT_NOK;
769 }
770 }
771 return MFW_BT_FAIL;
772 }
773 /*
774 +--------------------------------------------------------------------+
775 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
776 | STATE : code ROUTINE : bt_init_profile_dun|
777 +--------------------------------------------------------------------+
778
779 PURPOSE : configure and initialize a BT dialup profile
780
781 */
782 T_MFW_BT_RESULT_BT bt_init_profile_dun (T_MFW_BT_SERVICE_TYPE service,
783 T_MFW_BT_DUN_CONFIG dun_filter)
784 {
785 T_BTI_DUN_CONF dun_config;
786
787 TRACE_FUNCTION ("bt_init_profile_dun()");
788
789 memset(&dun_config,0,sizeof(dun_config));
790
791 if(service EQ MFW_BT_DIAL_UP)
792 {/* show status of BT link - informs if a serial port is opened between DUN-DT and DUN-GW */
793 if((dun_filter.link_event EQ BTI_DUN_LINK_MONIT_ON) OR
794 (dun_filter.link_event EQ BTI_DUN_LINK_MONIT_OFF))
795 {
796 dun_config.link_filter = dun_filter.link_event;
797 }
798 else
799 {
800 TRACE_EVENT ("Error:bt_init_profile_dun()");
801 return MFW_BT_FAIL;
802 }
803 /* show status of data call */
804 if((dun_filter.call_event EQ BTI_DUN_CALL_MONIT_ON) OR
805 (dun_filter.call_event EQ BTI_DUN_CALL_MONIT_OFF))
806 {
807 dun_config.call_filter = dun_filter.call_event;
808 }
809 else
810 {
811 TRACE_EVENT ("Error:bt_init_profile_dun()");
812 return MFW_BT_FAIL;
813 }
814
815 switch(btibtp_init_profile_dun_req((T_BTI_DEVICE_TYPE)service,dun_config))
816 {/* BTP_INIT_PROFILE_REQ to BT */
817 case BTP_OK:
818 return MFW_BT_EXECUTE;
819 case BTP_INVALID_PARAMETER:
820 return MFW_BT_INVALID_PARA;
821 case BTP_NOT_SUPP:
822 return MFW_BT_NO_SUPP;
823 case BTP_NOT_READY:
824 return MFW_BT_NOT_READY;
825 case BTP_INT_ERR:
826 return MFW_BT_INT_ERR;
827 case BTP_MEMORY_ERR:
828 return MFW_BT_MEM_ERR;
829 case BTP_NOK:
830 return MFW_BT_NOK;
831 }
832 }
833 return MFW_BT_FAIL;
834 }
835
836 /*
837 +--------------------------------------------------------------------+
838 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
839 | STATE : code ROUTINE : bt_init_profile_fax|
840 +--------------------------------------------------------------------+
841
842 PURPOSE : configure and initialize a BT fax gateway profile
843
844 */
845 T_MFW_BT_RESULT_BT bt_init_profile_fax (T_MFW_BT_SERVICE_TYPE service,
846 T_MFW_BT_FAX_CONFIG fax_filter)
847 {
848 T_BTI_FAX_CONF fax_config;
849
850 TRACE_FUNCTION ("bt_init_profile_fax()");
851
852 memset(&fax_config,0,sizeof(fax_config));
853
854 if(service EQ MFW_BT_FAX_GW)
855 {/* show status of BT link - informs if a serial port is opened between FAX-DT and FAX-GW */
856 if((fax_filter.link_event EQ BTI_FAX_LINK_MONIT_ON) OR
857 (fax_filter.link_event EQ BTI_FAX_LINK_MONIT_OFF))
858 {
859 fax_config.link_filter = fax_filter.link_event;
860 }
861 else
862 {
863 TRACE_EVENT ("Error:bt_init_profile_fax()");
864 return MFW_BT_FAIL;
865 }
866 /* show status of data call */
867 if((fax_filter.call_event EQ BTI_FAX_CALL_MONIT_ON) OR
868 (fax_filter.call_event EQ BTI_FAX_CALL_MONIT_OFF))
869 {
870 fax_config.call_filter = fax_filter.call_event;
871 }
872 else
873 {
874 TRACE_EVENT ("Error:bt_init_profile_fax()");
875 return MFW_BT_FAIL;
876 }
877
878 switch(btibtp_init_profile_fax_req((T_BTI_DEVICE_TYPE)service,fax_config))
879 {/* BTP_INIT_PROFILE_REQ to BT */
880 case BTP_OK:
881 return MFW_BT_EXECUTE;
882 case BTP_INVALID_PARAMETER:
883 return MFW_BT_INVALID_PARA;
884 case BTP_NOT_SUPP:
885 return MFW_BT_NO_SUPP;
886 case BTP_NOT_READY:
887 return MFW_BT_NOT_READY;
888 case BTP_INT_ERR:
889 return MFW_BT_INT_ERR;
890 case BTP_MEMORY_ERR:
891 return MFW_BT_MEM_ERR;
892 case BTP_NOK:
893 return MFW_BT_NOK;
894 }
895 }
896 return MFW_BT_FAIL;
897 }
898
899 /*
900 +--------------------------------------------------------------------+
901 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
902 | STATE : code ROUTINE : bt_init_profile_opp|
903 +--------------------------------------------------------------------+
904
905 PURPOSE : configure and initialize a BT OPP client or server
906 */
907 T_MFW_BT_RESULT_BT bt_init_profile_opp (T_MFW_BT_SERVICE_TYPE service,
908 T_MFW_BT_SUBTYPE_DEV subtype,
909 T_MFW_BT_OPP_SERVER_CONFIG serv_config)
910 {
911 T_BTI_OPP_SERVER_CONFIG bt_opp_s_conf;
912
913 TRACE_FUNCTION ("bt_init_profile_opp()");
914
915 memset(&bt_opp_s_conf,0,sizeof(bt_opp_s_conf));
916
917 if(service EQ MFW_BT_OPP)
918 {
919 if(subtype EQ MFW_BT_CLIENT)
920 {
921 switch(btibtp_init_profile_opp_cl())
922 {/* BTP_INIT_PROFILE_REQ to BT */
923 case BTP_OK:
924 return MFW_BT_EXECUTE;
925 case BTP_INVALID_PARAMETER:
926 return MFW_BT_INVALID_PARA;
927 case BTP_NOT_SUPP:
928 return MFW_BT_NO_SUPP;
929 case BTP_NOT_READY:
930 return MFW_BT_NOT_READY;
931 case BTP_INT_ERR:
932 return MFW_BT_INT_ERR;
933 case BTP_MEMORY_ERR:
934 return MFW_BT_MEM_ERR;
935 case BTP_NOK:
936 return MFW_BT_NOK;
937 }
938 }
939 else if(subtype EQ MFW_BT_SERVER)
940 {
941 /* mode of OPP server:
942 MFW_BT_OPP_NO_MODE: no OPP server mode
943 MFW_BT_OPP_SILENT_MODE: OPP server stores objects as files without alerting the user
944 MFW_BT_OPP_FILE_MODE: OPP server stores objects as files with alerting user
945 MFW_BT_OPP_BUFFER_MODE: OPP server asks for a buffer to store the each object
946 */
947
948 switch(serv_config.mfw_opp_mode)
949 {
950 case MFW_BT_OPP_NO_MODE:
951 bt_opp_s_conf.bt_opp_mode = BTI_NO_OPP_MODE;
952 break;
953 case MFW_BT_OPP_BUFFER_MODE:
954 bt_opp_s_conf.bt_opp_mode = BTI_OPP_EVENT_BUFFER_MODE;
955 break;
956 case MFW_BT_OPP_FILE_MODE:
957 bt_opp_s_conf.bt_opp_mode = BTI_OPP_EVENT_FILE_MODE;
958 break;
959 case MFW_BT_OPP_SILENT_MODE:
960 bt_opp_s_conf.bt_opp_mode = BTI_OPP_SILENT_FILE_MODE;
961 break;
962 default:
963 return MFW_BT_FAIL;
964 }
965 /* this function change the parameter of the existing OPP server */
966 /* initalizing of an OBEX server and service, registration in SDP and enabling of OPP server took place
967 after switching power on */
968 switch(serv_config.mfw_opp_object.mfw_object_type)
969 {
970 case MFW_BT_BUFFER:/* object is stored in buffer */
971 bt_opp_s_conf.bt_object.bt_object_type = BTI_TYPE_BUFFER;
972 bt_opp_s_conf.bt_object.bt_buffer_start = serv_config.mfw_opp_object.mfw_buffer_start;
973 bt_opp_s_conf.bt_object.bt_buffer_size = serv_config.mfw_opp_object.mfw_buffer_size;
974 break;
975 case MFW_BT_PATH:/* object is stored in file system */
976 bt_opp_s_conf.bt_object.bt_object_type = BTI_TYPE_PATH;
977 /* path of default_business_card of server */
978 bt_opp_s_conf.bt_object.bt_path = serv_config.mfw_opp_object.mfw_path;
979 /* path of inbox folder in file system of OPP server */
980 bt_opp_s_conf.bt_inbox_path = serv_config.mfw_inbox_path;
981 break;
982 default:
983 return MFW_BT_FAIL;
984
985 }
986 /* MIME type of object, null-terminated string */
987 bt_opp_s_conf.bt_object.bt_object_mime_type = serv_config.mfw_opp_object.mfw_object_mime_type;
988 /* name of default_business_card of server */
989 bt_opp_s_conf.bt_object.bt_object_name = serv_config.mfw_opp_object.mfw_object_name;
990 /* length of default_business_card of server */
991 bt_opp_s_conf.bt_object.bt_object_length = serv_config.mfw_opp_object.mfw_object_length;
992
993 switch(btibtp_init_profile_opp_s(bt_opp_s_conf))
994 {/* BTP_INIT_PROFILE_REQ to BT */
995 case BTP_OK:
996 return MFW_BT_EXECUTE;
997 case BTP_INVALID_PARAMETER:
998 return MFW_BT_INVALID_PARA;
999 case BTP_NOT_SUPP:
1000 return MFW_BT_NO_SUPP;
1001 case BTP_NOT_READY:
1002 return MFW_BT_NOT_READY;
1003 case BTP_INT_ERR:
1004 return MFW_BT_INT_ERR;
1005 case BTP_MEMORY_ERR:
1006 return MFW_BT_MEM_ERR;
1007 case BTP_NOK:
1008 return MFW_BT_NOK;
1009 }
1010 }
1011 else
1012 return MFW_BT_FAIL;
1013 }
1014 return MFW_BT_FAIL;
1015 }
1016
1017 /*
1018 +----------------------------------------------------------------------+
1019 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
1020 | STATE : code ROUTINE : bt_init_profile_syn_s |
1021 +----------------------------------------------------------------------+
1022
1023 PURPOSE : configure and initialize a BT SYNC profile in server mode
1024
1025 */
1026 T_MFW_BT_RESULT_BT bt_init_profile_syn_s (T_MFW_BT_SERVICE_TYPE service,
1027 T_MFW_BT_SUBTYPE_DEV subtype,
1028 T_MFW_BT_SYN_OBJECT_STORE_LIST list_availabe_objects,
1029 T_MFW_BT_SYNC_SERVER_CONFIG mfw_config)
1030 {
1031 T_BTI_SYNC_SERVER_CONFIG bt_config;
1032 T_BTI_SYN_OBJECT_STORE_LIST bt_list_sync_objects;
1033 TRACE_FUNCTION ("bt_init_profile_syn_s()");
1034
1035 memset(&bt_config,0,sizeof(bt_config));
1036 bt_list_sync_objects = (T_BTI_SYN_OBJECT_STORE_LIST)list_availabe_objects;
1037
1038 if(service EQ MFW_BT_SYNC)
1039 {
1040 if(subtype EQ MFW_BT_SERVER)
1041 {
1042 switch(mfw_config.mfw_syn_srv_mode)
1043 {
1044 case MFW_BT_SYNC_GEN_MODE:
1045 /* general SYNC server mode, for devices
1046 which are made discoverable continuously or for no
1047 specific conditions, the server is in connectable mode; the Sync
1048 client connects the server and starts the synchronization */
1049 bt_config.bt_sync_srv_mode = mfw_config.mfw_syn_srv_mode;
1050 break;
1051 case MFW_BT_SYNC_INIT_MODE:
1052 /* limited inquiry scan for devices which
1053 are made discoverable only for a limited period of time or
1054 for specific conditions; the server is in connectable and pairable mode */
1055 bt_config.bt_sync_srv_mode = mfw_config.mfw_syn_srv_mode;
1056 break;
1057 default:
1058 return MFW_BT_FAIL;
1059 }
1060 switch(mfw_config.mfw_syn_srv_auth_mode)
1061 {
1062 case MFW_BT_SYNC_INIT_AUTH_MODE:
1063 /* server initiates authentication */
1064 bt_config.bt_sync_aut_mode = mfw_config.mfw_syn_srv_auth_mode;
1065 break;
1066 case MFW_BT_SYNC_NO_INIT_AUTH_MODE:
1067 /* server does not initiate authentication*/
1068 bt_config.bt_sync_aut_mode = mfw_config.mfw_syn_srv_auth_mode;
1069 break;
1070 default:
1071 return MFW_BT_FAIL;
1072 }
1073
1074 switch(btibtp_init_profile_sync_req_serv(bt_list_sync_objects,bt_config))
1075 { /* BTP_INIT_PROFILE_REQ to BT */
1076 case BTP_OK:
1077 return MFW_BT_EXECUTE;
1078 case BTP_INVALID_PARAMETER:
1079 return MFW_BT_INVALID_PARA;
1080 case BTP_NOT_SUPP:
1081 return MFW_BT_NO_SUPP;
1082 case BTP_NOT_READY:
1083 return MFW_BT_NOT_READY;
1084 case BTP_INT_ERR:
1085 return MFW_BT_INT_ERR;
1086 case BTP_MEMORY_ERR:
1087 return MFW_BT_MEM_ERR;
1088 case BTP_NOK:
1089 return MFW_BT_NOK;
1090 }
1091 }
1092 else
1093 return MFW_BT_FAIL;
1094 }
1095 return MFW_BT_FAIL;
1096 }
1097 /*
1098 +--------------------------------------------------------------------+
1099 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
1100 | STATE : code ROUTINE : bt_reconf_profile_opp|
1101 +--------------------------------------------------------------------+
1102
1103 PURPOSE : reconfigure a BT OPP in server mode
1104 */
1105 T_MFW_BT_RESULT_BT bt_reconf_profile_opp (T_MFW_BT_SERVICE_TYPE service,
1106 T_MFW_BT_SUBTYPE_DEV subtype,
1107 T_MFW_BT_OPP_SERVER_CONFIG serv_config)
1108 {
1109 T_BTI_OPP_SERVER_CONFIG bt_opp_s_conf;
1110
1111 TRACE_FUNCTION ("bt_init_profile_opp()");
1112
1113 memset(&bt_opp_s_conf,0,sizeof(bt_opp_s_conf));
1114 if(service EQ MFW_BT_OPP)
1115 {
1116 if(subtype EQ MFW_BT_SERVER)
1117 {
1118 /* mode of OPP server:
1119 MFW_BT_OPP_NO_MODE: no OPP server mode
1120 MFW_BT_OPP_SILENT_MODE: OPP server stores objects as fileswithout alerting the user
1121 MFW_BT_OPP_FILE_MODE: OPP server stores objects as fileswith alerting user
1122 MFW_BT_OPP_BUFFER_MODE: OPP server asks for a buffer to store the each object
1123 */
1124 switch(serv_config.mfw_opp_mode)
1125 {
1126 case MFW_BT_OPP_NO_MODE:
1127 bt_opp_s_conf.bt_opp_mode = BTI_NO_OPP_MODE;
1128 break;
1129 case MFW_BT_OPP_BUFFER_MODE:
1130 bt_opp_s_conf.bt_opp_mode = BTI_OPP_EVENT_BUFFER_MODE;
1131 break;
1132 case MFW_BT_OPP_FILE_MODE:
1133 bt_opp_s_conf.bt_opp_mode = BTI_OPP_EVENT_FILE_MODE;
1134 break;
1135 case MFW_BT_OPP_SILENT_MODE:
1136 bt_opp_s_conf.bt_opp_mode = BTI_OPP_SILENT_FILE_MODE;
1137 break;
1138 default:
1139 return MFW_BT_FAIL;
1140 }
1141 /* this function change the parameter of the existing OPP server */
1142 switch(serv_config.mfw_opp_object.mfw_object_type)
1143 {
1144 case MFW_BT_BUFFER:/* object is stored in buffer */
1145 bt_opp_s_conf.bt_object.bt_object_type = BTI_TYPE_BUFFER;
1146 bt_opp_s_conf.bt_object.bt_buffer_start = serv_config.mfw_opp_object.mfw_buffer_start;
1147 bt_opp_s_conf.bt_object.bt_buffer_size = serv_config.mfw_opp_object.mfw_buffer_size;
1148 break;
1149 case MFW_BT_PATH:/* object is stored in file system */
1150 bt_opp_s_conf.bt_object.bt_object_type = BTI_TYPE_PATH;
1151 /* path of default_business_card of server */
1152 bt_opp_s_conf.bt_object.bt_path = serv_config.mfw_opp_object.mfw_path;
1153 /* path of inbox folder in file system of OPP server */
1154 bt_opp_s_conf.bt_inbox_path = serv_config.mfw_inbox_path;
1155 break;
1156 default:
1157 return MFW_BT_FAIL;
1158 }
1159 /* MIME type of object, null-terminated string */
1160 bt_opp_s_conf.bt_object.bt_object_mime_type = serv_config.mfw_opp_object.mfw_object_mime_type;
1161 /* name of default_business_card of server */
1162 bt_opp_s_conf.bt_object.bt_object_name = serv_config.mfw_opp_object.mfw_object_name;
1163 /* length of default_business_card of server */
1164 bt_opp_s_conf.bt_object.bt_object_length = serv_config.mfw_opp_object.mfw_object_length;
1165
1166 switch(btibtp_reconf_profile_opp_s(bt_opp_s_conf))
1167 {/* BTP_RECONFIG_PROFILE_REQ to BT */
1168 case BTP_OK:
1169 return MFW_BT_EXECUTE;
1170 case BTP_INVALID_PARAMETER:
1171 return MFW_BT_INVALID_PARA;
1172 case BTP_NOT_SUPP:
1173 return MFW_BT_NO_SUPP;
1174 case BTP_NOT_READY:
1175 return MFW_BT_NOT_READY;
1176 case BTP_INT_ERR:
1177 return MFW_BT_INT_ERR;
1178 case BTP_MEMORY_ERR:
1179 return MFW_BT_MEM_ERR;
1180 case BTP_NOK:
1181 return MFW_BT_NOK;
1182 }
1183 }
1184 else
1185 return MFW_BT_FAIL;
1186 }
1187 return MFW_BT_FAIL;
1188 }
1189
1190 /*
1191 +----------------------------------------------------------------------+
1192 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
1193 | STATE : code ROUTINE : bt_reconf_profile_syn_s |
1194 +----------------------------------------------------------------------+
1195
1196 PURPOSE : reconfigure a BT SYNC profile in server mode
1197
1198 */
1199 T_MFW_BT_RESULT_BT bt_reconf_profile_syn_s (T_MFW_BT_SERVICE_TYPE service,
1200 T_MFW_BT_SUBTYPE_DEV subtype,
1201 T_MFW_BT_SYN_OBJECT_STORE_LIST list_availabe_objects,
1202 T_MFW_BT_SYNC_SERVER_CONFIG mfw_config)
1203 {
1204 T_BTI_SYNC_SERVER_CONFIG bt_config;
1205 T_BTI_SYN_OBJECT_STORE_LIST bt_list_sync_objects;
1206 TRACE_FUNCTION ("bt_reconf_profile_syn_s()");
1207
1208 memset(&bt_config,0,sizeof(bt_config));
1209 bt_list_sync_objects = (T_BTI_SYN_OBJECT_STORE_LIST)list_availabe_objects;
1210
1211 if(service EQ MFW_BT_SYNC)
1212 {
1213 switch(mfw_config.mfw_syn_srv_mode)
1214 {
1215 case MFW_BT_SYNC_GEN_MODE:
1216 /* general SYNC server mode, for devices
1217 which are made discoverable continuously or for no
1218 specific conditions */
1219 bt_config.bt_sync_srv_mode = mfw_config.mfw_syn_srv_mode;
1220 break;
1221 case MFW_BT_SYNC_INIT_MODE:
1222 /* limited inquiry scan for devices which
1223 are made discoverable only for a limited period of time or
1224 for specific conditions */
1225 bt_config.bt_sync_srv_mode = mfw_config.mfw_syn_srv_mode;
1226 break;
1227 default:
1228 return MFW_BT_FAIL;
1229 }
1230 switch(mfw_config.mfw_syn_srv_auth_mode)
1231 {
1232 case MFW_BT_SYNC_INIT_AUTH_MODE:
1233 /* server initiates authentication */
1234 bt_config.bt_sync_aut_mode = mfw_config.mfw_syn_srv_auth_mode;
1235 break;
1236 case MFW_BT_SYNC_NO_INIT_AUTH_MODE:
1237 /* server does not initiate authentication*/
1238 bt_config.bt_sync_aut_mode = mfw_config.mfw_syn_srv_auth_mode;
1239 break;
1240 default:
1241 return MFW_BT_FAIL;
1242 }
1243
1244 switch(btibtp_reconf_profile_sync_req_serv(bt_list_sync_objects,bt_config))
1245 { /* BTP_RECONFIG_PROFILE_REQ to BT */
1246 case BTP_OK:
1247 return MFW_BT_EXECUTE;
1248 case BTP_INVALID_PARAMETER:
1249 return MFW_BT_INVALID_PARA;
1250 case BTP_NOT_SUPP:
1251 return MFW_BT_NO_SUPP;
1252 case BTP_NOT_READY:
1253 return MFW_BT_NOT_READY;
1254 case BTP_INT_ERR:
1255 return MFW_BT_INT_ERR;
1256 case BTP_MEMORY_ERR:
1257 return MFW_BT_MEM_ERR;
1258 case BTP_NOK:
1259 return MFW_BT_NOK;
1260 }
1261 }
1262 return MFW_BT_FAIL;
1263 }
1264 /*
1265 +--------------------------------------------------------------------+
1266 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
1267 | STATE : code ROUTINE : bt_deinit_profile |
1268 +--------------------------------------------------------------------+
1269
1270 PURPOSE : deinitialize a BT profile, not stop of profile application
1271
1272 */
1273 T_MFW_BT_RESULT_BT bt_deinit_profile (T_MFW_BT_SERVICE_TYPE service,T_MFW_BT_SUBTYPE_DEV subtype)
1274 {
1275 TRACE_FUNCTION ("bt_deinit_profile()");
1276
1277 if((service EQ MFW_BT_HEADSET) OR
1278 (service EQ MFW_BT_DIAL_UP) OR
1279 (service EQ MFW_BT_FAX_GW) OR
1280 (service EQ MFW_BT_OPP) OR
1281 (service EQ MFW_BT_SYNC))
1282 {
1283 if((subtype EQ MFW_BT_CLIENT) OR
1284 (subtype EQ MFW_BT_SERVER) OR
1285 (subtype EQ MFW_BT_NO_SUBTYPE))
1286 {
1287 switch(btibtp_deinit_profile_req((T_BTI_DEVICE_TYPE)service,(T_BTI_DEVICE_SUBTYP)subtype))
1288 { /* BTP_DEINIT_PROFILE_REQ to BT */
1289 case BTP_OK:
1290 return MFW_BT_EXECUTE;
1291 case BTP_INVALID_PARAMETER:
1292 return MFW_BT_INVALID_PARA;
1293 case BTP_NOT_SUPP:
1294 return MFW_BT_NO_SUPP;
1295 case BTP_NOT_READY:
1296 return MFW_BT_NOT_READY;
1297 case BTP_INT_ERR:
1298 return MFW_BT_INT_ERR;
1299 case BTP_MEMORY_ERR:
1300 return MFW_BT_MEM_ERR;
1301 case BTP_NOK:
1302 return MFW_BT_NOK;
1303 }
1304 }
1305 }
1306 return MFW_BT_FAIL;
1307 }
1308
1309 /*
1310 +-----------------------------------------------------------------------+
1311 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
1312 | STATE : code ROUTINE : bt_reconfig_profile_hsg_cl|
1313 +-----------------------------------------------------------------------+
1314
1315 PURPOSE : reconfigure a BT profile headset in client mode
1316
1317 */
1318 T_MFW_BT_RESULT_BT bt_reconfig_profile_hsg_cl (T_MFW_BT_SERVICE_TYPE service,
1319 T_MFW_BT_HSG_CLIENT_CONFIG config)
1320 {
1321 T_BTI_HSG_CLIENT_CONF bt_config;
1322
1323 TRACE_FUNCTION ("bt_reconfig_profile_hsg_cl()");
1324
1325 memset(&bt_config,0,sizeof(bt_config));
1326
1327 if(service EQ MFW_BT_HEADSET)
1328 {/* reconfiguration is only accepted when no outgoing call is in processing */
1329 switch(config.config_mode)
1330 {
1331 case MFW_BT_AUTO_OUTG_DEF_CONN_OFF:
1332 bt_config.config_mode = BTI_AUTO_OUTG_DEF_CONN_OFF;
1333 break;
1334 case MFW_BT_AUTO_OUTG_DEF_CONN_ON:
1335 bt_config.config_mode = BTI_AUTO_OUTG_DEF_CONN_ON;
1336 break;
1337 }
1338
1339 bt_config.security = config.security;
1340
1341 switch(btibtp_reconfig_profile_req_cl((T_BTI_DEVICE_TYPE)service,bt_config))
1342 { /* BTP_RECONF_PROFILE_REQ to BT */
1343 case BTP_OK:
1344 return MFW_BT_EXECUTE;
1345 case BTP_INVALID_PARAMETER:
1346 return MFW_BT_INVALID_PARA;
1347 case BTP_NOT_SUPP:
1348 return MFW_BT_NO_SUPP;
1349 case BTP_NOT_READY:
1350 return MFW_BT_NOT_READY;
1351 case BTP_INT_ERR:
1352 return MFW_BT_INT_ERR;
1353 case BTP_MEMORY_ERR:
1354 return MFW_BT_MEM_ERR;
1355 case BTP_NOK:
1356 return MFW_BT_NOK;
1357 }
1358 }
1359 return MFW_BT_FAIL;
1360 }
1361
1362 /*
1363 +--------------------------------------------------------------------------+
1364 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
1365 | STATE : code ROUTINE : bt_reconfig_profile_hsg_serv|
1366 +--------------------------------------------------------------------------+
1367
1368 PURPOSE : reconfigure a BT headset profile in server mode
1369
1370 */
1371 T_MFW_BT_RESULT_BT bt_reconfig_profile_hsg_serv (T_MFW_BT_SERVICE_TYPE service,
1372 T_MFW_BT_HSG_SERVER_CONFIG mfw_config)
1373 {
1374 T_BTI_HSG_SERVER_CONF bt_config;
1375
1376 TRACE_FUNCTION ("bt_reconfig_profile_hsg_serv()");
1377
1378 memset(&bt_config,0,sizeof(bt_config));
1379
1380 if(service EQ MFW_BT_HEADSET)
1381 {
1382 bt_config.conn_config = mfw_config.serv_con_conf;
1383 /* length scan of connection requests of remote headsets *
1384 /* default value: MFW_BT_CONN_SCAN_TIME_DEFAULT_VALUE */
1385 bt_config.conn_time = mfw_config.conn_time;
1386 /* period between 2 scans of connection of remote headsets */
1387 /* default value: MFW_BT_CONN_SCAN_BREAK_DEFAULT_VALUE */
1388 bt_config.conn_break= mfw_config.conn_break;
1389 /* number of phone number in phone list */
1390 bt_config.nb_phone = mfw_config.nb_phone;
1391 /* phone number list of remote headset */
1392 memcpy(bt_config.phon_list,mfw_config.mfw_phone_list,sizeof(mfw_config.mfw_phone_list));
1393 /* associatd key list of remote headset */
1394 memcpy(bt_config.key_list,mfw_config.mfw_key_list,sizeof(mfw_config.mfw_key_list));
1395
1396 bt_config.security = mfw_config.security;
1397
1398 switch(btibtp_reconfig_profile_req_serv((T_BTI_DEVICE_TYPE)service,bt_config))
1399 {/* BTP_INIT_PROFILE_REQ to BT */
1400 case BTP_OK:
1401 return MFW_BT_EXECUTE;
1402 case BTP_INVALID_PARAMETER:
1403 return MFW_BT_INVALID_PARA;
1404 case BTP_NOT_SUPP:
1405 return MFW_BT_NO_SUPP;
1406 case BTP_NOT_READY:
1407 return MFW_BT_NOT_READY;
1408 case BTP_INT_ERR:
1409 return MFW_BT_INT_ERR;
1410 case BTP_MEMORY_ERR:
1411 return MFW_BT_MEM_ERR;
1412 case BTP_NOK:
1413 return MFW_BT_NOK;
1414 }
1415 }
1416 return MFW_BT_FAIL;
1417 }
1418 /*
1419 +--------------------------------------------------------------------+
1420 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
1421 | STATE : code ROUTINE : bt_reconfig_profile_dun|
1422 +--------------------------------------------------------------------+
1423
1424 PURPOSE : reconfigure a BT profile
1425
1426 */
1427 T_MFW_BT_RESULT_BT bt_reconfig_profile_dun (T_MFW_BT_SERVICE_TYPE service,
1428 T_MFW_BT_DUN_CONFIG dun_filter)
1429 {
1430 T_BTI_DUN_CONF dun_config;
1431
1432 TRACE_FUNCTION ("bt_reconfig_profile_dun()");
1433
1434 memset(&dun_config,0,sizeof(dun_config));
1435
1436 if(service EQ MFW_BT_DIAL_UP )
1437 {/* show status of BT link - informs if a serial port is opened between DUN-DT and DUN-GW */
1438 if((dun_filter.link_event EQ BTI_DUN_LINK_MONIT_ON) OR
1439 (dun_filter.link_event EQ BTI_DUN_LINK_MONIT_OFF))
1440 {
1441 dun_config.link_filter = dun_filter.link_event;
1442 }
1443 else
1444 {
1445 TRACE_EVENT ("Error:bt_reconfig_profile_dun()");
1446 return MFW_BT_FAIL;
1447 }
1448 /* show status of data call */
1449 if((dun_filter.call_event EQ BTI_DUN_CALL_MONIT_ON) OR
1450 (dun_filter.call_event EQ BTI_DUN_CALL_MONIT_OFF))
1451 {
1452 dun_config.call_filter = dun_filter.call_event;
1453 }
1454 else
1455 {
1456 TRACE_EVENT ("Error:bt_reconfig_profile_dun()");
1457 return MFW_BT_FAIL;
1458 }
1459
1460 switch(btibtp_reconf_profile_dun_req((T_BTI_DEVICE_TYPE)service,dun_config))
1461 { /* BTP_RECONF_PROFILE_REQ to BT */
1462 case BTP_OK:
1463 return MFW_BT_EXECUTE;
1464 case BTP_INVALID_PARAMETER:
1465 return MFW_BT_INVALID_PARA;
1466 case BTP_NOT_SUPP:
1467 return MFW_BT_NO_SUPP;
1468 case BTP_NOT_READY:
1469 return MFW_BT_NOT_READY;
1470 case BTP_INT_ERR:
1471 return MFW_BT_INT_ERR;
1472 case BTP_MEMORY_ERR:
1473 return MFW_BT_MEM_ERR;
1474 case BTP_NOK:
1475 return MFW_BT_NOK;
1476 }
1477 }
1478 return MFW_BT_FAIL;
1479 }
1480
1481 /*
1482 +--------------------------------------------------------------------+
1483 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
1484 | STATE : code ROUTINE : bt_reconfig_profile_fax|
1485 +--------------------------------------------------------------------+
1486
1487 PURPOSE : reconfigure a BT profile
1488
1489 */
1490 T_MFW_BT_RESULT_BT bt_reconfig_profile_fax (T_MFW_BT_SERVICE_TYPE service,
1491 T_MFW_BT_FAX_CONFIG fax_filter)
1492 {
1493 T_BTI_FAX_CONF fax_config;
1494
1495 TRACE_FUNCTION ("bt_reconfig_profile_fax()");
1496
1497 memset(&fax_config,0,sizeof(fax_config));
1498
1499 if(service EQ MFW_BT_FAX_GW )
1500 {/* show status of BT link - informs if a serial port is opened between FAX-DT and FAX-GW */
1501 if((fax_filter.link_event EQ BTI_FAX_LINK_MONIT_ON) OR
1502 (fax_filter.link_event EQ BTI_FAX_LINK_MONIT_OFF))
1503 {
1504 fax_config.link_filter = fax_filter.link_event;
1505 }
1506 else
1507 {
1508 TRACE_EVENT ("Error:bt_reconfig_profile_fax()");
1509 return MFW_BT_FAIL;
1510 }
1511 /* show status of data call */
1512 if((fax_filter.call_event EQ BTI_FAX_CALL_MONIT_ON) OR
1513 (fax_filter.call_event EQ BTI_FAX_CALL_MONIT_OFF))
1514 {
1515 fax_config.call_filter = fax_filter.call_event;
1516 }
1517 else
1518 {
1519 TRACE_EVENT ("Error:bt_reconfig_profile_fax()");
1520 return MFW_BT_FAIL;
1521 }
1522
1523 switch(btibtp_reconf_profile_fax_req((T_BTI_DEVICE_TYPE)service,fax_config))
1524 { /* BTP_RECONF_PROFILE_REQ to BT */
1525 case BTP_OK:
1526 return MFW_BT_EXECUTE;
1527 case BTP_INVALID_PARAMETER:
1528 return MFW_BT_INVALID_PARA;
1529 case BTP_NOT_SUPP:
1530 return MFW_BT_NO_SUPP;
1531 case BTP_NOT_READY:
1532 return MFW_BT_NOT_READY;
1533 case BTP_INT_ERR:
1534 return MFW_BT_INT_ERR;
1535 case BTP_MEMORY_ERR:
1536 return MFW_BT_MEM_ERR;
1537 case BTP_NOK:
1538 return MFW_BT_NOK;
1539 }
1540 }
1541 return MFW_BT_FAIL;
1542 }
1543 /*
1544 +--------------------------------------------------------------------+
1545 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
1546 | STATE : code ROUTINE : bt_service_search|
1547 +--------------------------------------------------------------------+
1548
1549 PURPOSE : request search of services and their service names
1550
1551 */
1552 T_MFW_BT_RESULT_BT bt_service_search(T_MFW_BT_SERVICE_TYPE service)
1553 {
1554 TRACE_FUNCTION ("bt_service_search()");
1555
1556 if((service EQ MFW_BT_HEADSET) OR
1557 (service EQ MFW_BT_DIAL_UP) OR
1558 (service EQ MFW_BT_FAX_GW) OR
1559 (service EQ MFW_BT_OPP) OR
1560 (service EQ MFW_BT_SYNC_CMD))
1561 {/* start browsing procedure */
1562 switch(btibtp_service_search_req((T_BTI_DEVICE_TYPE)service, SERVICE_SEARCH))
1563 {
1564 case BTP_OK:
1565 return MFW_BT_EXECUTE;
1566 case BTP_INVALID_PARAMETER:
1567 return MFW_BT_INVALID_PARA;
1568 case BTP_NOT_SUPP:
1569 return MFW_BT_NO_SUPP;
1570 case BTP_NOT_READY:
1571 return MFW_BT_NOT_READY;
1572 case BTP_INT_ERR:
1573 return MFW_BT_INT_ERR;
1574 case BTP_MEMORY_ERR:
1575 return MFW_BT_MEM_ERR;
1576 case BTP_NOK:
1577 return MFW_BT_NOK;
1578 }
1579 }
1580 return MFW_BT_FAIL;
1581 }
1582
1583 /*
1584 +--------------------------------------------------------------------+
1585 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
1586 | STATE : code ROUTINE : bt_device_search |
1587 +--------------------------------------------------------------------+
1588
1589 PURPOSE : request search of devices and their service id's
1590
1591 */
1592 T_MFW_BT_RESULT_BT bt_device_search(void)
1593 {
1594
1595 TRACE_FUNCTION ("bt_device_search()");
1596
1597 /* start browsing procedure */
1598 switch(btibtp_device_search_req(DEVICE_SEARCH))
1599 {
1600 case BTP_OK:
1601 return MFW_BT_EXECUTE;
1602 case BTP_INVALID_PARAMETER:
1603 return MFW_BT_INVALID_PARA;
1604 case BTP_NOT_SUPP:
1605 return MFW_BT_NO_SUPP;
1606 case BTP_NOT_READY:
1607 return MFW_BT_NOT_READY;
1608 case BTP_INT_ERR:
1609 return MFW_BT_INT_ERR;
1610 case BTP_MEMORY_ERR:
1611 return MFW_BT_MEM_ERR;
1612 case BTP_NOK:
1613 return MFW_BT_NOK;
1614 }
1615 }
1616
1617 /*
1618 +--------------------------------------------------------------------+
1619 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
1620 | STATE : code ROUTINE : bt_extended_search |
1621 +--------------------------------------------------------------------+
1622
1623 PURPOSE : request search of devices and their service id's
1624
1625 */
1626 T_MFW_BT_RESULT_BT bt_extended_search(UINT8 inq_length,
1627 UINT8 max_num_of_responses,
1628 T_MFW_DEVICE_CLASS class_of_device[],
1629 BOOLEAN need_device_name,
1630 BOOLEAN need_services,
1631 T_MFW_SERVICE_ID service_id)
1632 {
1633
1634 TRACE_FUNCTION ("bt_extended_search()");
1635
1636 /* start browsing procedure */
1637 switch(btibtp_extended_search_req(inq_length, max_num_of_responses,
1638 class_of_device, need_device_name,
1639 need_services, service_id))
1640 {
1641 case BTP_OK:
1642 return MFW_BT_EXECUTE;
1643 case BTP_INVALID_PARAMETER:
1644 return MFW_BT_INVALID_PARA;
1645 case BTP_NOT_SUPP:
1646 return MFW_BT_NO_SUPP;
1647 case BTP_NOT_READY:
1648 return MFW_BT_NOT_READY;
1649 case BTP_INT_ERR:
1650 return MFW_BT_INT_ERR;
1651 case BTP_MEMORY_ERR:
1652 return MFW_BT_MEM_ERR;
1653 case BTP_NOK:
1654 return MFW_BT_NOK;
1655 }
1656 }
1657
1658 /*
1659 +--------------------------------------------------------------------+
1660 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
1661 | STATE : code ROUTINE : bt_search_abort |
1662 +--------------------------------------------------------------------+
1663
1664 PURPOSE : start abort of browsing procedure
1665
1666 */
1667 T_MFW_BT_RESULT_BT bt_search_abort(void)
1668 {
1669 TRACE_FUNCTION ("bt_search_abort()");
1670
1671 switch(btibtp_search_abort())
1672 {
1673 case BTP_OK:
1674 return MFW_BT_OK;
1675 case BTP_INVALID_PARAMETER:
1676 return MFW_BT_INVALID_PARA;
1677 case BTP_NOT_SUPP:
1678 return MFW_BT_NO_SUPP;
1679 case BTP_NOT_READY:
1680 return MFW_BT_NOT_READY;
1681 case BTP_INT_ERR:
1682 return MFW_BT_INT_ERR;
1683 case BTP_MEMORY_ERR:
1684 return MFW_BT_MEM_ERR;
1685 case BTP_NOK:
1686 return MFW_BT_NOK;
1687 }
1688 }
1689 /*
1690 +--------------------------------------------------------------------+
1691 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
1692 | STATE : code ROUTINE : bt_connect_hsg |
1693 +--------------------------------------------------------------------+
1694
1695 PURPOSE : request connection with the service headset
1696
1697 */
1698 T_MFW_BT_RESULT_BT bt_connect_hsg (T_MFW_BT_SERVICE_TYPE service,
1699 T_MFW_BT_REQ_ID req_id,
1700 T_MFW_BT_BD_ADDR bd_addr[], UINT8 mode)
1701 {
1702 TRACE_FUNCTION ("bt_connect_hsg()");
1703
1704 /*
1705 *** if req_id equal MFW_BT_DEFAULT_HEADSET_ID: headset gateway will
1706 automatically select a headset from the default headset list
1707 if req_id equal MFW_BT_INVALID_HEADSET_ID: headset gateway will try to
1708 connect to the headset whose BT headset address is in bd_addr
1709 otherwise headset gateway will call the headset related to headset_id
1710 in the default headset list
1711 ***
1712 */
1713 /* BTP_CONNECT_DEVICE_REQ to BT */
1714 if(service EQ MFW_BT_HEADSET)
1715 {
1716 switch(btibtp_connect_hsg_req(req_id, bd_addr, mode))
1717 {
1718 case BTP_OK:
1719 return MFW_BT_EXECUTE;
1720 case BTP_INVALID_PARAMETER:
1721 return MFW_BT_INVALID_PARA;
1722 case BTP_NOT_SUPP:
1723 return MFW_BT_NO_SUPP;
1724 case BTP_NOT_READY:
1725 return MFW_BT_NOT_READY;
1726 case BTP_INT_ERR:
1727 return MFW_BT_INT_ERR;
1728 case BTP_MEMORY_ERR:
1729 return MFW_BT_MEM_ERR;
1730 case BTP_NOK:
1731 return MFW_BT_NOK;
1732 }
1733 }
1734 else
1735 return MFW_BT_FAIL;
1736 }
1737
1738 /*
1739 +--------------------------------------------------------------------+
1740 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
1741 | STATE : code ROUTINE :bt_get_auto_connect|
1742 +--------------------------------------------------------------------+
1743
1744 PURPOSE : get state automatic connection on/off for headset gateway
1745 */
1746
1747 T_MFW_BT_RESULT_BT bt_get_auto_connect(T_MFW_BT_SERVICE_TYPE service,
1748 T_MFW_BT_HSG_CLIENT_CONFIG *conf)
1749 {
1750 T_MFW_BT_HSG_CLIENT_CONFIG client_conf;
1751 T_MFW_BT_HSG_SERVER_CONFIG server_conf;
1752 T_MFW_BT_RESULT_BT result;
1753
1754 TRACE_FUNCTION ("bt_get_auto_connect()");
1755
1756 memset(&client_conf,0,sizeof(client_conf));
1757 memset(&server_conf,0,sizeof(server_conf));
1758
1759 result = bt_get_config((T_BTI_DEVICE_TYPE)service,&client_conf,&server_conf);
1760
1761 if(result EQ MFW_BT_OK)
1762 {
1763 conf->config_mode = (T_MFW_BT_CONFIG_MODE)client_conf.config_mode;
1764 }
1765 return result;
1766 }
1767
1768 /*
1769 +--------------------------------------------------------------------+
1770 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
1771 | STATE : code ROUTINE :bt_auto_connect |
1772 +--------------------------------------------------------------------+
1773
1774 PURPOSE : set feature automatic connection on/off for headset gateway
1775 */
1776
1777 T_MFW_BT_RESULT_BT bt_auto_connect(T_MFW_BT_SERVICE_TYPE service,
1778 T_MFW_BT_AUTO_CONNECT_STATE set_state)
1779 {
1780 T_MFW_BT_HSG_CLIENT_CONFIG client_conf;
1781 T_MFW_BT_HSG_SERVER_CONFIG server_conf;
1782 T_MFW_BT_RESULT_BT result;
1783
1784 TRACE_FUNCTION ("bt_auto_connect()");
1785
1786 memset(&client_conf,0,sizeof(client_conf));
1787 memset(&server_conf,0,sizeof(server_conf));
1788
1789 if(set_state EQ MFW_BT_AUTO_CONNECT_ON OR
1790 set_state EQ MFW_BT_AUTO_CONNECT_OFF)
1791 {/* read state of config_mode */
1792 result = bt_get_config((T_BTI_DEVICE_TYPE)service,&client_conf,&server_conf);
1793 if(result NEQ MFW_BT_OK)
1794 {
1795 return result;
1796 }
1797 else
1798 {
1799 if(set_state EQ MFW_BT_AUTO_CONNECT_ON)
1800 {
1801 if(client_conf.config_mode NEQ MFW_BT_AUTO_OUTG_DEF_CONN_ON)
1802 {/* connection with default pre-defined headset as soon as it receives a
1803 RING command from GSM)*/
1804 client_conf.config_mode = MFW_BT_AUTO_OUTG_DEF_CONN_ON;
1805 return (bt_reconfig_profile_hsg_cl(service,client_conf));
1806 }
1807 }
1808 else
1809 {
1810 if(client_conf.config_mode EQ MFW_BT_AUTO_OUTG_DEF_CONN_ON)
1811 {
1812 client_conf.config_mode = MFW_BT_AUTO_OUTG_DEF_CONN_OFF;
1813 return (bt_reconfig_profile_hsg_cl(service,client_conf));
1814 }
1815 }
1816 }
1817 }
1818 else
1819 return MFW_BT_FAIL;
1820 }
1821 /*
1822 +--------------------------------------------------------------------+
1823 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
1824 | STATE : code ROUTINE :bt_set_pref_headset |
1825 +--------------------------------------------------------------------+
1826
1827 PURPOSE : add preferred headset in default headset list
1828 */
1829
1830 T_MFW_BT_RESULT_BT bt_set_pref_headset(T_MFW_BT_SERVICE_TYPE service,
1831 T_MFW_BT_BD_ADDR bd_addr[],
1832 T_MFW_BT_HSG_NAME hsg_name[],
1833 T_MFW_BT_PRIORITY priority,
1834 BOOL rem_audio_ctr_supp_hsg,
1835 T_MFW_BT_CNF_ID * headset_cnf_id)
1836 {
1837 T_MFW_BT_CNF_ID cnf_id = 0;
1838
1839 TRACE_FUNCTION ("bt_set_pref_service()");
1840
1841 if(service EQ MFW_BT_HEADSET)
1842 {
1843 if(priority <= MFW_HSG_HEADSET_MAX_PRIORITY)
1844 {
1845 switch(btibtp_set_default_headset(bd_addr,hsg_name,priority,rem_audio_ctr_supp_hsg,&cnf_id))
1846 /* add headset in default headset list */
1847 {
1848 case BTP_OK:
1849 *headset_cnf_id = cnf_id;
1850 return MFW_BT_OK;
1851 case BTP_INVALID_PARAMETER:
1852 return MFW_BT_INVALID_PARA;
1853 case BTP_HSG_ALREADY_STOR:
1854 return MFW_BT_HSG_ALREADY_STORED;
1855 case BTP_NOT_READY:
1856 return MFW_BT_NOT_READY;
1857 case BTP_INT_ERR:
1858 return MFW_BT_INT_ERR;
1859 case BTP_MEMORY_ERR:
1860 return MFW_BT_MEM_ERR;
1861 case BTP_NOK:
1862 return MFW_BT_NOK;
1863 }
1864 }
1865 else
1866 return MFW_BT_INVALID_PARA;
1867 }
1868 else
1869 return MFW_BT_FAIL;
1870 }
1871
1872 /*
1873 +--------------------------------------------------------------------+
1874 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
1875 | STATE : code ROUTINE :bt_is_pref_headset |
1876 +--------------------------------------------------------------------+
1877
1878 PURPOSE : check if preferred headset is in default headset list
1879 */
1880
1881 T_MFW_BT_RESULT_BT bt_is_pref_headset(T_MFW_BT_SERVICE_TYPE service,
1882 T_MFW_BT_BD_ADDR bd_addr[],
1883 T_MFW_BT_CNF_ID * headset_cnf_id)
1884 {
1885 T_MFW_BT_CNF_ID cnf_id = 0;
1886
1887 TRACE_FUNCTION ("bt_is_pref_headset()");
1888
1889 if(service EQ MFW_BT_HEADSET)
1890 {
1891 switch(btibtp_query_default_headset(bd_addr,&cnf_id))
1892 /* add headset in default headset list */
1893 {
1894 case BTP_OK:
1895 *headset_cnf_id = cnf_id;
1896 return MFW_BT_OK;
1897 case BTP_INVALID_PARAMETER:
1898 return MFW_BT_INVALID_PARA;
1899 case BTP_HSG_ALREADY_STOR:
1900 return MFW_BT_HSG_ALREADY_STORED;
1901 case BTP_NOT_READY:
1902 return MFW_BT_NOT_READY;
1903 case BTP_INT_ERR:
1904 return MFW_BT_INT_ERR;
1905 case BTP_MEMORY_ERR:
1906 return MFW_BT_MEM_ERR;
1907 case BTP_NOK:
1908 return MFW_BT_NOK;
1909 }
1910 }
1911 else
1912 return MFW_BT_FAIL;
1913 }
1914 /*
1915 +--------------------------------------------------------------------+
1916 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
1917 | STATE : code ROUTINE :bt_reset_pref_hsg |
1918 +--------------------------------------------------------------------+
1919
1920 PURPOSE : delete current entry of a preferred headset
1921 */
1922
1923 T_MFW_BT_RESULT_BT bt_reset_pref_hsg(T_MFW_BT_SERVICE_TYPE service,
1924 T_MFW_BT_DEV_ID dev_id)
1925 {
1926 TRACE_FUNCTION ("bt_reset_pref_hsg()");
1927 if(service EQ MFW_BT_HEADSET)
1928 {
1929 /* parameter: dev_id equal headset_id in default headset list */
1930 switch(btibtp_delete_default_headset(dev_id))
1931 {
1932 case BTP_OK:
1933 return MFW_BT_OK;
1934 case BTP_INVALID_PARAMETER:
1935 return MFW_BT_INVALID_PARA;
1936 case BTP_NOT_SUPP:
1937 return MFW_BT_NO_SUPP;
1938 case BTP_NOT_READY:
1939 return MFW_BT_NOT_READY;
1940 case BTP_INT_ERR:
1941 return MFW_BT_INT_ERR;
1942 case BTP_MEMORY_ERR:
1943 return MFW_BT_MEM_ERR;
1944 case BTP_NOK:
1945 return MFW_BT_NOK;
1946 }
1947 }
1948 else
1949 return MFW_BT_FAIL;
1950 }
1951 /*
1952 +--------------------------------------------------------------------+
1953 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
1954 | STATE : code ROUTINE :bt_disconnect_service|
1955 +--------------------------------------------------------------------+
1956
1957 PURPOSE : request disconnect of service
1958
1959 */
1960 T_MFW_BT_RESULT_BT bt_disconnect_service (T_MFW_BT_SERVICE_TYPE service)
1961 {
1962 TRACE_FUNCTION ("bt_disconnect_service()");
1963
1964 if((service EQ MFW_BT_HEADSET) OR
1965 (service EQ MFW_BT_DIAL_UP) OR
1966 (service EQ MFW_BT_FAX_GW))
1967 {
1968 switch(btibtp_disconnect_service_req((T_BTI_DEVICE_TYPE)service))
1969 { /* BTP_DISCONNECT_DEVICE_REQ to BT */
1970 case BTP_OK:
1971 return MFW_BT_EXECUTE;
1972 case BTP_INVALID_PARAMETER:
1973 return MFW_BT_INVALID_PARA;
1974 case BTP_NOT_SUPP:
1975 return MFW_BT_NO_SUPP;
1976 case BTP_NOT_READY:
1977 return MFW_BT_NOT_READY;
1978 case BTP_INT_ERR:
1979 return MFW_BT_INT_ERR;
1980 case BTP_MEMORY_ERR:
1981 return MFW_BT_MEM_ERR;
1982 case BTP_NOK:
1983 return MFW_BT_NOK;
1984 }
1985 }
1986 else
1987 return MFW_BT_FAIL;
1988 }
1989 /*
1990 +--------------------------------------------------------------------+
1991 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
1992 | STATE : code ROUTINE :bt_send_pin |
1993 +--------------------------------------------------------------------+
1994
1995 PURPOSE : send the pin requesting by bt (for authorization)
1996
1997 */
1998 T_MFW_BT_RESULT_BT bt_send_pin (T_MFW_BT_BD_ADDR bd_addr[],
1999 T_MFW_BT_PIN pin_code[],
2000 T_MFW_BT_PIN_MODE pin_mode)
2001 {
2002 UBYTE user_pin_code_length=4;
2003
2004 TRACE_FUNCTION ("bt_send_pin()");
2005
2006 if(pin_mode EQ PIN_PROVIDED)
2007 { /* BTP_PIN_RES to BT */
2008 user_pin_code_length = strlen((const char *)pin_code);
2009
2010 switch(btibtp_pin_res(user_pin_code_length, pin_code, bd_addr))
2011 {
2012 case BTP_OK:
2013 return MFW_BT_OK;
2014 case BTP_INVALID_PARAMETER:
2015 return MFW_BT_INVALID_PARA;
2016 case BTP_NOT_SUPP:
2017 return MFW_BT_NO_SUPP;
2018 case BTP_NOT_READY:
2019 return MFW_BT_NOT_READY;
2020 case BTP_INT_ERR:
2021 return MFW_BT_INT_ERR;
2022 case BTP_MEMORY_ERR:
2023 return MFW_BT_MEM_ERR;
2024 case BTP_NOK:
2025 return MFW_BT_NOK;
2026 }
2027 }
2028 else
2029 {/* if device isn't able to provide a PIN code */
2030 /* BTP_PIN_RES to BT */
2031 switch(btibtp_pin_res(0,0,bd_addr))
2032 {
2033 case BTP_OK:
2034 return MFW_BT_OK;
2035 case BTP_INVALID_PARAMETER:
2036 return MFW_BT_INVALID_PARA;
2037 case BTP_NOT_SUPP:
2038 return MFW_BT_NO_SUPP;
2039 case BTP_NOT_READY:
2040 return MFW_BT_NOT_READY;
2041 case BTP_INT_ERR:
2042 return MFW_BT_INT_ERR;
2043 case BTP_MEMORY_ERR:
2044 return MFW_BT_MEM_ERR;
2045 case BTP_NOK:
2046 return MFW_BT_NOK;
2047 }
2048 }
2049 }
2050
2051 /*
2052 +--------------------------------------------------------------------+
2053 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
2054 | STATE : code ROUTINE :bt_authorization_reply |
2055 +--------------------------------------------------------------------+
2056
2057 PURPOSE : reply the authorization requesting by bt
2058
2059 */
2060 T_MFW_BT_RESULT_BT bt_authorization_reply (T_MFW_BT_BD_ADDR bd_addr[],
2061 T_MFW_BT_AUTHORIZATION_MASK mfw_auth_mask,
2062 T_MFW_BT_AUTHORIZATION_MODE auth_mode)
2063 {
2064 T_BTI_AUTHORIZATION_MASK author_mask = 0;
2065 T_BTI_APPLI_NAME service_name[BTI_APPLI_NAME_LENGTH];
2066 U8 len;
2067
2068 TRACE_FUNCTION ("bt_authorization_reply()");
2069
2070 memset(service_name,0,BTI_APPLI_NAME_LENGTH);
2071 /*
2072 *** MFW_BT_AUTHORIZED_ONCE : remote device is granted access to the service once time
2073 MFW_BT_AUTHORIZED_ALWAYS:remote device is granted access to the service always
2074 MFW_BT_UNAUTHORIZED: local device does not give access to the service
2075 ***
2076 */
2077 if((auth_mode EQ MFW_BT_AUTHORIZED_ONCE) OR
2078 (auth_mode EQ MFW_BT_AUTHORIZED_ALWAYS) OR
2079 (auth_mode EQ MFW_BT_UNAUTHORIZED))
2080 {
2081 switch(mfw_auth_mask)
2082 {/* mask refer to the service (mask about BT_AUTHORIZATION_IND in MMI) */
2083 case MFW_SERVICE_HSG:
2084 memcpy(service_name,MFW_BT_SERV_HSG,sizeof(MFW_BT_SERV_HSG));
2085 len = sizeof(MFW_BT_SERV_HSG);
2086 break;
2087 case MFW_SERVICE_DUN:
2088 memcpy(service_name,MFW_BT_SERV_DUN,sizeof(MFW_BT_SERV_DUN));
2089 len = sizeof(MFW_BT_SERV_DUN);
2090 break;
2091 case MFW_SERVICE_FAX:
2092 memcpy(service_name,MFW_BT_SERV_FAX,sizeof(MFW_BT_SERV_FAX));
2093 len = sizeof(MFW_BT_SERV_FAX);
2094 break;
2095 case MFW_SERVICE_OPP:
2096 memcpy(service_name,MFW_BT_SERV_OPP,sizeof(MFW_BT_SERV_OPP));
2097 len = sizeof(MFW_BT_SERV_OPP);
2098 break;
2099 case MFW_SERVICE_SYNC_C:
2100 memcpy(service_name,MFW_BT_SERV_SYNC_C,sizeof(MFW_BT_SERV_SYNC_C));
2101 len = sizeof(MFW_BT_SERV_SYNC_C);
2102 break;
2103 default:
2104 return MFW_BT_NOK;
2105 }
2106 /* because authorization mask is SCM-depend MFW requests specify mask */
2107 if(btibtp_get_authorization_mask(service_name,len,&author_mask) NEQ BTP_OK)
2108 {
2109 TRACE_EVENT ("Error:bt_authorization_reply()");
2110 return MFW_BT_NOK;
2111 }
2112 else
2113 {
2114 switch(btibtp_authorization_reply(bd_addr,author_mask,auth_mode))
2115 {
2116 case BTP_OK:
2117 return MFW_BT_OK;
2118 case BTP_INVALID_PARAMETER:
2119 return MFW_BT_INVALID_PARA;
2120 case BTP_NOT_SUPP:
2121 return MFW_BT_NO_SUPP;
2122 case BTP_NOT_READY:
2123 return MFW_BT_NOT_READY;
2124 case BTP_INT_ERR:
2125 return MFW_BT_INT_ERR;
2126 case BTP_MEMORY_ERR:
2127 return MFW_BT_MEM_ERR;
2128 case BTP_NOK:
2129 return MFW_BT_NOK;
2130 }
2131 }
2132 }
2133 }
2134
2135 /*
2136 +--------------------------------------------------------------------+
2137 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
2138 | STATE : code ROUTINE :bt_get_authorization_device|
2139 +--------------------------------------------------------------------+
2140
2141 PURPOSE:get authorizations to access available services on local device
2142 */
2143 T_MFW_BT_RESULT_BT bt_get_authorization_device (T_MFW_BT_BD_ADDR bd_addr[],
2144 T_MFW_BT_AUTHORIZATION_MASK * mask)
2145 {
2146 T_BTI_AUTHORIZATION_MASK author_mask,mask_hsg,mask_dun,mask_fax,mask_sync_cmd,mask_opp,auth_mask;
2147
2148 T_BTI_APPLI_NAME service_name[BTI_APPLI_NAME_LENGTH];
2149
2150 TRACE_FUNCTION ("bt_get_authorization_device()");
2151
2152 memset(service_name,0,BTI_APPLI_NAME_LENGTH);
2153 author_mask = mask_hsg = mask_dun = mask_fax = mask_sync_cmd = mask_opp = auth_mask =0;
2154
2155 switch(btibtp_get_authorization(bd_addr,&auth_mask))
2156 {/* auth_mask contains bits for several services, bits are SCM dependent */
2157 case BTP_OK:
2158 break;
2159 case BTP_INVALID_PARAMETER:
2160 return MFW_BT_INVALID_PARA;
2161 case BTP_NOT_SUPP:
2162 return MFW_BT_NO_SUPP;
2163 case BTP_NOT_READY:
2164 return MFW_BT_NOT_READY;
2165 case BTP_INT_ERR:
2166 return MFW_BT_INT_ERR;
2167 case BTP_MEMORY_ERR:
2168 return MFW_BT_MEM_ERR;
2169 case BTP_NOK:
2170 return MFW_BT_NOK;
2171 }
2172
2173 memcpy(service_name,MFW_BT_SERV_DUN,sizeof(MFW_BT_SERV_DUN));
2174 switch(btibtp_get_authorization_mask(service_name,sizeof(MFW_BT_SERV_DUN),&author_mask))
2175 {/* get mask for service dial-up */
2176 case BTP_OK:
2177 mask_dun = author_mask;
2178 break;
2179 case BTP_INVALID_PARAMETER:
2180 return MFW_BT_INVALID_PARA;
2181 case BTP_NOT_SUPP:
2182 return MFW_BT_NO_SUPP;
2183 case BTP_NOT_READY:
2184 return MFW_BT_NOT_READY;
2185 case BTP_INT_ERR:
2186 return MFW_BT_INT_ERR;
2187 case BTP_MEMORY_ERR:
2188 return MFW_BT_MEM_ERR;
2189 case BTP_NOK:
2190 return MFW_BT_NOK;
2191 }
2192 memcpy(service_name,MFW_BT_SERV_HSG,sizeof(MFW_BT_SERV_HSG));
2193 switch(btibtp_get_authorization_mask(service_name,sizeof(MFW_BT_SERV_HSG),&author_mask))
2194 {/* get mask for service headset gateway */
2195 case BTP_OK:
2196 mask_hsg = author_mask;
2197 break;
2198 case BTP_INVALID_PARAMETER:
2199 return MFW_BT_INVALID_PARA;
2200 case BTP_NOT_SUPP:
2201 return MFW_BT_NO_SUPP;
2202 case BTP_NOT_READY:
2203 return MFW_BT_NOT_READY;
2204 case BTP_INT_ERR:
2205 return MFW_BT_INT_ERR;
2206 case BTP_MEMORY_ERR:
2207 return MFW_BT_MEM_ERR;
2208 case BTP_NOK:
2209 return MFW_BT_NOK;
2210 }
2211 memcpy(service_name,MFW_BT_SERV_FAX,sizeof(MFW_BT_SERV_FAX));
2212 switch(btibtp_get_authorization_mask(service_name,sizeof(MFW_BT_SERV_FAX),&author_mask))
2213 {/* get mask for service fax gateway */
2214 case BTP_OK:
2215 mask_fax = author_mask;
2216 break;
2217 case BTP_INVALID_PARAMETER:
2218 return MFW_BT_INVALID_PARA;
2219 case BTP_NOT_SUPP:
2220 return MFW_BT_NO_SUPP;
2221 case BTP_NOT_READY:
2222 return MFW_BT_NOT_READY;
2223 case BTP_INT_ERR:
2224 return MFW_BT_INT_ERR;
2225 case BTP_MEMORY_ERR:
2226 return MFW_BT_MEM_ERR;
2227 case BTP_NOK:
2228 return MFW_BT_NOK;
2229 }
2230
2231 memcpy(service_name,MFW_BT_SERV_OPP,sizeof(MFW_BT_SERV_OPP));
2232 switch(btibtp_get_authorization_mask(service_name,sizeof(MFW_BT_SERV_OPP),&author_mask))
2233 {/* get mask for service opp object push profile */
2234 case BTP_OK:
2235 mask_opp = author_mask;
2236 break;
2237 case BTP_INVALID_PARAMETER:
2238 return MFW_BT_INVALID_PARA;
2239 case BTP_NOT_SUPP:
2240 return MFW_BT_NO_SUPP;
2241 case BTP_NOT_READY:
2242 return MFW_BT_NOT_READY;
2243 case BTP_INT_ERR:
2244 return MFW_BT_INT_ERR;
2245 case BTP_MEMORY_ERR:
2246 return MFW_BT_MEM_ERR;
2247 case BTP_NOK:
2248 return MFW_BT_NOK;
2249 }
2250
2251 memcpy(service_name,MFW_BT_SERV_SYNC_C,sizeof(MFW_BT_SERV_SYNC_C));
2252 switch(btibtp_get_authorization_mask(service_name,sizeof(MFW_BT_SERV_SYNC_C),&author_mask))
2253 {/* get mask for service SYNC server with SYNC command support */
2254 case BTP_OK:
2255 mask_sync_cmd = author_mask;
2256 break;
2257 case BTP_INVALID_PARAMETER:
2258 return MFW_BT_INVALID_PARA;
2259 case BTP_NOT_SUPP:
2260 return MFW_BT_NO_SUPP;
2261 case BTP_NOT_READY:
2262 return MFW_BT_NOT_READY;
2263 case BTP_INT_ERR:
2264 return MFW_BT_INT_ERR;
2265 case BTP_MEMORY_ERR:
2266 return MFW_BT_MEM_ERR;
2267 case BTP_NOK:
2268 return MFW_BT_NOK;
2269 }
2270 *mask = 0;
2271 /* assemble mask for MMI */
2272 if((auth_mask & mask_hsg) EQ mask_hsg)
2273 {
2274 *mask = *mask | MFW_SERVICE_HSG;
2275 }
2276 if((auth_mask & mask_dun) EQ mask_dun)
2277 {
2278 *mask = *mask | MFW_SERVICE_DUN;
2279 }
2280 if((auth_mask & mask_fax) EQ mask_fax)
2281 {
2282 *mask = *mask | MFW_SERVICE_FAX;
2283 }
2284 if((auth_mask & mask_opp) EQ mask_opp)
2285 {
2286 *mask = *mask | MFW_SERVICE_OPP;
2287 }
2288 if((auth_mask & mask_sync_cmd) EQ mask_sync_cmd)
2289 {
2290 *mask = *mask | MFW_SERVICE_SYNC_C;
2291 }
2292 return MFW_BT_OK;
2293 }
2294
2295 /*
2296 +--------------------------------------------------------------------+
2297 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
2298 | STATE : code ROUTINE :bt_set_authorization_device|
2299 +--------------------------------------------------------------------+
2300
2301 PURPOSE:set authorization mask to access available service on local device
2302 */
2303 T_MFW_BT_RESULT_BT bt_set_authorization_device (T_MFW_BT_BD_ADDR bd_addr[],
2304 T_MFW_BT_AUTHORIZATION_MASK mask)
2305 {
2306 T_BTI_AUTHORIZATION_MASK author_mask = 0;
2307 T_BTI_APPLI_NAME service_name[BTI_APPLI_NAME_LENGTH];
2308 U8 len;
2309
2310 TRACE_FUNCTION ("bt_set_authorization_device()");
2311
2312 memset(service_name,0,BTI_APPLI_NAME_LENGTH);
2313
2314 switch(mask)
2315 {
2316 case MFW_SERVICE_DUN:
2317 memcpy(service_name,MFW_BT_SERV_DUN,sizeof(MFW_BT_SERV_DUN));
2318 len = sizeof(MFW_BT_SERV_DUN);
2319 break;
2320 case MFW_SERVICE_HSG:
2321 memcpy(service_name,MFW_BT_SERV_HSG,sizeof(MFW_BT_SERV_HSG));
2322 len = sizeof(MFW_BT_SERV_HSG);
2323 break;
2324 case MFW_SERVICE_FAX:
2325 memcpy(service_name,MFW_BT_SERV_FAX,sizeof(MFW_BT_SERV_FAX));
2326 len = sizeof(MFW_BT_SERV_FAX);
2327 break;
2328 case MFW_SERVICE_OPP:
2329 memcpy(service_name,MFW_BT_SERV_OPP,sizeof(MFW_BT_SERV_OPP));
2330 len = sizeof(MFW_BT_SERV_OPP);
2331 break;
2332 case MFW_SERVICE_SYNC_C:
2333 memcpy(service_name,MFW_BT_SERV_SYNC_C,sizeof(MFW_BT_SERV_SYNC_C));
2334 len = sizeof(MFW_BT_SERV_SYNC_C);
2335 break;
2336 default:
2337 return MFW_BT_NOK;
2338 }
2339
2340 if(btibtp_get_authorization_mask(service_name,len,&author_mask) NEQ BTP_OK)
2341 {/* get SCM dependent mask for specified service */
2342 TRACE_EVENT ("Error:bt_list_auth_dev()");
2343 return MFW_BT_RET_FAIL;
2344 }
2345
2346 switch(btibtp_set_authorization(bd_addr,author_mask))
2347 {
2348 case BTP_OK:
2349 return MFW_BT_OK;
2350 case BTP_INVALID_PARAMETER:
2351 return MFW_BT_INVALID_PARA;
2352 case BTP_NOT_SUPP:
2353 return MFW_BT_NO_SUPP;
2354 case BTP_NOT_READY:
2355 return MFW_BT_NOT_READY;
2356 case BTP_INT_ERR:
2357 return MFW_BT_INT_ERR;
2358 case BTP_MEMORY_ERR:
2359 return MFW_BT_MEM_ERR;
2360 case BTP_NOK:
2361 return MFW_BT_NOK;
2362 }
2363 }
2364
2365 /*
2366 +---------------------------------------------------------------------+
2367 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
2368 | STATE : code ROUTINE :bt_del_authorizations_device|
2369 +---------------------------------------------------------------------+
2370
2371 PURPOSE:delete all authorizations to access available services on local device
2372 */
2373 T_MFW_BT_RESULT_BT bt_del_authorizations_device (T_MFW_BT_BD_ADDR bd_addr[])
2374 {
2375 TRACE_FUNCTION ("bt_del_authorizations_device()");
2376
2377 switch(btibtp_set_authorization(bd_addr,0))
2378 {
2379 case BTP_OK:
2380 return MFW_BT_OK;
2381 case BTP_INVALID_PARAMETER:
2382 return MFW_BT_INVALID_PARA;
2383 case BTP_NOT_SUPP:
2384 return MFW_BT_NO_SUPP;
2385 case BTP_NOT_READY:
2386 return MFW_BT_NOT_READY;
2387 case BTP_INT_ERR:
2388 return MFW_BT_INT_ERR;
2389 case BTP_MEMORY_ERR:
2390 return MFW_BT_MEM_ERR;
2391 case BTP_NOK:
2392 return MFW_BT_NOK;
2393 }
2394 }
2395
2396 /*
2397 +--------------------------------------------------------------------+
2398 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
2399 | STATE : code ROUTINE :bt_del_authorization |
2400 +--------------------------------------------------------------------+
2401
2402 PURPOSE:delete an authorization to access available service on local device
2403 */
2404 T_MFW_BT_RESULT_BT bt_del_authorization (T_MFW_BT_BD_ADDR bd_addr[],T_MFW_BT_AUTHORIZATION_MASK service_mask)
2405 {
2406 T_BTI_AUTHORIZATION_MASK auth_mask,author_mask = 0;
2407 T_BTI_APPLI_NAME service_name[BTI_APPLI_NAME_LENGTH];
2408 U8 len;
2409
2410 TRACE_EVENT ("bt_del_authorization()");
2411
2412 memset(service_name,0,BTI_APPLI_NAME_LENGTH);
2413
2414 switch(btibtp_get_authorization(bd_addr,&auth_mask))
2415 {/* give authorization mask with all authorizations of remote device */
2416 case BTP_OK:
2417 break;
2418 case BTP_INVALID_PARAMETER:
2419 return MFW_BT_INVALID_PARA;
2420 case BTP_NOT_SUPP:
2421 return MFW_BT_NO_SUPP;
2422 case BTP_NOT_READY:
2423 return MFW_BT_NOT_READY;
2424 case BTP_INT_ERR:
2425 return MFW_BT_INT_ERR;
2426 case BTP_MEMORY_ERR:
2427 return MFW_BT_MEM_ERR;
2428 case BTP_NOK:
2429 return MFW_BT_NOK;
2430 }
2431
2432 switch(service_mask)
2433 {
2434 case MFW_SERVICE_DUN:
2435 memcpy(service_name,MFW_BT_SERV_DUN,sizeof(MFW_BT_SERV_DUN));
2436 len = sizeof(MFW_BT_SERV_DUN);
2437 break;
2438 case MFW_SERVICE_HSG:
2439 memcpy(service_name,MFW_BT_SERV_HSG,sizeof(MFW_BT_SERV_HSG));
2440 len = sizeof(MFW_BT_SERV_HSG);
2441 break;
2442 case MFW_SERVICE_FAX:
2443 memcpy(service_name,MFW_BT_SERV_FAX,sizeof(MFW_BT_SERV_FAX));
2444 len = sizeof(MFW_BT_SERV_FAX);
2445 break;
2446 case MFW_SERVICE_OPP:
2447 memcpy(service_name,MFW_BT_SERV_OPP,sizeof(MFW_BT_SERV_OPP));
2448 len = sizeof(MFW_BT_SERV_OPP);
2449 break;
2450 case MFW_SERVICE_SYNC_C:
2451 memcpy(service_name,MFW_BT_SERV_SYNC_C,sizeof(MFW_BT_SERV_SYNC_C));
2452 len = sizeof(MFW_BT_SERV_SYNC_C);
2453 break;
2454 default:
2455 return MFW_BT_NOK;
2456 }
2457
2458 if(btibtp_get_authorization_mask(service_name,len,&author_mask) NEQ BTP_OK)
2459 {/* give SCM dependent authorization mask for specified service */
2460 TRACE_EVENT ("Error:bt_list_auth_dev()");
2461 return MFW_BT_RET_FAIL;
2462 }
2463 else
2464 {
2465 if((auth_mask & author_mask) EQ author_mask)
2466 {
2467 auth_mask= auth_mask & ~author_mask;/* delete the specified authorization in mask*/
2468 }
2469 else
2470 return MFW_BT_INVALID_PARA;
2471 }
2472
2473 switch(btibtp_set_authorization(bd_addr,auth_mask))
2474 {/* set authorization mask for remote device again */
2475 case BTP_OK:
2476 return MFW_BT_OK;
2477 case BTP_INVALID_PARAMETER:
2478 return MFW_BT_INVALID_PARA;
2479 case BTP_NOT_SUPP:
2480 return MFW_BT_NO_SUPP;
2481 case BTP_NOT_READY:
2482 return MFW_BT_NOT_READY;
2483 case BTP_INT_ERR:
2484 return MFW_BT_INT_ERR;
2485 case BTP_MEMORY_ERR:
2486 return MFW_BT_MEM_ERR;
2487 case BTP_NOK:
2488 return MFW_BT_NOK;
2489 }
2490 }
2491
2492 /*
2493 +--------------------------------------------------------------------+
2494 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
2495 | STATE : code ROUTINE :bt_start_pairing |
2496 +--------------------------------------------------------------------+
2497
2498 PURPOSE : start pairing procedure
2499
2500 */
2501 T_MFW_BT_RESULT_BT bt_start_pairing (T_MFW_BT_BD_ADDR bd_addr[],
2502 T_MFW_BT_PIN pin_code[],
2503 T_MFW_BT_PIN_MODE pin_mode)
2504 {
2505 UBYTE user_pin_code_length=4;
2506
2507 TRACE_FUNCTION ("bt_start_pairing()");
2508
2509 if(pin_mode EQ PIN_PROVIDED)
2510 {/* pairing provides to a link key between the gateway and the remote device */
2511
2512 user_pin_code_length = strlen((const char *)pin_code);
2513
2514 switch(btibtp_start_pairing(user_pin_code_length, pin_code, bd_addr))
2515 {
2516 case BTP_OK:
2517 return MFW_BT_EXECUTE;
2518 case BTP_INVALID_PARAMETER:
2519 return MFW_BT_INVALID_PARA;/* wrong pin */
2520 case BTP_NOT_SUPP:
2521 return MFW_BT_NO_SUPP;
2522 case BTP_NOT_READY:
2523 return MFW_BT_NOT_READY;
2524 case BTP_INT_ERR:
2525 return MFW_BT_INT_ERR;
2526 case BTP_MEMORY_ERR:
2527 return MFW_BT_MEM_ERR;
2528 case BTP_NOK:
2529 return MFW_BT_NOK;
2530 }
2531 }
2532 else
2533 {/* if device isn't able to provide a PIN code */
2534 switch(btibtp_start_pairing(0,0,bd_addr))
2535 {
2536 case BTP_OK:
2537 return MFW_BT_EXECUTE;
2538 case BTP_INVALID_PARAMETER:
2539 return MFW_BT_INVALID_PARA;
2540 case BTP_NOT_SUPP:
2541 return MFW_BT_NO_SUPP;
2542 case BTP_NOT_READY:
2543 return MFW_BT_NOT_READY;
2544 case BTP_INT_ERR:
2545 return MFW_BT_INT_ERR;
2546 case BTP_MEMORY_ERR:
2547 return MFW_BT_MEM_ERR;
2548 case BTP_NOK:
2549 return MFW_BT_NOK;
2550 }
2551 }
2552 }
2553 /*
2554 +--------------------------------------------------------------------+
2555 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
2556 | STATE : code ROUTINE :bt_delete_paired_device |
2557 +--------------------------------------------------------------------+
2558
2559 PURPOSE : delete paired device from the paired devices database
2560
2561 */
2562 T_MFW_BT_RESULT_BT bt_delete_paired_device (T_MFW_BT_BD_ADDR bd_addr[])
2563 {
2564 TRACE_FUNCTION ("bt_delete_paired_device()");
2565
2566 switch(btibtp_delete_paired_device(bd_addr))
2567 {
2568 case BTP_OK:
2569 return MFW_BT_OK;
2570 case BTP_INVALID_PARAMETER:
2571 return MFW_BT_INVALID_PARA;
2572 case BTP_NOT_SUPP:
2573 return MFW_BT_NO_SUPP;
2574 case BTP_NOT_READY:
2575 return MFW_BT_NOT_READY;
2576 case BTP_INT_ERR:
2577 return MFW_BT_INT_ERR;
2578 case BTP_MEMORY_ERR:
2579 return MFW_BT_MEM_ERR;
2580 case BTP_NOK:
2581 return MFW_BT_NOK;
2582 }
2583 }
2584
2585 /*
2586 +--------------------------------------------------------------------+
2587 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
2588 | STATE : code ROUTINE :bt_check_pair |
2589 +--------------------------------------------------------------------+
2590
2591 PURPOSE : check whether the device in the data base exists
2592
2593 */
2594 T_MFW_BT_RESULT_BT bt_check_pair (T_MFW_BT_BD_ADDR bd_addr[])
2595 {
2596 TRACE_FUNCTION ("bt_check_pair()");
2597
2598 switch(btibtp_check_pairing_state(bd_addr))
2599 {
2600 case BTP_OK:
2601 return MFW_BT_OK;
2602 case BTP_INVALID_PARAMETER:
2603 return MFW_BT_INVALID_PARA;
2604 case BTP_NOT_SUPP:
2605 return MFW_BT_NO_SUPP;
2606 case BTP_NOT_READY:
2607 return MFW_BT_NOT_READY;
2608 case BTP_INT_ERR:
2609 return MFW_BT_INT_ERR;
2610 case BTP_MEMORY_ERR:
2611 return MFW_BT_MEM_ERR;
2612 case BTP_NOK:
2613 return MFW_BT_NOK;
2614 }
2615 }
2616 #ifdef _SIMULATION_
2617 /*
2618 +--------------------------------------------------------------------+
2619 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
2620 | STATE : code ROUTINE :bt_transfer_audio_in |
2621 +--------------------------------------------------------------------+
2622
2623 PURPOSE : request transfer audio from headset to phone(headset gateway)
2624
2625 */
2626 T_MFW_BT_RESULT_BT bt_transfer_audio_in (T_MFW_BT_SERVICE_TYPE service)
2627 {
2628 TRACE_FUNCTION ("bt_transfer_audio_in()");
2629
2630 if(service EQ MFW_BT_HEADSET)
2631 {
2632 switch(btibtp_transfer_audio_in_req((T_BTI_DEVICE_TYPE)service))
2633 { /* BTP_TRANSFER_AUDIO_IN_REQ to BT */
2634 case BTP_OK:
2635 return MFW_BT_EXECUTE;
2636 case BTP_INVALID_PARAMETER:
2637 return MFW_BT_INVALID_PARA;
2638 case BTP_NOT_SUPP:
2639 return MFW_BT_NO_SUPP;
2640 case BTP_NOT_READY:
2641 return MFW_BT_NOT_READY;
2642 case BTP_INT_ERR:
2643 return MFW_BT_INT_ERR;
2644 case BTP_MEMORY_ERR:
2645 return MFW_BT_MEM_ERR;
2646 case BTP_NOK:
2647 return MFW_BT_NOK;
2648 }
2649 }
2650 return MFW_BT_FAIL;
2651 }
2652
2653 /*
2654 +--------------------------------------------------------------------+
2655 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
2656 | STATE : code ROUTINE :bt_transfer_audio_out|
2657 +--------------------------------------------------------------------+
2658
2659 PURPOSE : request transfer audio from headset gateway(phone)to the
2660 remote headset
2661 */
2662
2663 T_MFW_BT_RESULT_BT bt_transfer_audio_out(T_MFW_BT_SERVICE_TYPE service,
2664 T_MFW_BT_REQ_ID req_id,
2665 T_MFW_BT_BD_ADDR bd_addr[])
2666 {
2667 TRACE_FUNCTION ("bt_transfer_audio_out()");
2668
2669 if(service EQ MFW_BT_HEADSET)
2670 {
2671 switch(btibtp_transfer_audio_out_req((T_BTI_DEVICE_TYPE)service,req_id,bd_addr))
2672 { /* BTP_TRANSFER_AUDIO_OUT_REQ to BT */
2673 case BTP_OK:
2674 return MFW_BT_EXECUTE;
2675 case BTP_INVALID_PARAMETER:
2676 return MFW_BT_INVALID_PARA;
2677 case BTP_NOT_SUPP:
2678 return MFW_BT_NO_SUPP;
2679 case BTP_NOT_READY:
2680 return MFW_BT_NOT_READY;
2681 case BTP_INT_ERR:
2682 return MFW_BT_INT_ERR;
2683 case BTP_MEMORY_ERR:
2684 return MFW_BT_MEM_ERR;
2685 case BTP_NOK:
2686 return MFW_BT_NOK;
2687 }
2688 }
2689 return MFW_BT_FAIL;
2690 }
2691 #endif
2692
2693 /*
2694 +--------------------------------------------------------------------+
2695 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
2696 | STATE : code ROUTINE :bt_list_paired_dev |
2697 +--------------------------------------------------------------------+
2698
2699 PURPOSE : list all paired devices
2700
2701 */
2702 T_MFW_BT_RETURN bt_list_paired_dev(T_MFW_BT_DEV_PAIR_LIST * pair_list)
2703 {
2704 T_BT_DEV_PAIR_LIST paired_dev_list;
2705 U8 i;
2706
2707 TRACE_FUNCTION ("bt_list_paired_dev()");
2708
2709 memset(&paired_dev_list,0,sizeof(paired_dev_list));
2710 /* get list of devices of paired database */
2711 if(btibtp_list_paired_dev(&paired_dev_list) NEQ BTP_OK)
2712 {
2713 TRACE_EVENT ("Error:bt_list_paired_dev()");
2714 return MFW_BT_RET_FAIL;
2715 }
2716 else
2717 {
2718 pair_list->count = paired_dev_list.pair_counter;/* number of devices */
2719 for(i = 0;i<paired_dev_list.pair_counter; i++)
2720 memcpy(pair_list->paired_bd_addr[i],paired_dev_list.paired_addr[i],MFW_BT_ADDR_MAX_LEN);
2721
2722 return MFW_BT_RET_OK;
2723 }
2724 }
2725
2726 /*
2727 +--------------------------------------------------------------------+
2728 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
2729 | STATE : code ROUTINE :bt_list_auth_dev |
2730 +--------------------------------------------------------------------+
2731
2732 PURPOSE : list all devices of authorization database with their
2733 masks of available services on the local device
2734
2735 */
2736 T_MFW_BT_RETURN bt_list_auth_dev(T_MFW_BT_AUTHORIZATION_LIST * authorization_list)
2737 {
2738 T_BT_DEV_AUTHORIZATION_LIST auth_dev_list;
2739 U8 i;
2740 T_BTI_AUTHORIZATION_MASK mask_hsg,mask_dun,mask_fax,author_mask = 0;
2741 T_BTI_AUTHORIZATION_MASK mask_opp,mask_sync_cmd = 0;
2742 T_BTI_APPLI_NAME service_name[BTI_APPLI_NAME_LENGTH];
2743
2744 TRACE_FUNCTION ("bt_list_auth_dev()");
2745
2746 memset(&auth_dev_list,0,sizeof(auth_dev_list));
2747 memset(service_name,0,BTI_APPLI_NAME_LENGTH);
2748 /* get list of devices of authorization database */
2749 if(btibtp_list_auth_dev(&auth_dev_list) NEQ BTP_OK)
2750 {
2751 TRACE_EVENT ("Error:bt_list_auth_dev()");
2752 return MFW_BT_RET_FAIL;
2753 }
2754 else
2755 {
2756 memcpy(service_name,MFW_BT_SERV_DUN,sizeof(MFW_BT_SERV_DUN));
2757 if(btibtp_get_authorization_mask(service_name,sizeof(MFW_BT_SERV_DUN),&author_mask) NEQ BTP_OK)
2758 {/* get SCM-dependent authorization mask of service DUN */
2759 TRACE_EVENT ("Error:bt_list_auth_dev()");
2760 return MFW_BT_RET_FAIL;
2761 }
2762 else
2763 {
2764 mask_dun = author_mask;
2765 }
2766 memcpy(service_name,MFW_BT_SERV_HSG,sizeof(MFW_BT_SERV_HSG));
2767 if(btibtp_get_authorization_mask(service_name,sizeof(MFW_BT_SERV_HSG),&author_mask) NEQ BTP_OK)
2768 {/* get SCM-dependent authorization mask of service HSG */
2769 TRACE_EVENT ("Error:bt_list_auth_dev()");
2770 return MFW_BT_RET_FAIL;
2771 }
2772 else
2773 {
2774 mask_hsg = author_mask;
2775 }
2776 memcpy(service_name,MFW_BT_SERV_FAX,sizeof(MFW_BT_SERV_FAX));
2777 if(btibtp_get_authorization_mask(service_name,sizeof(MFW_BT_SERV_FAX),&author_mask) NEQ BTP_OK)
2778 {/* get SCM-dependent authorization mask of service FAX */
2779 TRACE_EVENT ("Error:bt_list_auth_dev()");
2780 return MFW_BT_RET_FAIL;
2781 }
2782 else
2783 {
2784 mask_fax = author_mask;
2785 }
2786 memcpy(service_name,MFW_BT_SERV_OPP,sizeof(MFW_BT_SERV_OPP));
2787 if(btibtp_get_authorization_mask(service_name,sizeof(MFW_BT_SERV_OPP),&author_mask) NEQ BTP_OK)
2788 {/* get SCM-dependent authorization mask of service OPP */
2789 TRACE_EVENT ("Error:bt_list_auth_dev()");
2790 return MFW_BT_RET_FAIL;
2791 }
2792 else
2793 {
2794 mask_opp = author_mask;
2795 }
2796 memcpy(service_name,MFW_BT_SERV_SYNC_C,sizeof(MFW_BT_SERV_SYNC_C));
2797 if(btibtp_get_authorization_mask(service_name,sizeof(MFW_BT_SERV_SYNC_C),&author_mask) NEQ BTP_OK)
2798 {/* get SCM-dependent authorization mask of service SYNC server with SYNC command support */
2799 TRACE_EVENT ("Error:bt_list_auth_dev()");
2800 return MFW_BT_RET_FAIL;
2801 }
2802 else
2803 {
2804 mask_sync_cmd = author_mask;
2805 }
2806
2807 authorization_list->count = auth_dev_list.auth_counter;
2808 for(i = 0;i<auth_dev_list.auth_counter; i++)
2809 {
2810 memcpy(authorization_list->auth_devices[i].remote_bd_addr,auth_dev_list.auth_el[i].remote_addr,MFW_BT_ADDR_MAX_LEN);
2811 /* assemble mask for each device */
2812 if((auth_dev_list.auth_el[i].mask_auth & mask_hsg) EQ mask_hsg)
2813 {
2814 authorization_list->auth_devices[i].mask_authorization = authorization_list->auth_devices[i].mask_authorization | MFW_SERVICE_HSG;
2815 }
2816
2817 if((auth_dev_list.auth_el[i].mask_auth & mask_dun) EQ mask_dun)
2818 {
2819 authorization_list->auth_devices[i].mask_authorization = authorization_list->auth_devices[i].mask_authorization | MFW_SERVICE_DUN;
2820 }
2821
2822 if((auth_dev_list.auth_el[i].mask_auth & mask_fax) EQ mask_fax)
2823 {
2824 authorization_list->auth_devices[i].mask_authorization = authorization_list->auth_devices[i].mask_authorization | MFW_SERVICE_FAX;
2825 }
2826
2827 if((auth_dev_list.auth_el[i].mask_auth & mask_opp) EQ mask_opp)
2828 {
2829 authorization_list->auth_devices[i].mask_authorization = authorization_list->auth_devices[i].mask_authorization | MFW_SERVICE_OPP;
2830 }
2831
2832 if((auth_dev_list.auth_el[i].mask_auth & mask_sync_cmd) EQ mask_sync_cmd)
2833 {
2834 authorization_list->auth_devices[i].mask_authorization = authorization_list->auth_devices[i].mask_authorization | MFW_SERVICE_SYNC_C;
2835 }
2836 }
2837 return MFW_BT_RET_OK;
2838 }
2839 }
2840
2841 /*
2842 +-------------------------------------------------------------------------+
2843 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
2844 | STATE : code ROUTINE :bt_authorized_devices |
2845 +-------------------------------------------------------------------------+
2846
2847 PURPOSE : list all devices of authorization database with desired
2848 authorization (service_mask)
2849 */
2850 T_MFW_BT_RETURN bt_authorized_devices(T_MFW_BT_AUTHORIZATION_LIST * authorization_list,T_MFW_BT_AUTHORIZATION_MASK service_mask )
2851 {
2852 T_BT_DEV_AUTHORIZATION_LIST auth_dev_list;
2853 U8 i,j;
2854 T_BTI_AUTHORIZATION_MASK author_mask,mask_hsg,mask_dun,mask_fax,mask_opp = 0;
2855 T_BTI_AUTHORIZATION_MASK mask_sync_cmd = 0;
2856 T_BTI_APPLI_NAME service_name[BTI_APPLI_NAME_LENGTH];
2857
2858 TRACE_EVENT ("bt_authorized_devices()");
2859
2860 memset(&auth_dev_list,0,sizeof(auth_dev_list));
2861 memset(service_name,0,BTI_APPLI_NAME_LENGTH);
2862 /* get list of devices of authorization database */
2863 if(btibtp_list_auth_dev(&auth_dev_list) NEQ BTP_OK)
2864 {
2865 TRACE_EVENT ("Error:bt_authorized_devices()");
2866 return MFW_BT_RET_FAIL;
2867 }
2868 else
2869 {
2870 memcpy(service_name,MFW_BT_SERV_DUN,sizeof(MFW_BT_SERV_DUN));
2871 if(btibtp_get_authorization_mask(service_name,sizeof(MFW_BT_SERV_DUN),&author_mask) NEQ BTP_OK)
2872 {/* get SCM-dependent authorization mask of service DUN */
2873 TRACE_EVENT ("Error:bt_authorized_devices()");
2874 return MFW_BT_RET_FAIL;
2875 }
2876 else
2877 {
2878 mask_dun = author_mask;
2879 }
2880 memcpy(service_name,MFW_BT_SERV_HSG,sizeof(MFW_BT_SERV_HSG));
2881 if(btibtp_get_authorization_mask(service_name,sizeof(MFW_BT_SERV_HSG),&author_mask) NEQ BTP_OK)
2882 {/* get SCM-dependent authorization mask of service HSG */
2883 TRACE_EVENT ("Error:bt_authorized_devices()");
2884 return MFW_BT_RET_FAIL;
2885 }
2886 else
2887 {
2888 mask_hsg = author_mask;
2889 }
2890 memcpy(service_name,MFW_BT_SERV_FAX,sizeof(MFW_BT_SERV_FAX));
2891 if(btibtp_get_authorization_mask(service_name,sizeof(MFW_BT_SERV_FAX),&author_mask) NEQ BTP_OK)
2892 {/* get SCM-dependent authorization mask of service FAX */
2893 TRACE_EVENT ("Error:bt_authorized_devices()");
2894 return MFW_BT_RET_FAIL;
2895 }
2896 else
2897 {
2898 mask_fax = author_mask;
2899 }
2900 memcpy(service_name,MFW_BT_SERV_OPP,sizeof(MFW_BT_SERV_OPP));
2901 if(btibtp_get_authorization_mask(service_name,sizeof(MFW_BT_SERV_OPP),&author_mask) NEQ BTP_OK)
2902 {/* get SCM-dependent authorization mask of service OPP */
2903 TRACE_EVENT ("Error:bt_authorized_devices()");
2904 return MFW_BT_RET_FAIL;
2905 }
2906 else
2907 {
2908 mask_opp = author_mask;
2909 }
2910 memcpy(service_name,MFW_BT_SERV_SYNC_C,sizeof(MFW_BT_SERV_SYNC_C));
2911 if(btibtp_get_authorization_mask(service_name,sizeof(MFW_BT_SERV_SYNC_C),&author_mask) NEQ BTP_OK)
2912 {/* get SCM-dependent authorization mask of service SYNC server with SYN command support */
2913 TRACE_EVENT ("Error:bt_authorized_devices()");
2914 return MFW_BT_RET_FAIL;
2915 }
2916 else
2917 {
2918 mask_sync_cmd = author_mask;
2919 }
2920
2921 for(i=0,j=0;i<auth_dev_list.auth_counter; i++)
2922 {
2923 switch(service_mask)
2924 {
2925 case MFW_SERVICE_HSG:
2926 if((auth_dev_list.auth_el[i].mask_auth & mask_hsg) EQ mask_hsg)
2927 {
2928 authorization_list->auth_devices[j].mask_authorization = authorization_list->auth_devices[i].mask_authorization | MFW_SERVICE_HSG;
2929 memcpy(authorization_list->auth_devices[j].remote_bd_addr,auth_dev_list.auth_el[i].remote_addr,MFW_BT_ADDR_MAX_LEN);
2930 authorization_list->count++;
2931 j++;
2932 }
2933 break;
2934 case MFW_SERVICE_DUN:
2935 if((auth_dev_list.auth_el[i].mask_auth & mask_dun) EQ mask_dun)
2936 {
2937 authorization_list->auth_devices[j].mask_authorization = authorization_list->auth_devices[i].mask_authorization | MFW_SERVICE_DUN;
2938 memcpy(authorization_list->auth_devices[j].remote_bd_addr,auth_dev_list.auth_el[i].remote_addr,MFW_BT_ADDR_MAX_LEN);
2939 authorization_list->count++;
2940 j++;
2941 }
2942 break;
2943 case MFW_SERVICE_FAX:
2944 if((auth_dev_list.auth_el[i].mask_auth & mask_fax) EQ mask_fax)
2945 {
2946 authorization_list->auth_devices[j].mask_authorization = authorization_list->auth_devices[i].mask_authorization | MFW_SERVICE_FAX;
2947 memcpy(authorization_list->auth_devices[j].remote_bd_addr,auth_dev_list.auth_el[i].remote_addr,MFW_BT_ADDR_MAX_LEN);
2948 authorization_list->count++;
2949 j++;
2950 }
2951 break;
2952 case MFW_SERVICE_OPP:
2953 if((auth_dev_list.auth_el[i].mask_auth & mask_opp) EQ mask_opp)
2954 {
2955 authorization_list->auth_devices[j].mask_authorization = authorization_list->auth_devices[i].mask_authorization | MFW_SERVICE_OPP;
2956 memcpy(authorization_list->auth_devices[j].remote_bd_addr,auth_dev_list.auth_el[i].remote_addr,MFW_BT_ADDR_MAX_LEN);
2957 authorization_list->count++;
2958 j++;
2959 }
2960 break;
2961 case MFW_SERVICE_SYNC_C:
2962 if((auth_dev_list.auth_el[i].mask_auth & mask_sync_cmd) EQ mask_sync_cmd)
2963 {
2964 authorization_list->auth_devices[j].mask_authorization = authorization_list->auth_devices[i].mask_authorization | MFW_SERVICE_SYNC_C;
2965 memcpy(authorization_list->auth_devices[j].remote_bd_addr,auth_dev_list.auth_el[i].remote_addr,MFW_BT_ADDR_MAX_LEN);
2966 authorization_list->count++;
2967 j++;
2968 }
2969 break;
2970 default:
2971 return MFW_BT_RET_FAIL;
2972 }
2973 }
2974 return MFW_BT_RET_OK;
2975 }
2976 }
2977 /*
2978 +--------------------------------------------------------------------+
2979 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
2980 | STATE : code ROUTINE :bt_clear_list_found_dev|
2981 +--------------------------------------------------------------------+
2982
2983 PURPOSE : clear list of found devices with theirs service id's
2984
2985 */
2986 T_MFW_BT_RETURN bt_clear_list_found_dev (void)
2987 {
2988 T_MFW_BT_DEVICE_ID *help_ptr;
2989 T_MFW_BT_DEVICE_ID *help_h_ptr;
2990
2991 TRACE_FUNCTION ("bt_clear_list_found_dev()");
2992
2993 if(service_list.device_id) /* check:is list of found hs empty ?*/
2994 {
2995 help_ptr = service_list.device_id->next;
2996 MFREE(service_list.device_id); /* free memory first element */
2997 service_list.device_id = help_ptr;
2998 while(help_ptr)
2999 {
3000 help_h_ptr = help_ptr->next;
3001 MFREE(help_ptr); /* free next elements */
3002 help_ptr = help_h_ptr;
3003 service_list.device_id = help_ptr;
3004 }
3005 }
3006 return MFW_BT_RET_OK;
3007 }
3008
3009 /*
3010 +--------------------------------------------------------------------+
3011 | PROJECT : MMI-Framework (8445)MODULE : MFW_BT |
3012 | STATE : code ROUTINE :bt_clear_all_lists_found_serv|
3013 +--------------------------------------------------------------------+
3014
3015 PURPOSE : clear all list of found services
3016
3017 */
3018 T_MFW_BT_RETURN bt_clear_all_lists_found_serv (void)
3019 {
3020 T_MFW_BT_SERVICE_ID *help_ptr;
3021 T_MFW_BT_SERVICE_ID *help_h_ptr;
3022
3023 TRACE_FUNCTION ("bt_clear_all_lists_found_serv()");
3024
3025 if(found_headset.device_id) /* check: is list of found hs empty ? */
3026 {
3027 help_ptr = found_headset.device_id->next;
3028 MFREE(found_headset.device_id->bd_name);/* free name of first element */
3029 MFREE(found_headset.device_id); /* free memory first element */
3030 found_headset.device_id = help_ptr;
3031 while(help_ptr)
3032 {
3033 help_h_ptr = help_ptr->next;
3034 MFREE(help_ptr->bd_name); /* free name of next elements */
3035 MFREE(help_ptr); /* free next elements */
3036 help_ptr = help_h_ptr;
3037 found_headset.device_id = help_ptr;
3038 }
3039 }
3040 if(found_dial_up.device_id)/* check: is list of found dun empty ? */
3041 {
3042 help_ptr = found_dial_up.device_id->next;
3043 MFREE(found_dial_up.device_id->bd_name);/* free name of first element */
3044 MFREE(found_dial_up.device_id); /* free memory first element */
3045 found_dial_up.device_id = help_ptr;
3046 while(help_ptr)
3047 {
3048 help_h_ptr = help_ptr->next;
3049 MFREE(help_ptr->bd_name); /* free name of next elements */
3050 MFREE(help_ptr); /* free next elements */
3051 help_ptr = help_h_ptr;
3052 found_dial_up.device_id = help_ptr;
3053 }
3054 }
3055 if(found_fax.device_id)/* check: is list of found fax empty ? */
3056 {
3057 help_ptr = found_fax.device_id->next;
3058 MFREE(found_fax.device_id->bd_name);/* free name of first element */
3059 MFREE(found_fax.device_id); /* free memory first element */
3060 found_fax.device_id = help_ptr;
3061 while(help_ptr)
3062 {
3063 help_h_ptr = help_ptr->next;
3064 MFREE(help_ptr->bd_name); /* free name of next elements */
3065 MFREE(help_ptr); /* free next elements */
3066 help_ptr = help_h_ptr;
3067 found_fax.device_id = help_ptr;
3068 }
3069 }
3070 if(found_opp.device_id)/* check: is list of found OPP empty ? */
3071 {
3072 help_ptr = found_opp.device_id->next;
3073 MFREE(found_opp.device_id->bd_name);/* free name of first element */
3074 MFREE(found_opp.device_id); /* free memory first element */
3075 found_opp.device_id = help_ptr;
3076 while(help_ptr)
3077 {
3078 help_h_ptr = help_ptr->next;
3079 MFREE(help_ptr->bd_name); /* free name of next elements */
3080 MFREE(help_ptr); /* free next elements */
3081 help_ptr = help_h_ptr;
3082 found_opp.device_id = help_ptr;
3083 }
3084 }
3085 if(found_sync.device_id)/* check: is list of found SYNC server empty ? */
3086 {
3087 help_ptr = found_sync.device_id->next;
3088 MFREE(found_sync.device_id->bd_name);/* free name of first element */
3089 MFREE(found_sync.device_id); /* free memory first element */
3090 found_sync.device_id = help_ptr;
3091 while(help_ptr)
3092 {
3093 help_h_ptr = help_ptr->next;
3094 MFREE(help_ptr->bd_name); /* free name of next elements */
3095 MFREE(help_ptr); /* free next elements */
3096 help_ptr = help_h_ptr;
3097 found_sync.device_id = help_ptr;
3098 }
3099 }
3100 if(found_sync_cmd.device_id)/* check: is list of found SYNC_CMD server empty ? */
3101 {
3102 help_ptr = found_sync_cmd.device_id->next;
3103 MFREE(found_sync_cmd.device_id->bd_name);/* free name of first element */
3104 MFREE(found_sync_cmd.device_id); /* free memory first element */
3105 found_sync_cmd.device_id = help_ptr;
3106 while(help_ptr)
3107 {
3108 help_h_ptr = help_ptr->next;
3109 MFREE(help_ptr->bd_name); /* free name of next elements */
3110 MFREE(help_ptr); /* free next elements */
3111 help_ptr = help_h_ptr;
3112 found_sync_cmd.device_id = help_ptr;
3113 }
3114 }
3115 return MFW_BT_RET_OK;
3116 }
3117 /*
3118 +--------------------------------------------------------------------+
3119 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
3120 | STATE : code ROUTINE :bt_clear_list_found_serv|
3121 +--------------------------------------------------------------------+
3122
3123 PURPOSE : clear list of specific found service
3124
3125 */
3126 T_MFW_BT_RETURN bt_clear_list_found_serv (T_MFW_BT_SERVICE_TYPE service)
3127 {
3128 T_MFW_BT_SERVICE_ID *help_ptr;
3129 T_MFW_BT_SERVICE_ID *help_h_ptr;
3130
3131 TRACE_FUNCTION ("bt_clear_list_found_serv()");
3132
3133 if(service EQ MFW_BT_HEADSET)
3134 {
3135 if(found_headset.device_id) /* check: is list of found hs empty ? */
3136 {
3137 help_ptr = found_headset.device_id->next;
3138 MFREE(found_headset.device_id->bd_name);/* free name of first element */
3139 MFREE(found_headset.device_id); /* free memory first element */
3140 found_headset.device_id = help_ptr;
3141 while(help_ptr)
3142 {
3143 help_h_ptr = help_ptr->next;
3144 MFREE(help_ptr->bd_name); /* free name of next elements */
3145 MFREE(help_ptr); /* free next elements */
3146 help_ptr = help_h_ptr;
3147 found_headset.device_id = help_ptr;
3148 }
3149 }
3150 return MFW_BT_RET_OK;
3151 }
3152 else if(service EQ MFW_BT_DIAL_UP)
3153 {/* check: is list of found dun empty ? */
3154 if(found_dial_up.device_id)
3155 {
3156 help_ptr = found_dial_up.device_id->next;
3157 MFREE(found_dial_up.device_id->bd_name);/* free name of first element */
3158 MFREE(found_dial_up.device_id); /* free memory first element */
3159 found_dial_up.device_id = help_ptr;
3160 while(help_ptr)
3161 {
3162 help_h_ptr = help_ptr->next;
3163 MFREE(help_ptr->bd_name); /* free name of next elements */
3164 MFREE(help_ptr); /* free next elements */
3165 help_ptr = help_h_ptr;
3166 found_dial_up.device_id = help_ptr;
3167 }
3168 }
3169 return MFW_BT_RET_OK;
3170 }
3171 else if(service EQ MFW_BT_FAX_GW)
3172 {/* check: is list of found fax empty ? */
3173 if(found_fax.device_id)
3174 {
3175 help_ptr = found_fax.device_id->next;
3176 MFREE(found_fax.device_id->bd_name);/* free name of first element */
3177 MFREE(found_fax.device_id); /* free memory first element */
3178 found_fax.device_id = help_ptr;
3179 while(help_ptr)
3180 {
3181 help_h_ptr = help_ptr->next;
3182 MFREE(help_ptr->bd_name); /* free name of next elements */
3183 MFREE(help_ptr); /* free next elements */
3184 help_ptr = help_h_ptr;
3185 found_fax.device_id = help_ptr;
3186 }
3187 }
3188 return MFW_BT_RET_OK;
3189 }
3190 else if(service EQ MFW_BT_OPP)
3191 {/* check: is list of found OPP empty ? */
3192 if(found_opp.device_id)
3193 {
3194 help_ptr = found_opp.device_id->next;
3195 MFREE(found_opp.device_id->bd_name);/* free name of first element */
3196 MFREE(found_opp.device_id); /* free memory first element */
3197 found_opp.device_id = help_ptr;
3198 while(help_ptr)
3199 {
3200 help_h_ptr = help_ptr->next;
3201 MFREE(help_ptr->bd_name); /* free name of next elements */
3202 MFREE(help_ptr); /* free next elements */
3203 help_ptr = help_h_ptr;
3204 found_opp.device_id = help_ptr;
3205 }
3206 }
3207 return MFW_BT_RET_OK;
3208 }
3209 else if(service EQ MFW_BT_SYNC)
3210 {/* check: is list of found SYNC server empty ? */
3211 if(found_sync.device_id)
3212 {
3213 help_ptr = found_sync.device_id->next;
3214 MFREE(found_sync.device_id->bd_name);/* free name of first element */
3215 MFREE(found_sync.device_id); /* free memory first element */
3216 found_sync.device_id = help_ptr;
3217 while(help_ptr)
3218 {
3219 help_h_ptr = help_ptr->next;
3220 MFREE(help_ptr->bd_name); /* free name of next elements */
3221 MFREE(help_ptr); /* free next elements */
3222 help_ptr = help_h_ptr;
3223 found_sync.device_id = help_ptr;
3224 }
3225 }
3226 return MFW_BT_RET_OK;
3227 }
3228 else if(service EQ MFW_BT_SYNC_CMD)
3229 {/* check:is list of found SYNC server with support SYN commands empty ? */
3230 if(found_sync_cmd.device_id)
3231 {
3232 help_ptr = found_sync_cmd.device_id->next;
3233 MFREE(found_sync_cmd.device_id->bd_name);/* free name of first element */
3234 MFREE(found_sync_cmd.device_id); /* free memory first element */
3235 found_sync_cmd.device_id = help_ptr;
3236 while(help_ptr)
3237 {
3238 help_h_ptr = help_ptr->next;
3239 MFREE(help_ptr->bd_name); /* free name of next elements */
3240 MFREE(help_ptr); /* free next elements */
3241 help_ptr = help_h_ptr;
3242 found_sync_cmd.device_id = help_ptr;
3243 }
3244 }
3245 return MFW_BT_RET_OK;
3246 }
3247 else
3248 return MFW_BT_RET_FAIL;
3249 }
3250 /*
3251 +--------------------------------------------------------------------+
3252 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
3253 | STATE : code ROUTINE :bt_set_param_headset|
3254 +--------------------------------------------------------------------+
3255
3256 PURPOSE:remote control of speaker or microphone gain (profile headset)
3257 */
3258
3259 T_MFW_BT_RESULT_BT bt_set_param_headset (T_MFW_BT_SERVICE_TYPE service,
3260 T_MFW_BT_PARAM_NUMBER nb,
3261 T_MFW_BT_CHANGE_PARA type,
3262 U16 new_value)
3263 {
3264 TRACE_FUNCTION ("bt_set_param_headset()");
3265 if(service EQ MFW_BT_HEADSET)
3266 {
3267 /* update parameter speaker or microphone */
3268 if((nb EQ MFW_BT_MIC_GAIN) OR
3269 (nb EQ MFW_BT_SPEAKER_GAIN))
3270 {/* increase or decrease (+1/-1) or set new value */
3271 if((type EQ MFW_BT_PARA_INC) OR
3272 (type EQ MFW_BT_PARA_DEC) OR
3273 (type EQ MFW_BT_PARA_SET))
3274 {
3275 if(type EQ MFW_BT_PARA_SET)
3276 {/* for set value valid value is needed */
3277 if(!new_value)
3278 {
3279 return MFW_BT_NOK;
3280 }
3281 }
3282
3283 switch(btibtp_set_param_headset(nb,type,new_value))
3284 {
3285 case BTP_OK:
3286 return MFW_BT_OK;
3287 case BTP_INVALID_PARAMETER:
3288 return MFW_BT_INVALID_PARA;
3289 case BTP_NOT_SUPP:
3290 return MFW_BT_NO_SUPP;
3291 case BTP_NOT_READY:
3292 return MFW_BT_NOT_READY;
3293 case BTP_INT_ERR:
3294 return MFW_BT_INT_ERR;
3295 case BTP_MEMORY_ERR:
3296 return MFW_BT_MEM_ERR;
3297 case BTP_NOK:
3298 return MFW_BT_NOK;
3299 }
3300 }
3301 else
3302 return MFW_BT_NOK;
3303 }
3304 else
3305 return MFW_BT_FAIL;
3306 }
3307 else
3308 return MFW_BT_FAIL;
3309 }
3310
3311 /*
3312 +--------------------------------------------------------------------+
3313 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
3314 | STATE : code ROUTINE :bt_get_default_service_info|
3315 +--------------------------------------------------------------------+
3316
3317 PURPOSE:get device info from default headset list
3318 */
3319 T_MFW_BT_RESULT_BT bt_get_default_service_info (T_MFW_BT_SERVICE_TYPE service,
3320 T_MFW_BT_DEV_ID dev_id,
3321 T_MFW_BT_HEADSET_INFO *hs_info)
3322 {
3323 T_BTI_HSG_DEFAULT_INFO headset_info;
3324
3325 TRACE_FUNCTION ("bt_get_default_service_info()");
3326
3327 memset(&headset_info,0,sizeof(headset_info));
3328
3329 if(service EQ MFW_BT_HEADSET)
3330 {
3331 switch(btibtp_get_headset_info(dev_id,&headset_info))
3332 {
3333 case BTP_OK:
3334 hs_info->priority = headset_info.priority;
3335 memcpy(hs_info->bd_addr,headset_info.bd_addr,sizeof(headset_info.bd_addr));
3336 memcpy(hs_info->hsg_name,headset_info.name,MFW_BT_HSG_NAME_MAX_LEN);
3337 hs_info->mfw_remote_audio_control_support = headset_info.bt_remote_audio_control_support;
3338 return MFW_BT_OK;
3339 case BTP_INVALID_PARAMETER:
3340 return MFW_BT_INVALID_PARA;
3341 case BTP_NOT_SUPP:
3342 return MFW_BT_NO_SUPP;
3343 case BTP_NOT_READY:
3344 return MFW_BT_NOT_READY;
3345 case BTP_INT_ERR:
3346 return MFW_BT_INT_ERR;
3347 case BTP_MEMORY_ERR:
3348 return MFW_BT_MEM_ERR;
3349 case BTP_NOK:
3350 return MFW_BT_NOK;
3351 }
3352 }
3353 else
3354 return MFW_BT_FAIL;
3355 }
3356
3357 /*
3358 +--------------------------------------------------------------------+
3359 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
3360 | STATE : code ROUTINE :bt_set_prio_default_service|
3361 +--------------------------------------------------------------------+
3362
3363 PURPOSE:set priority in default headset list
3364 */
3365 T_MFW_BT_RESULT_BT bt_set_prio_default_service (T_MFW_BT_SERVICE_TYPE service,
3366 T_MFW_BT_DEV_ID dev_id,
3367 T_MFW_BT_PRIORITY priority)
3368 {
3369 TRACE_FUNCTION ("bt_set_prio_default_service()");
3370
3371 if(service EQ MFW_BT_HEADSET)
3372 {
3373 switch(btibtp_set_prio_default_headset(dev_id,priority))
3374 {
3375 case BTP_OK:
3376 return MFW_BT_OK;
3377 case BTP_INVALID_PARAMETER:
3378 return MFW_BT_INVALID_PARA;
3379 case BTP_NOT_SUPP:
3380 return MFW_BT_NO_SUPP;
3381 case BTP_NOT_READY:
3382 return MFW_BT_NOT_READY;
3383 case BTP_INT_ERR:
3384 return MFW_BT_INT_ERR;
3385 case BTP_MEMORY_ERR:
3386 return MFW_BT_MEM_ERR;
3387 case BTP_NOK:
3388 return MFW_BT_NOK;
3389 }
3390 }
3391 else
3392 {
3393 TRACE_EVENT ("bt_set_prio_default_service:Error");
3394 return MFW_BT_FAIL;
3395 }
3396 }
3397
3398 /*
3399 +--------------------------------------------------------------------+
3400 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
3401 | STATE : code ROUTINE :bt_get_config |
3402 +--------------------------------------------------------------------+
3403
3404 PURPOSE:get configuration parameters of bluetooth profile headset
3405 */
3406 T_MFW_BT_RESULT_BT bt_get_config (T_MFW_BT_SERVICE_TYPE service,
3407 T_MFW_BT_HSG_CLIENT_CONFIG *client_conf,
3408 T_MFW_BT_HSG_SERVER_CONFIG *server_conf)
3409 {
3410 T_BTI_HSG_CLIENT_CONF bt_client_conf;
3411 T_BTI_HSG_SERVER_CONF bt_server_conf;
3412
3413 TRACE_FUNCTION ("bt_get_config()");
3414
3415 memset(&bt_client_conf,0,sizeof(bt_client_conf));
3416 memset(&bt_server_conf,0,sizeof(bt_server_conf));
3417
3418 if(service EQ MFW_BT_HEADSET)
3419 {
3420 switch(btibtp_get_config((T_BTI_DEVICE_TYPE)service,&bt_client_conf,&bt_server_conf))
3421 {
3422 case BTP_OK:
3423 switch(bt_client_conf.config_mode)
3424 {
3425 case BTI_AUTO_OUTG_DEF_CONN_OFF:
3426 client_conf->config_mode = MFW_BT_AUTO_OUTG_DEF_CONN_OFF;
3427 break;
3428 case BTI_AUTO_OUTG_DEF_CONN_ON:
3429 client_conf->config_mode = MFW_BT_AUTO_OUTG_DEF_CONN_ON;
3430 break;
3431 default:
3432 return MFW_BT_INVALID_PARA;
3433 }
3434 client_conf->security = bt_client_conf.security;
3435
3436 server_conf->security = bt_server_conf.security;
3437 server_conf->serv_con_conf = bt_server_conf.conn_config;
3438 server_conf->conn_break = bt_server_conf.conn_break;
3439 server_conf->conn_time = bt_server_conf.conn_time;
3440 server_conf->nb_phone = bt_server_conf.nb_phone;
3441 memcpy(server_conf->mfw_phone_list,bt_server_conf.phon_list,sizeof(bt_server_conf.phon_list));
3442 memcpy(server_conf->mfw_key_list,bt_server_conf.key_list,sizeof(bt_server_conf.key_list));
3443 return MFW_BT_OK;
3444 case BTP_INVALID_PARAMETER:
3445 return MFW_BT_INVALID_PARA;
3446 case BTP_NOT_SUPP:
3447 return MFW_BT_NO_SUPP;
3448 case BTP_NOT_READY:
3449 return MFW_BT_NOT_READY;
3450 case BTP_INT_ERR:
3451 return MFW_BT_INT_ERR;
3452 case BTP_MEMORY_ERR:
3453 return MFW_BT_MEM_ERR;
3454 case BTP_NOK:
3455 return MFW_BT_NOK;
3456 }
3457 }
3458 else
3459 return MFW_BT_FAIL;
3460 }
3461 #ifdef _SIMULATION_
3462 /*
3463 +--------------------------------------------------------------------+
3464 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
3465 | STATE : code ROUTINE :bt_save_config |
3466 +--------------------------------------------------------------------+
3467
3468 PURPOSE:save configuration parameters of bluetooth profile headset
3469 */
3470 T_MFW_BT_RESULT_BT bt_save_config (T_MFW_BT_SERVICE_TYPE service)
3471 {
3472 TRACE_FUNCTION ("bt_save_config()");
3473
3474 if(service EQ MFW_BT_HEADSET)
3475 {
3476 switch(btibtp_save_config((T_BTI_DEVICE_TYPE)service))
3477 {
3478 case BTP_OK:
3479 return MFW_BT_OK;
3480 case BTP_INVALID_PARAMETER:
3481 return MFW_BT_INVALID_PARA;
3482 case BTP_NOT_SUPP:
3483 return MFW_BT_NO_SUPP;
3484 case BTP_NOT_READY:
3485 return MFW_BT_NOT_READY;
3486 case BTP_INT_ERR:
3487 return MFW_BT_INT_ERR;
3488 case BTP_MEMORY_ERR:
3489 return MFW_BT_MEM_ERR;
3490 case BTP_NOK:
3491 return MFW_BT_NOK;
3492 }
3493 }
3494 else
3495 return MFW_BT_FAIL;
3496 }
3497
3498 /*
3499 +--------------------------------------------------------------------+
3500 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
3501 | STATE : code ROUTINE :bt_restore_config|
3502 +--------------------------------------------------------------------+
3503
3504 PURPOSE:restore configuration parameters of bluetooth profile headset
3505 */
3506 T_MFW_BT_RESULT_BT bt_restore_config (T_MFW_BT_SERVICE_TYPE service)
3507 {
3508 TRACE_FUNCTION ("bt_restore_config()");
3509
3510 if(service EQ MFW_BT_HEADSET)
3511 {
3512 switch(btibtp_restore_config((T_BTI_DEVICE_TYPE)service))
3513 {
3514 case BTP_OK:
3515 return MFW_BT_EXECUTE;
3516 case BTP_INVALID_PARAMETER:
3517 return MFW_BT_INVALID_PARA;
3518 case BTP_NOT_SUPP:
3519 return MFW_BT_NO_SUPP;
3520 case BTP_NOT_READY:
3521 return MFW_BT_NOT_READY;
3522 case BTP_INT_ERR:
3523 return MFW_BT_INT_ERR;
3524 case BTP_MEMORY_ERR:
3525 return MFW_BT_MEM_ERR;
3526 case BTP_NOK:
3527 return MFW_BT_NOK;
3528 }
3529 }
3530 else
3531 return MFW_BT_FAIL;
3532 }
3533
3534 /*
3535 +--------------------------------------------------------------------+
3536 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
3537 | STATE : code ROUTINE :bt_save_default_list|
3538 +--------------------------------------------------------------------+
3539
3540 PURPOSE: save default headset list in non-volatile memory
3541 */
3542 T_MFW_BT_RESULT_BT bt_save_default_list (T_MFW_BT_SERVICE_TYPE service)
3543 {
3544 TRACE_FUNCTION ("bt_save_default_list()");
3545
3546 if(service EQ MFW_BT_HEADSET)
3547 {
3548 switch(btibtp_save_def_list((T_BTI_DEVICE_TYPE)service))
3549 {
3550 case BTP_OK:
3551 return MFW_BT_OK;
3552 case BTP_INVALID_PARAMETER:
3553 return MFW_BT_INVALID_PARA;
3554 case BTP_NOT_SUPP:
3555 return MFW_BT_NO_SUPP;
3556 case BTP_NOT_READY:
3557 return MFW_BT_NOT_READY;
3558 case BTP_INT_ERR:
3559 return MFW_BT_INT_ERR;
3560 case BTP_MEMORY_ERR:
3561 return MFW_BT_MEM_ERR;
3562 case BTP_NOK:
3563 return MFW_BT_NOK;
3564 }
3565 }
3566 else
3567 return MFW_BT_FAIL;
3568 }
3569
3570 /*
3571 +--------------------------------------------------------------------+
3572 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
3573 | STATE : code ROUTINE :bt_restore_default_list|
3574 +--------------------------------------------------------------------+
3575
3576 PURPOSE: restore default headset list from non-volatile memory
3577 */
3578 T_MFW_BT_RESULT_BT bt_restore_default_list (T_MFW_BT_SERVICE_TYPE service)
3579 {
3580 TRACE_FUNCTION ("bt_restore_default_list()");
3581
3582 if(service EQ MFW_BT_HEADSET)
3583 {
3584 switch(btibtp_restore_def_list((T_BTI_DEVICE_TYPE)service))
3585 {
3586 case BTP_OK:
3587 return MFW_BT_EXECUTE;
3588 case BTP_INVALID_PARAMETER:
3589 return MFW_BT_INVALID_PARA;
3590 case BTP_NOT_SUPP:
3591 return MFW_BT_NO_SUPP;
3592 case BTP_NOT_READY:
3593 return MFW_BT_NOT_READY;
3594 case BTP_INT_ERR:
3595 return MFW_BT_INT_ERR;
3596 case BTP_MEMORY_ERR:
3597 return MFW_BT_MEM_ERR;
3598 case BTP_NOK:
3599 return MFW_BT_NOK;
3600 }
3601 }
3602 else
3603 return MFW_BT_FAIL;
3604 }
3605 #endif
3606 /*
3607 +--------------------------------------------------------------------+
3608 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
3609 | STATE : code ROUTINE : bt_set_security_mode |
3610 +--------------------------------------------------------------------+
3611
3612 PURPOSE: set common security mode
3613 */
3614 T_MFW_BT_RESULT_BT bt_set_security_mode (T_MFW_BT_SECURITY_MODE sec_mode)
3615 {
3616 TRACE_FUNCTION ("bt_set_security_mode()");
3617
3618 /* security mode 1: local device will never initiate any security procedure,
3619 only services which registered their security requirements
3620 as no-security, will be usable
3621 security mode 2: local device shall initiate security procedure
3622 according to the requirements of the requested service
3623 security mode 3: local device will initiate security procedures
3624 before setting up the link and informing the host,
3625 some services with no security requirements may be unusable */
3626 if((sec_mode EQ MFW_BT_SECURITY_MODE_1) OR
3627 (sec_mode EQ MFW_BT_SECURITY_MODE_2) OR
3628 (sec_mode EQ MFW_BT_SECURITY_MODE_3))
3629 {
3630 switch(btibtp_set_sec_mode((T_BTI_SM_SECURITY_MODE)sec_mode))
3631 {
3632 case BTP_OK:
3633 return MFW_BT_OK;
3634 case BTP_INVALID_PARAMETER:
3635 return MFW_BT_INVALID_PARA;
3636 case BTP_NOT_SUPP:
3637 return MFW_BT_NO_SUPP;
3638 case BTP_NOT_READY:
3639 return MFW_BT_NOT_READY;
3640 case BTP_INT_ERR:
3641 return MFW_BT_INT_ERR;
3642 case BTP_MEMORY_ERR:
3643 return MFW_BT_MEM_ERR;
3644 case BTP_NOK:
3645 return MFW_BT_NOK;
3646 }
3647 }
3648 else
3649 return MFW_BT_FAIL;
3650 }
3651
3652 /*
3653 +--------------------------------------------------------------------+
3654 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
3655 | STATE : code ROUTINE : bt_set_pair_mode |
3656 +--------------------------------------------------------------------+
3657
3658 PURPOSE: set pairing mode
3659 */
3660 T_MFW_BT_RESULT_BT bt_set_pair_mode (T_MFW_BT_PAIRABLE_MODE pair_mode)
3661 {
3662 TRACE_FUNCTION ("bt_set_pair_mode()");
3663
3664 if((pair_mode EQ MFW_BT_PAIRABLE) OR
3665 (pair_mode EQ MFW_BT_NON_PAIRABLE))
3666 {
3667 switch(btibtp_set_pair_mode((T_BTI_SM_PAIRABLE_MODE)pair_mode))
3668 {
3669 case BTP_OK:
3670 return MFW_BT_OK;
3671 case BTP_INVALID_PARAMETER:
3672 return MFW_BT_INVALID_PARA;
3673 case BTP_NOT_SUPP:
3674 return MFW_BT_NO_SUPP;
3675 case BTP_NOT_READY:
3676 return MFW_BT_NOT_READY;
3677 case BTP_INT_ERR:
3678 return MFW_BT_INT_ERR;
3679 case BTP_MEMORY_ERR:
3680 return MFW_BT_MEM_ERR;
3681 case BTP_NOK:
3682 return MFW_BT_NOK;
3683 }
3684 }
3685 else
3686 return MFW_BT_FAIL;
3687 }
3688
3689 /*
3690 +------------------------------------------------------------------------+
3691 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
3692 | STATE : code ROUTINE : bt_set_default_security |
3693 +------------------------------------------------------------------------+
3694
3695 PURPOSE: set default security requirements
3696 */
3697 T_MFW_BT_RESULT_BT bt_set_default_security (U8 security_level)
3698 {
3699 TRACE_FUNCTION ("bt_set_default_security()");
3700
3701 /* set security level of BT protocol stack for incoming and outgoing
3702 connections - this determines the security level needed to access
3703 any unregistered services */
3704
3705 switch(btibtp_set_default_security(security_level))
3706 {
3707 case BTP_OK:
3708 return MFW_BT_OK;
3709 case BTP_INVALID_PARAMETER:
3710 return MFW_BT_INVALID_PARA;
3711 case BTP_NOT_SUPP:
3712 return MFW_BT_NO_SUPP;
3713 case BTP_NOT_READY:
3714 return MFW_BT_NOT_READY;
3715 case BTP_INT_ERR:
3716 return MFW_BT_INT_ERR;
3717 case BTP_MEMORY_ERR:
3718 return MFW_BT_MEM_ERR;
3719 case BTP_NOK:
3720 return MFW_BT_NOK;
3721 }
3722 }
3723
3724 /*
3725 +--------------------------------------------------------------------+
3726 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
3727 | STATE : code ROUTINE:bt_start_profile_application|
3728 +--------------------------------------------------------------------+
3729
3730 PURPOSE : start bluetooth application
3731
3732 */
3733 T_MFW_BT_RESULT_BT bt_start_profile_application (T_MFW_BT_SERVICE_TYPE service)
3734 {
3735 /* start to activate bluetooth profiles, create resources and the profile
3736 instance */
3737
3738 TRACE_FUNCTION ("bt_start_profile_application()");
3739
3740 if((service EQ MFW_BT_HEADSET) OR
3741 (service EQ MFW_BT_DIAL_UP) OR
3742 (service EQ MFW_BT_FAX_GW) OR
3743 (service EQ MFW_BT_OPP) OR
3744 (service EQ MFW_BT_SYNC) OR
3745 (service EQ MFW_BT_PCA_GW))
3746 {
3747 switch(btibtp_start((T_BTI_DEVICE_TYPE) service))
3748 {
3749 case BTP_OK:
3750 return MFW_BT_OK;
3751 case BTP_INVALID_PARAMETER:
3752 return MFW_BT_INVALID_PARA;/* appli_name is not known by BTE */
3753 case BTP_NOT_READY:
3754 return MFW_BT_NOT_READY;/* appli_name is already running */
3755 case BTP_INT_ERR:
3756 return MFW_BT_INT_ERR;/* appli_name does not have a get_info function */
3757 case BTP_MEMORY_ERR:
3758 return MFW_BT_MEM_ERR;/* problem of memory in BTE */
3759 }
3760 }
3761 else
3762 return MFW_BT_FAIL;
3763 }
3764
3765 /*
3766 +--------------------------------------------------------------------+
3767 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
3768 | STATE : code ROUTINE:bt_stop_profile_application |
3769 +--------------------------------------------------------------------+
3770
3771 PURPOSE : start bluetooth application
3772
3773 */
3774 T_MFW_BT_RESULT_BT bt_stop_profile_application (T_MFW_BT_SERVICE_TYPE service)
3775 {
3776 /* start to activate bluetooth profiles, create resources and the profile
3777 instance */
3778
3779 TRACE_FUNCTION ("bt_stop_profile_application()");
3780
3781 if((service EQ MFW_BT_HEADSET) OR
3782 (service EQ MFW_BT_DIAL_UP) OR
3783 (service EQ MFW_BT_FAX_GW) OR
3784 (service EQ MFW_BT_OPP) OR
3785 (service EQ MFW_BT_SYNC) OR
3786 (service EQ MFW_BT_PCA_GW))
3787 {
3788 switch(btibtp_stop((T_BTI_DEVICE_TYPE) service))
3789 {
3790 case BTP_OK:
3791 return MFW_BT_OK;
3792 case BTP_INVALID_PARAMETER:
3793 return MFW_BT_INVALID_PARA;/* appli_name is not known by BTE */
3794 case BTP_NOT_READY:
3795 return MFW_BT_NOT_READY;/* appli_name is already running */
3796 case BTP_INT_ERR:
3797 return MFW_BT_INT_ERR;/* appli_name does not have a get_info function */
3798 case BTP_MEMORY_ERR:
3799 return MFW_BT_MEM_ERR;/* problem of memory in BTE */
3800 }
3801 }
3802 else
3803 return MFW_BT_FAIL;
3804 }
3805
3806 /*
3807 +--------------------------------------------------------------------+
3808 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
3809 | STATE : code ROUTINE : bt_register_sm |
3810 +--------------------------------------------------------------------+
3811
3812 PURPOSE : start bluetooth security manager
3813
3814 */
3815 T_MFW_BT_RESULT_BT bt_register_sm (void)
3816 {
3817 TRACE_FUNCTION ("bt_register_sm()");
3818
3819 /* mandatory registration in order to handle requests from SCM -
3820 Security Manager - authentication and authorization */
3821
3822 switch(btibtp_register_sm())/* set callback function */
3823 {
3824 case BTP_OK:
3825 return MFW_BT_OK;
3826 case BTP_INVALID_PARAMETER:
3827 TRACE_EVENT ("Error:bt_register_sm()");
3828 return MFW_BT_INVALID_PARA;
3829 case BTP_NOT_SUPP:
3830 return MFW_BT_NO_SUPP;
3831 case BTP_NOT_READY:
3832 return MFW_BT_NOT_READY;
3833 case BTP_INT_ERR:
3834 return MFW_BT_INT_ERR;
3835 case BTP_MEMORY_ERR:
3836 return MFW_BT_MEM_ERR;
3837 case BTP_NOK:
3838 return MFW_BT_NOK;
3839 }
3840 }
3841
3842 /*
3843 +--------------------------------------------------------------------+
3844 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
3845 | STATE : code ROUTINE : bt_deregister_sm |
3846 +--------------------------------------------------------------------+
3847
3848 PURPOSE : stop bluetooth security manager
3849
3850 */
3851 T_MFW_BT_RESULT_BT bt_deregister_sm(void)
3852 {
3853 TRACE_EVENT ("bt_deregister_sm()");
3854
3855 /* mandatory deregistration */
3856
3857 switch(btibtp_deregister_sm())
3858 {
3859 case BTP_OK:
3860 return MFW_BT_OK;
3861 case BTP_INVALID_PARAMETER:
3862 TRACE_EVENT ("Error:bt_deregister_sm()");
3863 return MFW_BT_INVALID_PARA;
3864 case BTP_NOT_SUPP:
3865 return MFW_BT_NO_SUPP;
3866 case BTP_NOT_READY:
3867 return MFW_BT_NOT_READY;
3868 case BTP_INT_ERR:
3869 return MFW_BT_INT_ERR;
3870 case BTP_MEMORY_ERR:
3871 return MFW_BT_MEM_ERR;
3872 case BTP_NOK:
3873 return MFW_BT_NOK;
3874 }
3875 }
3876 /*
3877 +--------------------------------------------------------------------+
3878 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
3879 | STATE : code ROUTINE :bt_opp_put_reply |
3880 +--------------------------------------------------------------------+
3881
3882 PURPOSE : reply the put requesting by opp client (about server)
3883 */
3884 T_MFW_BT_RESULT_BT bt_opp_put_reply ( T_MFW_BT_SERVICE_TYPE service,
3885 T_MFW_BT_SUBTYPE_DEV subtype,
3886 T_MFW_BT_OPP_PUT_RES opp_put_res,
3887 T_MFW_BT_OPP_OBJECT received_obj)
3888 {
3889 T_BTI_OPP_OBJECT bti_opp_object;
3890 T_BTI_OPP_PUT_RES bti_opp_put_res;
3891
3892 TRACE_EVENT ("bt_opp_put_reply()");
3893
3894 memset(&bti_opp_object,0,sizeof(T_BTI_OPP_OBJECT));
3895
3896 if(service EQ MFW_BT_OPP)
3897 {
3898 if(subtype EQ MFW_BT_SERVER)
3899 {
3900 /*
3901 *** MFW_BT_OPP_CONTINUE : positive response
3902 MFW_BT_OPP_R_ENTITY_TOO_L:negative response,the request is too big
3903 MFW_BT_OPP_FORBIDDEN: negative response, put is rejected
3904 ***
3905 */
3906 if(opp_put_res EQ MFW_BT_OPP_CONTINUE)
3907 {
3908 switch(received_obj.mfw_object_type)
3909 {
3910 case MFW_BT_BUFFER:/* object will be supposed to be stored in buffer */
3911 bti_opp_object.bt_object_type = BTI_TYPE_BUFFER;
3912 bti_opp_object.bt_buffer_start = received_obj.mfw_buffer_start;
3913 bti_opp_object.bt_buffer_size = received_obj.mfw_buffer_size;
3914 break;
3915 case MFW_BT_PATH:/* object will be supposed to be stored in file system */
3916 bti_opp_object.bt_object_type = BTI_TYPE_PATH;
3917 bti_opp_object.bt_path = received_obj.mfw_path;
3918 break;
3919 default:
3920 return MFW_BT_FAIL;
3921 }
3922 bti_opp_object.bt_object_name = received_obj.mfw_object_name;
3923 bti_opp_object.bt_object_length = received_obj.mfw_object_length;
3924
3925 switch(btibtp_opp_put_resp((T_BTI_OPP_PUT_RES)opp_put_res,bti_opp_object))
3926 {
3927 case BTP_OK:
3928 return MFW_BT_OK;
3929 case BTP_INVALID_PARAMETER:
3930 return MFW_BT_INVALID_PARA;
3931 case BTP_NOT_SUPP:
3932 return MFW_BT_NO_SUPP;
3933 case BTP_NOT_READY:
3934 return MFW_BT_NOT_READY;
3935 case BTP_INT_ERR:
3936 return MFW_BT_INT_ERR;
3937 case BTP_MEMORY_ERR:
3938 return MFW_BT_MEM_ERR;
3939 case BTP_NOK:
3940 return MFW_BT_NOK;
3941 }
3942 }
3943 else if((opp_put_res EQ MFW_BT_OPP_R_ENTITY_TOO_L) OR
3944 (opp_put_res EQ MFW_BT_OPP_FORBIDDEN))
3945 {
3946 switch(opp_put_res)
3947 {
3948 case MFW_BT_OPP_R_ENTITY_TOO_L:
3949 bti_opp_put_res = BTI_OPP_TOO_LARGE;
3950 break;
3951 case MFW_BT_OPP_FORBIDDEN:
3952 bti_opp_put_res = BTI_OPP_FORBIDDEN;
3953 break;
3954 default:
3955 return MFW_BT_FAIL;
3956 }
3957 switch(btibtp_opp_put_resp(bti_opp_put_res,bti_opp_object))
3958 {
3959 case BTP_OK:
3960 return MFW_BT_OK;
3961 case BTP_INVALID_PARAMETER:
3962 return MFW_BT_INVALID_PARA;
3963 case BTP_NOT_SUPP:
3964 return MFW_BT_NO_SUPP;
3965 case BTP_NOT_READY:
3966 return MFW_BT_NOT_READY;
3967 case BTP_INT_ERR:
3968 return MFW_BT_INT_ERR;
3969 case BTP_MEMORY_ERR:
3970 return MFW_BT_MEM_ERR;
3971 case BTP_NOK:
3972 return MFW_BT_NOK;
3973 }
3974 }
3975 else
3976 return MFW_BT_FAIL;
3977 }
3978 else
3979 return MFW_BT_FAIL;
3980 }
3981 else
3982 return MFW_BT_FAIL;
3983 }
3984
3985 /*
3986 +--------------------------------------------------------------------+
3987 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
3988 | STATE : code ROUTINE :bt_opp_push_object |
3989 +--------------------------------------------------------------------+
3990
3991 PURPOSE : push an object to OPP server
3992
3993 */
3994 T_MFW_BT_RESULT_BT bt_opp_push_object (T_MFW_BT_SERVICE_TYPE service,
3995 T_MFW_BT_SUBTYPE_DEV subtype,
3996 T_MFW_BT_BD_ADDR server_address[],
3997 BOOL mfw_keep_connection,
3998 T_MFW_BT_OPP_OBJECT mfw_obj_to_push)
3999 {
4000 T_BTI_OPP_OBJECT bti_opp_object_to_push;
4001
4002 TRACE_FUNCTION ("bt_opp_push_object()");
4003
4004 memset(&bti_opp_object_to_push,0,sizeof(T_BTI_OPP_OBJECT));
4005
4006 if(service EQ MFW_BT_OPP)
4007 {
4008 if(subtype EQ MFW_BT_CLIENT)
4009 {
4010 switch(mfw_obj_to_push.mfw_object_type)
4011 {
4012 case MFW_BT_BUFFER:/* object to be sent is stored in buffer */
4013 bti_opp_object_to_push.bt_object_type = BTI_TYPE_BUFFER;
4014 bti_opp_object_to_push.bt_buffer_start = mfw_obj_to_push.mfw_buffer_start;
4015 bti_opp_object_to_push.bt_buffer_size = mfw_obj_to_push.mfw_buffer_size;
4016 break;
4017 case MFW_BT_PATH:/* object to be sent is stored in file system */
4018 bti_opp_object_to_push.bt_object_type = BTI_TYPE_PATH;
4019 bti_opp_object_to_push.bt_path = mfw_obj_to_push.mfw_path;
4020 break;
4021 default:
4022 return MFW_BT_FAIL;
4023 }
4024 /* MIME type of object to be sent */
4025 bti_opp_object_to_push.bt_object_mime_type = mfw_obj_to_push.mfw_object_mime_type;
4026 /* name of object to be sent */
4027 bti_opp_object_to_push.bt_object_name = mfw_obj_to_push.mfw_object_name;
4028 /* length of object to be sent */
4029 bti_opp_object_to_push.bt_object_length = mfw_obj_to_push.mfw_object_length;
4030
4031 switch(btibtp_opp_push_object(bti_opp_object_to_push,server_address,mfw_keep_connection))
4032 {
4033 case BTP_OK:
4034 return MFW_BT_EXECUTE;
4035 case BTP_INVALID_PARAMETER:
4036 return MFW_BT_INVALID_PARA;
4037 case BTP_NOT_SUPP:
4038 return MFW_BT_NO_SUPP;
4039 case BTP_NOT_READY:
4040 return MFW_BT_NOT_READY;
4041 case BTP_INT_ERR:
4042 return MFW_BT_INT_ERR;
4043 case BTP_MEMORY_ERR:
4044 return MFW_BT_MEM_ERR;
4045 case BTP_NOK:
4046 return MFW_BT_NOK;
4047 }
4048 }
4049 else
4050 return MFW_BT_FAIL;
4051 }
4052 else
4053 return MFW_BT_FAIL;
4054 }
4055
4056 /*
4057 +--------------------------------------------------------------------+
4058 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4059 | STATE : code ROUTINE :bt_opp_pull_object |
4060 +--------------------------------------------------------------------+
4061
4062 PURPOSE : pull an default server object from OPP server
4063
4064 */
4065 T_MFW_BT_RESULT_BT bt_opp_pull_object (T_MFW_BT_SERVICE_TYPE service,
4066 T_MFW_BT_SUBTYPE_DEV subtype,
4067 T_MFW_BT_BD_ADDR server_address[],
4068 BOOL mfw_keep_connection,
4069 T_MFW_BT_OPP_OBJECT mfw_obj_to_pull)
4070 {
4071 T_BTI_OPP_OBJECT bti_opp_object_to_pull;
4072
4073 TRACE_FUNCTION ("bt_opp_pull_object()");
4074
4075 memset(&bti_opp_object_to_pull,0,sizeof(T_BTI_OPP_OBJECT));
4076
4077 if(service EQ MFW_BT_OPP)
4078 {
4079 if(subtype EQ MFW_BT_CLIENT)
4080 {
4081 switch(mfw_obj_to_pull.mfw_object_type)
4082 {
4083 case MFW_BT_BUFFER:/* object to be pulled will be supposed to be stored in buffer */
4084 bti_opp_object_to_pull.bt_object_type = BTI_TYPE_BUFFER;
4085 bti_opp_object_to_pull.bt_buffer_start = mfw_obj_to_pull.mfw_buffer_start;
4086 bti_opp_object_to_pull.bt_buffer_size = mfw_obj_to_pull.mfw_buffer_size;
4087 break;
4088 case MFW_BT_PATH:/* object to be pulled will be supposed to be stored in file system */
4089 bti_opp_object_to_pull.bt_object_type = BTI_TYPE_PATH;
4090 bti_opp_object_to_pull.bt_path = mfw_obj_to_pull.mfw_path;
4091 break;
4092 default:
4093 return MFW_BT_FAIL;
4094 }
4095 /* MIME type of object to be pulled */
4096 bti_opp_object_to_pull.bt_object_mime_type = mfw_obj_to_pull.mfw_object_mime_type;
4097 /* name of object to be pulled */
4098 bti_opp_object_to_pull.bt_object_length = mfw_obj_to_pull.mfw_object_length;
4099 /* length of object to be pulled */
4100 bti_opp_object_to_pull.bt_object_name = mfw_obj_to_pull.mfw_object_name;
4101 switch(btibtp_opp_pull_object(bti_opp_object_to_pull,server_address,mfw_keep_connection))
4102 {
4103 case BTP_OK:
4104 return MFW_BT_EXECUTE;
4105 case BTP_INVALID_PARAMETER:
4106 return MFW_BT_INVALID_PARA;
4107 case BTP_NOT_SUPP:
4108 return MFW_BT_NO_SUPP;
4109 case BTP_NOT_READY:
4110 return MFW_BT_NOT_READY;
4111 case BTP_INT_ERR:
4112 return MFW_BT_INT_ERR;
4113 case BTP_MEMORY_ERR:
4114 return MFW_BT_MEM_ERR;
4115 case BTP_NOK:
4116 return MFW_BT_NOK;
4117 }
4118 }
4119 else
4120 return MFW_BT_FAIL;
4121 }
4122 else
4123 return MFW_BT_FAIL;
4124 }
4125
4126 /*
4127 +--------------------------------------------------------------------+
4128 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4129 | STATE : code ROUTINE :bt_opp_exch_objects |
4130 +--------------------------------------------------------------------+
4131
4132 PURPOSE : exchange business cards with OPP server
4133
4134 */
4135 T_MFW_BT_RESULT_BT bt_opp_exch_objects (T_MFW_BT_SERVICE_TYPE service,
4136 T_MFW_BT_SUBTYPE_DEV subtype,
4137 T_MFW_BT_OPP_OBJECT obj_to_push,
4138 T_MFW_BT_OPP_OBJECT obj_to_pull,
4139 T_MFW_BT_BD_ADDR server_address[],
4140 BOOL mfw_keep_connection)
4141 {
4142 T_BTI_OPP_OBJECT bti_opp_object_to_pull;
4143 T_BTI_OPP_OBJECT bti_opp_object_to_push;
4144
4145 TRACE_FUNCTION ("bt_opp_exch_objects()");
4146
4147 memset(&bti_opp_object_to_push,0,sizeof(T_BTI_OPP_OBJECT));
4148 memset(&bti_opp_object_to_pull,0,sizeof(T_BTI_OPP_OBJECT));
4149
4150 if(service EQ MFW_BT_OPP)
4151 {
4152 if(subtype EQ MFW_BT_CLIENT)
4153 {
4154 switch(obj_to_push.mfw_object_type)
4155 {
4156 case MFW_BT_BUFFER:/* object to be pushed is stored in buffer */
4157 bti_opp_object_to_push.bt_object_type = BTI_TYPE_BUFFER;
4158 bti_opp_object_to_push.bt_buffer_start = obj_to_push.mfw_buffer_start;
4159 bti_opp_object_to_push.bt_buffer_size = obj_to_push.mfw_buffer_size;
4160 break;
4161 case MFW_BT_PATH:/* object to be pushed is stored in file system */
4162 bti_opp_object_to_push.bt_object_type = BTI_TYPE_PATH;
4163 bti_opp_object_to_push.bt_path = obj_to_push.mfw_path;
4164 break;
4165 default:
4166 return MFW_BT_FAIL;
4167 }
4168 /* MIME type of object to be pushed */
4169 bti_opp_object_to_push.bt_object_mime_type = obj_to_push.mfw_object_mime_type;
4170 /* name of object to be pushed */
4171 bti_opp_object_to_push.bt_object_name = obj_to_push.mfw_object_name;
4172 /* length of object to be pushed */
4173 bti_opp_object_to_push.bt_object_length = obj_to_push.mfw_object_length;
4174
4175 switch(obj_to_pull.mfw_object_type)
4176 {
4177 case MFW_BT_BUFFER:/* object to be pulled will be supposed to be stored in buffer */
4178 bti_opp_object_to_pull.bt_object_type = BTI_TYPE_BUFFER;
4179 bti_opp_object_to_pull.bt_buffer_start = obj_to_pull.mfw_buffer_start;
4180 bti_opp_object_to_pull.bt_buffer_size = obj_to_pull.mfw_buffer_size;
4181 break;
4182 case MFW_BT_PATH:/* object to be pulled will be supposed to be stored in file system */
4183 bti_opp_object_to_pull.bt_object_type = BTI_TYPE_PATH;
4184 bti_opp_object_to_pull.bt_path = obj_to_pull.mfw_path;
4185 break;
4186 default:
4187 return MFW_BT_FAIL;
4188 }
4189 /* MIME type of object to be pulled */
4190 bti_opp_object_to_pull.bt_object_mime_type = obj_to_pull.mfw_object_mime_type;
4191 /* length of object to be pulled */
4192 bti_opp_object_to_pull.bt_object_length = obj_to_pull.mfw_object_length;
4193 /* name of object to be pulled */
4194 bti_opp_object_to_pull.bt_object_name = obj_to_pull.mfw_object_name;
4195
4196 switch(btibtp_opp_exch_objects(bti_opp_object_to_push,bti_opp_object_to_pull,
4197 server_address,mfw_keep_connection))
4198 {
4199 case BTP_OK:
4200 return MFW_BT_EXECUTE;
4201 case BTP_INVALID_PARAMETER:
4202 return MFW_BT_INVALID_PARA;
4203 case BTP_NOT_SUPP:
4204 return MFW_BT_NO_SUPP;
4205 case BTP_NOT_READY:
4206 return MFW_BT_NOT_READY;
4207 case BTP_INT_ERR:
4208 return MFW_BT_INT_ERR;
4209 case BTP_MEMORY_ERR:
4210 return MFW_BT_MEM_ERR;
4211 case BTP_NOK:
4212 return MFW_BT_NOK;
4213 }
4214 }
4215 else
4216 return MFW_BT_FAIL;
4217 }
4218 else
4219 return MFW_BT_FAIL;
4220 }
4221
4222 /*
4223 +----------------------------------------------------------------------+
4224 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4225 | STATE : code ROUTINE : bt_syn_s_send_com |
4226 +----------------------------------------------------------------------+
4227
4228 PURPOSE : SYNC server send SYN command to SYNC client with
4229 SYNC command support
4230
4231 */
4232 T_MFW_BT_RESULT_BT bt_syn_s_send_com (T_MFW_BT_SERVICE_TYPE service,
4233 T_MFW_BT_SUBTYPE_DEV subtype,
4234 T_MFW_BT_SYNC_COMMAND sync_comm,
4235 T_MFW_BT_SYN_OBJECT_STORE sync_object,
4236 T_MFW_BT_BD_ADDR sync_client_address[])
4237 {
4238 T_BTI_SYNC_COMMAND bt_sync_com;
4239 T_BTI_SYN_OBJECT_STORE bt_sync_object;
4240
4241 TRACE_FUNCTION ("bt_syn_s_send_com()");
4242
4243 bt_sync_object = (T_BTI_SYN_OBJECT_STORE)sync_object;
4244
4245 if(service EQ MFW_BT_SYNC)
4246 {
4247 if(subtype EQ MFW_BT_SERVER)
4248 {
4249 switch(sync_comm)
4250 {
4251 case MFW_BT_SYNC_CO_SYNC:
4252 /* SYNC server push command: SYNC synchronization initiated by Server */
4253 bt_sync_com = sync_comm;
4254 break;
4255 case MFW_BT_SYNC_CO_PUT:
4256 /* SYNC server push command: PUT */
4257 bt_sync_com = sync_comm;
4258 break;
4259 default:
4260 return MFW_BT_FAIL;
4261 }
4262
4263 switch(btibtp_sync_ser_send_com(bt_sync_com,bt_sync_object,sync_client_address))
4264 {
4265 case BTP_OK:
4266 return MFW_BT_EXECUTE;
4267 case BTP_INVALID_PARAMETER:
4268 return MFW_BT_INVALID_PARA;
4269 case BTP_NOT_SUPP:
4270 return MFW_BT_NO_SUPP;
4271 case BTP_NOT_READY:
4272 return MFW_BT_NOT_READY;
4273 case BTP_INT_ERR:
4274 return MFW_BT_INT_ERR;
4275 case BTP_MEMORY_ERR:
4276 return MFW_BT_MEM_ERR;
4277 case BTP_NOK:
4278 return MFW_BT_NOK;
4279 }
4280 }
4281 else
4282 return MFW_BT_FAIL;
4283 }
4284 else
4285 return MFW_BT_FAIL;
4286 }
4287
4288 /*
4289 +----------------------------------------------------------------------+
4290 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4291 | STATE : code ROUTINE : bt_syn_s_auth_res |
4292 +----------------------------------------------------------------------+
4293
4294 PURPOSE : SYNC server sends authentication response
4295
4296 */
4297 T_MFW_BT_RESULT_BT bt_syn_s_auth_res (T_MFW_BT_SERVICE_TYPE service,
4298 T_MFW_BT_SUBTYPE_DEV subtype,
4299 T_MFW_BT_SYN_PASSWD * mfw_sync_password)
4300 {
4301 TRACE_FUNCTION ("bt_syn_s_auth_res()");
4302
4303 if(service EQ MFW_BT_SYNC)
4304 {
4305 if(subtype EQ MFW_BT_SERVER)
4306 {
4307 if(mfw_sync_password)
4308 {
4309 switch(btibtp_sync_ser_auth_res(mfw_sync_password))
4310 {
4311 case BTP_OK:
4312 return MFW_BT_OK;
4313 case BTP_INVALID_PARAMETER:
4314 return MFW_BT_INVALID_PARA;
4315 case BTP_NOT_SUPP:
4316 return MFW_BT_NO_SUPP;
4317 case BTP_NOT_READY:
4318 return MFW_BT_NOT_READY;
4319 case BTP_INT_ERR:
4320 return MFW_BT_INT_ERR;
4321 case BTP_MEMORY_ERR:
4322 return MFW_BT_MEM_ERR;
4323 case BTP_NOK:
4324 return MFW_BT_NOK;
4325 }
4326 }
4327 else
4328 return MFW_BT_INVALID_PARA;
4329 }
4330 else
4331 return MFW_BT_FAIL;
4332 }
4333 else
4334 return MFW_BT_FAIL;
4335 }
4336
4337 /*
4338 +----------------------------------------------------------------------+
4339 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4340 | STATE : code ROUTINE : bt_syn_s_sync_terminate |
4341 +----------------------------------------------------------------------+
4342
4343 PURPOSE : SYNC server terminates synchronization
4344
4345 */
4346 T_MFW_BT_RESULT_BT bt_syn_s_sync_terminate (T_MFW_BT_SERVICE_TYPE service,
4347 T_MFW_BT_SUBTYPE_DEV subtype)
4348 {
4349 TRACE_FUNCTION ("bt_syn_s_sync_terminate()");
4350
4351 if(service EQ MFW_BT_SYNC)
4352 {
4353 if(subtype EQ MFW_BT_SERVER)
4354 {
4355 switch(btibtp_sync_syn_terminate())
4356 {
4357 case BTP_OK:
4358 return MFW_BT_OK;
4359 case BTP_INVALID_PARAMETER:
4360 return MFW_BT_INVALID_PARA;
4361 case BTP_NOT_SUPP:
4362 return MFW_BT_NO_SUPP;
4363 case BTP_NOT_READY:
4364 return MFW_BT_NOT_READY;
4365 case BTP_INT_ERR:
4366 return MFW_BT_INT_ERR;
4367 case BTP_MEMORY_ERR:
4368 return MFW_BT_MEM_ERR;
4369 case BTP_NOK:
4370 return MFW_BT_NOK;
4371 }
4372 }
4373 else
4374 return MFW_BT_FAIL;
4375 }
4376 else
4377 return MFW_BT_FAIL;
4378 }
4379
4380 /*
4381 +----------------------------------------------------------------------+
4382 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4383 | STATE : code ROUTINE : bt_syn_s_pull_resp |
4384 +----------------------------------------------------------------------+
4385
4386 PURPOSE : SYNC server sends pull request response
4387
4388 */
4389 T_MFW_BT_RESULT_BT bt_syn_s_pull_resp (T_MFW_BT_SERVICE_TYPE service,
4390 T_MFW_BT_SUBTYPE_DEV subtype,
4391 T_MFW_BT_SYNC_OBJECT mfw_syn_pull_obj)
4392 {
4393 T_BTI_SYNC_OBJECT syn_pull_object;
4394
4395 TRACE_FUNCTION ("bt_syn_s_pull_resp()");
4396
4397 memset(&syn_pull_object,0,sizeof(syn_pull_object));
4398
4399 if(service EQ MFW_BT_SYNC)
4400 {
4401 if(subtype EQ MFW_BT_SERVER)
4402 {
4403 switch(mfw_syn_pull_obj.mfw_object_type)
4404 {
4405 case MFW_BT_BUFFER:/* object to be pulled will be supposed to be stored in buffer */
4406 syn_pull_object.bt_object_type = BTI_TYPE_BUFFER;
4407 syn_pull_object.bt_buffer_start = mfw_syn_pull_obj.mfw_buffer_start;
4408 syn_pull_object.bt_buffer_size = mfw_syn_pull_obj.mfw_buffer_size;
4409 break;
4410 case MFW_BT_PATH:/* object to be pulled will be supposed to be stored in file system */
4411 syn_pull_object.bt_object_type = BTI_TYPE_PATH;
4412 syn_pull_object.bt_path = mfw_syn_pull_obj.mfw_path;
4413 break;
4414 default:
4415 return MFW_BT_FAIL;
4416 }
4417 /* MIME type of object to be pulled */
4418 syn_pull_object.bt_object_mime_type = mfw_syn_pull_obj.mfw_object_mime_type;
4419 /* name of object to be pulled */
4420 syn_pull_object.bt_object_length = mfw_syn_pull_obj.mfw_object_length;
4421 /* length of object to be pulled */
4422 syn_pull_object.bt_object_name = mfw_syn_pull_obj.mfw_object_name;
4423
4424 switch(btibtp_sync_ser_pull_res(syn_pull_object))
4425 {
4426 case BTP_OK:
4427 return MFW_BT_OK;
4428 case BTP_INVALID_PARAMETER:
4429 return MFW_BT_INVALID_PARA;
4430 case BTP_NOT_SUPP:
4431 return MFW_BT_NO_SUPP;
4432 case BTP_NOT_READY:
4433 return MFW_BT_NOT_READY;
4434 case BTP_INT_ERR:
4435 return MFW_BT_INT_ERR;
4436 case BTP_MEMORY_ERR:
4437 return MFW_BT_MEM_ERR;
4438 case BTP_NOK:
4439 return MFW_BT_NOK;
4440 }
4441 }
4442 else
4443 return MFW_BT_FAIL;
4444 }
4445 else
4446 return MFW_BT_FAIL;
4447 }
4448
4449 /*
4450 +----------------------------------------------------------------------+
4451 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4452 | STATE : code ROUTINE : bt_syn_s_push_resp |
4453 +----------------------------------------------------------------------+
4454
4455 PURPOSE : SYNC server sends push request response
4456
4457 */
4458 T_MFW_BT_RESULT_BT bt_syn_s_push_resp (T_MFW_BT_SERVICE_TYPE service,
4459 T_MFW_BT_SUBTYPE_DEV subtype,
4460 T_MFW_BT_SYNC_OBJECT mfw_syn_push_obj)
4461 {
4462 T_BTI_SYNC_OBJECT syn_push_object;
4463
4464 TRACE_FUNCTION ("bt_syn_s_push_resp()");
4465
4466 memset(&syn_push_object,0,sizeof(syn_push_object));
4467
4468 if(service EQ MFW_BT_SYNC)
4469 {
4470 if(subtype EQ MFW_BT_SERVER)
4471 {
4472 switch(mfw_syn_push_obj.mfw_object_type)
4473 {
4474 case MFW_BT_BUFFER:/* object to be pulled will be supposed to be stored in buffer */
4475 syn_push_object.bt_object_type = BTI_TYPE_BUFFER;
4476 syn_push_object.bt_buffer_start = mfw_syn_push_obj.mfw_buffer_start;
4477 syn_push_object.bt_buffer_size = mfw_syn_push_obj.mfw_buffer_size;
4478 break;
4479 case MFW_BT_PATH:/* object to be pulled will be supposed to be stored in file system */
4480 syn_push_object.bt_object_type = BTI_TYPE_PATH;
4481 syn_push_object.bt_path = mfw_syn_push_obj.mfw_path;
4482 break;
4483 default:
4484 return MFW_BT_FAIL;
4485 }
4486 /* MIME type of object to be pulled */
4487 syn_push_object.bt_object_mime_type = mfw_syn_push_obj.mfw_object_mime_type;
4488 /* name of object to be pulled */
4489 syn_push_object.bt_object_length = mfw_syn_push_obj.mfw_object_length;
4490 /* length of object to be pulled */
4491 syn_push_object.bt_object_name = mfw_syn_push_obj.mfw_object_name;
4492
4493 switch(btibtp_sync_ser_push_res(syn_push_object))
4494 {
4495 case BTP_OK:
4496 return MFW_BT_EXECUTE;
4497 case BTP_INVALID_PARAMETER:
4498 return MFW_BT_INVALID_PARA;
4499 case BTP_NOT_SUPP:
4500 return MFW_BT_NO_SUPP;
4501 case BTP_NOT_READY:
4502 return MFW_BT_NOT_READY;
4503 case BTP_INT_ERR:
4504 return MFW_BT_INT_ERR;
4505 case BTP_MEMORY_ERR:
4506 return MFW_BT_MEM_ERR;
4507 case BTP_NOK:
4508 return MFW_BT_NOK;
4509 }
4510 }
4511 else
4512 return MFW_BT_FAIL;
4513 }
4514 else
4515 return MFW_BT_FAIL;
4516 }
4517
4518 /* BT CTRL */
4519
4520 /*
4521 +----------------------------------------------------------------------+
4522 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4523 | STATE : code ROUTINE : |
4524 +----------------------------------------------------------------------+
4525
4526 PURPOSE :
4527 */
4528 T_MFW_BT_RESULT_BT bt_set_conn_mode(T_MFW_BT_CONNECTABLE_MODE cmode,
4529 UINT16 scan_interval,
4530 UINT16 scan_window)
4531 {
4532 TRACE_FUNCTION ("bt_set_conn_mode()");
4533
4534 switch(btibtp_set_conn_mode(cmode, scan_interval, scan_window))
4535 {
4536 case BTP_OK:
4537 return MFW_BT_OK;
4538 case BTP_INVALID_PARAMETER:
4539 return MFW_BT_INVALID_PARA;
4540 case BTP_NOT_SUPP:
4541 return MFW_BT_NO_SUPP;
4542 case BTP_NOT_READY:
4543 return MFW_BT_NOT_READY;
4544 case BTP_INT_ERR:
4545 return MFW_BT_INT_ERR;
4546 case BTP_MEMORY_ERR:
4547 return MFW_BT_MEM_ERR;
4548 case BTP_NOK:
4549 return MFW_BT_NOK;
4550 }
4551
4552 }
4553
4554
4555 /*
4556 +----------------------------------------------------------------------+
4557 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4558 | STATE : code ROUTINE : |
4559 +----------------------------------------------------------------------+
4560
4561 PURPOSE :
4562 */
4563 T_MFW_BT_RESULT_BT bt_set_disc_mode(T_MFW_BT_DISCOVERABLE_MODE dmode,
4564 UINT16 scan_interval,
4565 UINT16 scan_window)
4566 {
4567 TRACE_FUNCTION ("bt_set_disc_mode()");
4568
4569 switch(btibtp_set_disc_mode(dmode, scan_interval, scan_window))
4570 {
4571 case BTP_OK:
4572 return MFW_BT_OK;
4573 case BTP_INVALID_PARAMETER:
4574 return MFW_BT_INVALID_PARA;
4575 case BTP_NOT_SUPP:
4576 return MFW_BT_NO_SUPP;
4577 case BTP_NOT_READY:
4578 return MFW_BT_NOT_READY;
4579 case BTP_INT_ERR:
4580 return MFW_BT_INT_ERR;
4581 case BTP_MEMORY_ERR:
4582 return MFW_BT_MEM_ERR;
4583 case BTP_NOK:
4584 return MFW_BT_NOK;
4585 }
4586 }
4587
4588 /*
4589 +----------------------------------------------------------------------+
4590 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4591 | STATE : code ROUTINE : |
4592 +----------------------------------------------------------------------+
4593
4594 PURPOSE :
4595 */
4596 T_MFW_BT_RESULT_BT bt_get_local_name(void)
4597 {
4598 TRACE_FUNCTION ("bt_get_local_name()");
4599
4600 switch(btibtp_get_local_name())
4601 {
4602 case BTP_OK:
4603 return MFW_BT_OK;
4604 case BTP_INVALID_PARAMETER:
4605 return MFW_BT_INVALID_PARA;
4606 case BTP_NOT_SUPP:
4607 return MFW_BT_NO_SUPP;
4608 case BTP_NOT_READY:
4609 return MFW_BT_NOT_READY;
4610 case BTP_INT_ERR:
4611 return MFW_BT_INT_ERR;
4612 case BTP_MEMORY_ERR:
4613 return MFW_BT_MEM_ERR;
4614 case BTP_NOK:
4615 return MFW_BT_NOK;
4616 }
4617 }
4618
4619 /*
4620 +----------------------------------------------------------------------+
4621 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4622 | STATE : code ROUTINE : |
4623 +----------------------------------------------------------------------+
4624
4625 PURPOSE :
4626 */
4627 T_MFW_BT_RESULT_BT bt_set_local_name(T_MFW_BT_BD_NAME name[])
4628 {
4629 TRACE_FUNCTION ("bt_set_local_name()");
4630
4631 switch(btibtp_set_local_name(name))
4632 {
4633 case BTP_OK:
4634 return MFW_BT_OK;
4635 case BTP_INVALID_PARAMETER:
4636 return MFW_BT_INVALID_PARA;
4637 case BTP_NOT_SUPP:
4638 return MFW_BT_NO_SUPP;
4639 case BTP_NOT_READY:
4640 return MFW_BT_NOT_READY;
4641 case BTP_INT_ERR:
4642 return MFW_BT_INT_ERR;
4643 case BTP_MEMORY_ERR:
4644 return MFW_BT_MEM_ERR;
4645 case BTP_NOK:
4646 return MFW_BT_NOK;
4647 }
4648 }
4649
4650 /*
4651 +----------------------------------------------------------------------+
4652 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4653 | STATE : code ROUTINE : |
4654 +----------------------------------------------------------------------+
4655
4656 PURPOSE :
4657 */
4658 T_MFW_BT_RESULT_BT bt_get_bd_addr(void)
4659 {
4660 TRACE_FUNCTION ("bt_get_bd_addr()");
4661
4662 switch(btibtp_get_bd_addr())
4663 {
4664 case BTP_OK:
4665 return MFW_BT_OK;
4666 case BTP_INVALID_PARAMETER:
4667 return MFW_BT_INVALID_PARA;
4668 case BTP_NOT_SUPP:
4669 return MFW_BT_NO_SUPP;
4670 case BTP_NOT_READY:
4671 return MFW_BT_NOT_READY;
4672 case BTP_INT_ERR:
4673 return MFW_BT_INT_ERR;
4674 case BTP_MEMORY_ERR:
4675 return MFW_BT_MEM_ERR;
4676 case BTP_NOK:
4677 return MFW_BT_NOK;
4678 }
4679 }
4680
4681 /*
4682 +----------------------------------------------------------------------+
4683 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4684 | STATE : code ROUTINE : |
4685 +----------------------------------------------------------------------+
4686
4687 PURPOSE :
4688 */
4689 T_MFW_BT_RESULT_BT bt_get_remote_dev_info(T_MFW_BT_BD_ADDR bd_addr[])
4690 {
4691 TRACE_FUNCTION ("bt_get_remote_dev_info()");
4692
4693 switch(btibtp_get_remote_dev_info(bd_addr))
4694 {
4695 case BTP_OK:
4696 return MFW_BT_OK;
4697 case BTP_INVALID_PARAMETER:
4698 return MFW_BT_INVALID_PARA;
4699 case BTP_NOT_SUPP:
4700 return MFW_BT_NO_SUPP;
4701 case BTP_NOT_READY:
4702 return MFW_BT_NOT_READY;
4703 case BTP_INT_ERR:
4704 return MFW_BT_INT_ERR;
4705 case BTP_MEMORY_ERR:
4706 return MFW_BT_MEM_ERR;
4707 case BTP_NOK:
4708 return MFW_BT_NOK;
4709 }
4710 }
4711
4712 /*
4713 +----------------------------------------------------------------------+
4714 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4715 | STATE : code ROUTINE : |
4716 +----------------------------------------------------------------------+
4717
4718 PURPOSE :
4719 */
4720 T_MFW_BT_RESULT_BT bt_start_btctrl(void)
4721 {
4722 TRACE_FUNCTION ("bt_start_btctrl()");
4723
4724 switch(btibtp_start_btctrl())
4725 {
4726 case BTP_OK:
4727 return MFW_BT_OK;
4728 case BTP_INVALID_PARAMETER:
4729 return MFW_BT_INVALID_PARA;
4730 case BTP_NOT_SUPP:
4731 return MFW_BT_NO_SUPP;
4732 case BTP_NOT_READY:
4733 return MFW_BT_NOT_READY;
4734 case BTP_INT_ERR:
4735 return MFW_BT_INT_ERR;
4736 case BTP_MEMORY_ERR:
4737 return MFW_BT_MEM_ERR;
4738 case BTP_NOK:
4739 return MFW_BT_NOK;
4740 }
4741 }
4742
4743 /*
4744 +----------------------------------------------------------------------+
4745 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4746 | STATE : code ROUTINE : |
4747 +----------------------------------------------------------------------+
4748
4749 PURPOSE :
4750 */
4751 T_MFW_BT_RESULT_BT bt_stop_btctrl(void)
4752 {
4753 TRACE_FUNCTION ("bt_stop_btctrl()");
4754
4755 switch(btibtp_stop_btctrl())
4756 {
4757 case BTP_OK:
4758 return MFW_BT_OK;
4759 case BTP_INVALID_PARAMETER:
4760 return MFW_BT_INVALID_PARA;
4761 case BTP_NOT_SUPP:
4762 return MFW_BT_NO_SUPP;
4763 case BTP_NOT_READY:
4764 return MFW_BT_NOT_READY;
4765 case BTP_INT_ERR:
4766 return MFW_BT_INT_ERR;
4767 case BTP_MEMORY_ERR:
4768 return MFW_BT_MEM_ERR;
4769 case BTP_NOK:
4770 return MFW_BT_NOK;
4771 }
4772 }
4773
4774 /* enable profiles */
4775 /*
4776 +----------------------------------------------------------------------+
4777 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4778 | STATE : code ROUTINE : |
4779 +----------------------------------------------------------------------+
4780
4781 PURPOSE :
4782 */
4783 T_MFW_BT_RESULT_BT bt_enable_hsg_profile(void)
4784 {
4785 TRACE_FUNCTION ("bt_enable_hsg_profile()");
4786 switch(btibtp_enable_hsg_profile())
4787 {
4788 case BTP_OK:
4789 return MFW_BT_OK;
4790 case BTP_INVALID_PARAMETER:
4791 return MFW_BT_INVALID_PARA;
4792 case BTP_NOT_SUPP:
4793 return MFW_BT_NO_SUPP;
4794 case BTP_NOT_READY:
4795 return MFW_BT_NOT_READY;
4796 case BTP_INT_ERR:
4797 return MFW_BT_INT_ERR;
4798 case BTP_MEMORY_ERR:
4799 return MFW_BT_MEM_ERR;
4800 case BTP_NOK:
4801 return MFW_BT_NOK;
4802 }
4803 }
4804
4805 /*
4806 +----------------------------------------------------------------------+
4807 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4808 | STATE : code ROUTINE : |
4809 +----------------------------------------------------------------------+
4810
4811 PURPOSE :
4812 */
4813 T_MFW_BT_RESULT_BT bt_enable_dun_profile(void)
4814 {
4815 TRACE_FUNCTION ("bt_enable_dun_profile()");
4816 switch(btibtp_enable_dun_profile())
4817 {
4818 case BTP_OK:
4819 return MFW_BT_OK;
4820 case BTP_INVALID_PARAMETER:
4821 return MFW_BT_INVALID_PARA;
4822 case BTP_NOT_SUPP:
4823 return MFW_BT_NO_SUPP;
4824 case BTP_NOT_READY:
4825 return MFW_BT_NOT_READY;
4826 case BTP_INT_ERR:
4827 return MFW_BT_INT_ERR;
4828 case BTP_MEMORY_ERR:
4829 return MFW_BT_MEM_ERR;
4830 case BTP_NOK:
4831 return MFW_BT_NOK;
4832 }
4833 }
4834
4835 /*
4836 +----------------------------------------------------------------------+
4837 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4838 | STATE : code ROUTINE : |
4839 +----------------------------------------------------------------------+
4840
4841 PURPOSE :
4842 */
4843 T_MFW_BT_RESULT_BT bt_enable_fax_profile(void)
4844 {
4845 TRACE_FUNCTION ("bt_enable_fax_profile()");
4846 switch(btibtp_enable_fax_profile())
4847 {
4848 case BTP_OK:
4849 return MFW_BT_OK;
4850 case BTP_INVALID_PARAMETER:
4851 return MFW_BT_INVALID_PARA;
4852 case BTP_NOT_SUPP:
4853 return MFW_BT_NO_SUPP;
4854 case BTP_NOT_READY:
4855 return MFW_BT_NOT_READY;
4856 case BTP_INT_ERR:
4857 return MFW_BT_INT_ERR;
4858 case BTP_MEMORY_ERR:
4859 return MFW_BT_MEM_ERR;
4860 case BTP_NOK:
4861 return MFW_BT_NOK;
4862 }
4863 }
4864
4865 /*
4866 +----------------------------------------------------------------------+
4867 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4868 | STATE : code ROUTINE : |
4869 +----------------------------------------------------------------------+
4870
4871 PURPOSE :
4872 */
4873 T_MFW_BT_RESULT_BT bt_hsg_client_disable(void)
4874 {
4875 TRACE_FUNCTION ("bt_hsg_client_disable()");
4876 switch(btibtp_hsg_client_disable())
4877 {
4878 case BTP_OK:
4879 return MFW_BT_OK;
4880 case BTP_INVALID_PARAMETER:
4881 return MFW_BT_INVALID_PARA;
4882 case BTP_NOT_SUPP:
4883 return MFW_BT_NO_SUPP;
4884 case BTP_NOT_READY:
4885 return MFW_BT_NOT_READY;
4886 case BTP_INT_ERR:
4887 return MFW_BT_INT_ERR;
4888 case BTP_MEMORY_ERR:
4889 return MFW_BT_MEM_ERR;
4890 case BTP_NOK:
4891 return MFW_BT_NOK;
4892 }
4893 }
4894
4895 /*
4896 +----------------------------------------------------------------------+
4897 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4898 | STATE : code ROUTINE : |
4899 +----------------------------------------------------------------------+
4900
4901 PURPOSE :
4902 */
4903 T_MFW_BT_RESULT_BT bt_hsg_server_disable(void)
4904 {
4905 TRACE_FUNCTION ("bt_hsg_server_disable()");
4906 switch(btibtp_hsg_server_disable())
4907 {
4908 case BTP_OK:
4909 return MFW_BT_OK;
4910 case BTP_INVALID_PARAMETER:
4911 return MFW_BT_INVALID_PARA;
4912 case BTP_NOT_SUPP:
4913 return MFW_BT_NO_SUPP;
4914 case BTP_NOT_READY:
4915 return MFW_BT_NOT_READY;
4916 case BTP_INT_ERR:
4917 return MFW_BT_INT_ERR;
4918 case BTP_MEMORY_ERR:
4919 return MFW_BT_MEM_ERR;
4920 case BTP_NOK:
4921 return MFW_BT_NOK;
4922 }
4923 }
4924
4925 /*
4926 +----------------------------------------------------------------------+
4927 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4928 | STATE : code ROUTINE : |
4929 +----------------------------------------------------------------------+
4930
4931 PURPOSE :
4932 */
4933 T_MFW_BT_RESULT_BT bt_dun_gw_disable(void)
4934 {
4935 TRACE_FUNCTION ("bt_dun_gw_disable()");
4936 switch(btibtp_dun_gw_disable())
4937 {
4938 case BTP_OK:
4939 return MFW_BT_OK;
4940 case BTP_INVALID_PARAMETER:
4941 return MFW_BT_INVALID_PARA;
4942 case BTP_NOT_SUPP:
4943 return MFW_BT_NO_SUPP;
4944 case BTP_NOT_READY:
4945 return MFW_BT_NOT_READY;
4946 case BTP_INT_ERR:
4947 return MFW_BT_INT_ERR;
4948 case BTP_MEMORY_ERR:
4949 return MFW_BT_MEM_ERR;
4950 case BTP_NOK:
4951 return MFW_BT_NOK;
4952 }
4953 }
4954
4955 /*
4956 +----------------------------------------------------------------------+
4957 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4958 | STATE : code ROUTINE : |
4959 +----------------------------------------------------------------------+
4960
4961 PURPOSE :
4962 */
4963 T_MFW_BT_RESULT_BT bt_fax_gw_disable(void)
4964 {
4965 TRACE_FUNCTION ("bt_fax_gw_disable()");
4966 switch(btibtp_fax_gw_disable())
4967 {
4968 case BTP_OK:
4969 return MFW_BT_OK;
4970 case BTP_INVALID_PARAMETER:
4971 return MFW_BT_INVALID_PARA;
4972 case BTP_NOT_SUPP:
4973 return MFW_BT_NO_SUPP;
4974 case BTP_NOT_READY:
4975 return MFW_BT_NOT_READY;
4976 case BTP_INT_ERR:
4977 return MFW_BT_INT_ERR;
4978 case BTP_MEMORY_ERR:
4979 return MFW_BT_MEM_ERR;
4980 case BTP_NOK:
4981 return MFW_BT_NOK;
4982 }
4983 }
4984
4985 /*
4986 +----------------------------------------------------------------------+
4987 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
4988 | STATE : code ROUTINE : |
4989 +----------------------------------------------------------------------+
4990
4991 PURPOSE :
4992 */
4993 T_MFW_BT_RESULT_BT bt_opp_client_disable(void)
4994 {
4995 TRACE_FUNCTION ("bt_opp_client_disable()");
4996 switch(btibtp_opp_client_disable())
4997 {
4998 case BTP_OK:
4999 return MFW_BT_OK;
5000 case BTP_INVALID_PARAMETER:
5001 return MFW_BT_INVALID_PARA;
5002 case BTP_NOT_SUPP:
5003 return MFW_BT_NO_SUPP;
5004 case BTP_NOT_READY:
5005 return MFW_BT_NOT_READY;
5006 case BTP_INT_ERR:
5007 return MFW_BT_INT_ERR;
5008 case BTP_MEMORY_ERR:
5009 return MFW_BT_MEM_ERR;
5010 case BTP_NOK:
5011 return MFW_BT_NOK;
5012 }
5013 }
5014
5015 /*
5016 +----------------------------------------------------------------------+
5017 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
5018 | STATE : code ROUTINE : |
5019 +----------------------------------------------------------------------+
5020
5021 PURPOSE :
5022 */
5023 T_MFW_BT_RESULT_BT bt_opp_server_disable(void)
5024 {
5025 TRACE_FUNCTION ("bt_opp_server_disable()");
5026 switch(btibtp_opp_server_disable())
5027 {
5028 case BTP_OK:
5029 return MFW_BT_OK;
5030 case BTP_INVALID_PARAMETER:
5031 return MFW_BT_INVALID_PARA;
5032 case BTP_NOT_SUPP:
5033 return MFW_BT_NO_SUPP;
5034 case BTP_NOT_READY:
5035 return MFW_BT_NOT_READY;
5036 case BTP_INT_ERR:
5037 return MFW_BT_INT_ERR;
5038 case BTP_MEMORY_ERR:
5039 return MFW_BT_MEM_ERR;
5040 case BTP_NOK:
5041 return MFW_BT_NOK;
5042 }
5043 }
5044
5045 /*
5046 +----------------------------------------------------------------------+
5047 | PROJECT : MMI-Framework (8445) MODULE : MFW_BT |
5048 | STATE : code ROUTINE : |
5049 +----------------------------------------------------------------------+
5050
5051 PURPOSE :
5052 */
5053 T_MFW_BT_RESULT_BT bt_syn_server_disable(void)
5054 {
5055 TRACE_FUNCTION ("bt_syn_server_disable()");
5056 switch(btibtp_syn_server_disable())
5057 {
5058 case BTP_OK:
5059 return MFW_BT_OK;
5060 case BTP_INVALID_PARAMETER:
5061 return MFW_BT_INVALID_PARA;
5062 case BTP_NOT_SUPP:
5063 return MFW_BT_NO_SUPP;
5064 case BTP_NOT_READY:
5065 return MFW_BT_NOT_READY;
5066 case BTP_INT_ERR:
5067 return MFW_BT_INT_ERR;
5068 case BTP_MEMORY_ERR:
5069 return MFW_BT_MEM_ERR;
5070 case BTP_NOK:
5071 return MFW_BT_NOK;
5072 }
5073 }
5074
5075 /*#ifdef PCA_6350*/
5076 T_MFW_BT_RESULT_BT bt_pca_gw_enable (void)
5077 {
5078 TRACE_FUNCTION ("bt_pca_gw_enable()");
5079 switch(btibtp_pca_gw_enable())
5080 {
5081 case BTP_OK:
5082 return MFW_BT_OK;
5083 case BTP_INVALID_PARAMETER:
5084 return MFW_BT_INVALID_PARA;
5085 case BTP_NOT_SUPP:
5086 return MFW_BT_NO_SUPP;
5087 case BTP_NOT_READY:
5088 return MFW_BT_NOT_READY;
5089 case BTP_INT_ERR:
5090 return MFW_BT_INT_ERR;
5091 case BTP_MEMORY_ERR:
5092 return MFW_BT_MEM_ERR;
5093 case BTP_NOK:
5094 return MFW_BT_NOK;
5095 }
5096 }
5097
5098 T_MFW_BT_RESULT_BT bt_pca_gw_config (T_MFW_BT_PCA_CONFIG event_filters)
5099 {
5100 T_BTI_PCA_CONF events;
5101 TRACE_FUNCTION ("bt_pca_gw_config()");
5102
5103 events.link_filter = (T_BTI_PCA_LINK_EVENT)event_filters.link_event;
5104 events.call_filter = (T_BTI_PCA_CALL_EVENT)event_filters.call_event;
5105
5106 switch(btibtp_pca_gw_config (events))
5107 {
5108 case BTP_OK:
5109 return MFW_BT_OK;
5110 case BTP_INVALID_PARAMETER:
5111 return MFW_BT_INVALID_PARA;
5112 case BTP_NOT_SUPP:
5113 return MFW_BT_NO_SUPP;
5114 case BTP_NOT_READY:
5115 return MFW_BT_NOT_READY;
5116 case BTP_INT_ERR:
5117 return MFW_BT_INT_ERR;
5118 case BTP_MEMORY_ERR:
5119 return MFW_BT_MEM_ERR;
5120 case BTP_NOK:
5121 return MFW_BT_NOK;
5122 }
5123 }
5124
5125 T_MFW_BT_RESULT_BT bt_pca_gw_security (UINT8 security_level)
5126 {
5127 TRACE_FUNCTION ("bt_pca_gw_security()");
5128 switch(btibtp_pca_gw_security (security_level))
5129 {
5130 case BTP_OK:
5131 return MFW_BT_OK;
5132 case BTP_INVALID_PARAMETER:
5133 return MFW_BT_INVALID_PARA;
5134 case BTP_NOT_SUPP:
5135 return MFW_BT_NO_SUPP;
5136 case BTP_NOT_READY:
5137 return MFW_BT_NOT_READY;
5138 case BTP_INT_ERR:
5139 return MFW_BT_INT_ERR;
5140 case BTP_MEMORY_ERR:
5141 return MFW_BT_MEM_ERR;
5142 case BTP_NOK:
5143 return MFW_BT_NOK;
5144 }
5145 }
5146
5147 T_MFW_BT_RESULT_BT bt_pca_gw_hangup (void)
5148 {
5149 TRACE_FUNCTION ("bt_pca_gw_hangup()");
5150 switch(btibtp_pca_gw_hangup())
5151 {
5152 case BTP_OK:
5153 return MFW_BT_OK;
5154 case BTP_INVALID_PARAMETER:
5155 return MFW_BT_INVALID_PARA;
5156 case BTP_NOT_SUPP:
5157 return MFW_BT_NO_SUPP;
5158 case BTP_NOT_READY:
5159 return MFW_BT_NOT_READY;
5160 case BTP_INT_ERR:
5161 return MFW_BT_INT_ERR;
5162 case BTP_MEMORY_ERR:
5163 return MFW_BT_MEM_ERR;
5164 case BTP_NOK:
5165 return MFW_BT_NOK;
5166 }
5167 }
5168
5169 T_MFW_BT_RESULT_BT bt_pca_gw_disable (void)
5170 {
5171 TRACE_FUNCTION ("bt_pca_gw_disable()");
5172 switch(btibtp_pca_gw_disable())
5173 {
5174 case BTP_OK:
5175 return MFW_BT_OK;
5176 case BTP_INVALID_PARAMETER:
5177 return MFW_BT_INVALID_PARA;
5178 case BTP_NOT_SUPP:
5179 return MFW_BT_NO_SUPP;
5180 case BTP_NOT_READY:
5181 return MFW_BT_NOT_READY;
5182 case BTP_INT_ERR:
5183 return MFW_BT_INT_ERR;
5184 case BTP_MEMORY_ERR:
5185 return MFW_BT_MEM_ERR;
5186 case BTP_NOK:
5187 return MFW_BT_NOK;
5188 }
5189 }
5190
5191
5192 /*#endif*/ /* PCA_6350 */
5193
5194
5195 /* Cartman added begin */
5196
5197 T_MFW_BT_RESULT_BT bt_hsg_connect_network (T_MFW_BT_HSG_CONNECT_NETWORK_ANSWER network_answer,
5198 T_MFW_BT_HSG_CONNECT_NETWORK_TYPE network_type,
5199 T_MFW_BT_HSG_PHONE_NUMBER phone_nb[])
5200 {
5201 TRACE_FUNCTION ("bt_hsg_connect_network()");
5202 switch(btibtp_hsg_connect_network(network_answer,network_type,phone_nb))
5203 {
5204 case BTP_OK:
5205 return MFW_BT_EXECUTE;
5206 case BTP_INVALID_PARAMETER:
5207 return MFW_BT_INVALID_PARA;
5208 case BTP_NOT_SUPP:
5209 return MFW_BT_NO_SUPP;
5210 case BTP_NOT_READY:
5211 return MFW_BT_NOT_READY;
5212 case BTP_INT_ERR:
5213 return MFW_BT_INT_ERR;
5214 case BTP_MEMORY_ERR:
5215 return MFW_BT_MEM_ERR;
5216 case BTP_NOK:
5217 return MFW_BT_NOK;
5218 }
5219 }
5220
5221
5222 T_MFW_BT_RESULT_BT bt_hsg_send_specific_cmd_to_hs (T_MFW_BT_HSG_SPECIFIC_CMD_TYPE command_type,
5223 T_MFW_BT_HSG_CMD_TO_HS cmd[])
5224 {
5225 TRACE_FUNCTION ("bt_hsg_send_specific_cmd_to_hs()");
5226 switch(btibtp_hsg_send_specific_cmd_to_hs(command_type,cmd))
5227 {
5228 case BTP_OK:
5229 return MFW_BT_EXECUTE;
5230 case BTP_INVALID_PARAMETER:
5231 return MFW_BT_INVALID_PARA;
5232 case BTP_NOT_SUPP:
5233 return MFW_BT_NO_SUPP;
5234 case BTP_NOT_READY:
5235 return MFW_BT_NOT_READY;
5236 case BTP_INT_ERR:
5237 return MFW_BT_INT_ERR;
5238 case BTP_MEMORY_ERR:
5239 return MFW_BT_MEM_ERR;
5240 case BTP_NOK:
5241 return MFW_BT_NOK;
5242 }
5243 }
5244
5245
5246 T_MFW_BT_RESULT_BT bt_dun_gw_security (UINT8 security_level)
5247 {
5248 TRACE_FUNCTION ("bt_dun_gw_security()");
5249 switch(btibtp_dun_gw_security (security_level))
5250 {
5251 case BTP_OK:
5252 return MFW_BT_OK;
5253 case BTP_INVALID_PARAMETER:
5254 return MFW_BT_INVALID_PARA;
5255 case BTP_NOT_SUPP:
5256 return MFW_BT_NO_SUPP;
5257 case BTP_NOT_READY:
5258 return MFW_BT_NOT_READY;
5259 case BTP_INT_ERR:
5260 return MFW_BT_INT_ERR;
5261 case BTP_MEMORY_ERR:
5262 return MFW_BT_MEM_ERR;
5263 case BTP_NOK:
5264 return MFW_BT_NOK;
5265 }
5266 }
5267
5268
5269 T_MFW_BT_RESULT_BT bt_opp_client_security (UINT8 security_level)
5270 {
5271 TRACE_FUNCTION ("bt_opp_client_security()");
5272 switch(btibtp_opp_client_security (security_level))
5273 {
5274 case BTP_OK:
5275 return MFW_BT_OK;
5276 case BTP_INVALID_PARAMETER:
5277 return MFW_BT_INVALID_PARA;
5278 case BTP_NOT_SUPP:
5279 return MFW_BT_NO_SUPP;
5280 case BTP_NOT_READY:
5281 return MFW_BT_NOT_READY;
5282 case BTP_INT_ERR:
5283 return MFW_BT_INT_ERR;
5284 case BTP_MEMORY_ERR:
5285 return MFW_BT_MEM_ERR;
5286 case BTP_NOK:
5287 return MFW_BT_NOK;
5288 }
5289 }
5290
5291
5292 T_MFW_BT_RESULT_BT bt_opp_server_security (UINT8 security_level)
5293 {
5294 TRACE_FUNCTION ("bt_opp_server_security()");
5295 switch(btibtp_opp_server_security (security_level))
5296 {
5297 case BTP_OK:
5298 return MFW_BT_OK;
5299 case BTP_INVALID_PARAMETER:
5300 return MFW_BT_INVALID_PARA;
5301 case BTP_NOT_SUPP:
5302 return MFW_BT_NO_SUPP;
5303 case BTP_NOT_READY:
5304 return MFW_BT_NOT_READY;
5305 case BTP_INT_ERR:
5306 return MFW_BT_INT_ERR;
5307 case BTP_MEMORY_ERR:
5308 return MFW_BT_MEM_ERR;
5309 case BTP_NOK:
5310 return MFW_BT_NOK;
5311 }
5312 }
5313
5314
5315 /* Cartman added end */