comparison g23m/condat/ms/src/mfw/mfw_bta.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 (8417) $Workfile:: mfw_bta.c $|
4 | $Author:: Rm $Revision:: 1 $|
5 | CREATED: 04.01.01 $Modtime:: 4.01.01 15:14 $|
6 | STATE : code |
7 +--------------------------------------------------------------------+
8
9 MODULE : MFW_BTA
10
11 PURPOSE : This modul contains the additional functions for BT management.
12
13 */
14 #define ENTITY_MFW
15
16 #include "mfw_sys.h"
17
18 #include "typedefs.h"
19 #include "vsi.h"
20 #include "custom.h"
21 #include "gsm.h"
22
23 #include "prim.h"
24 #include "p_btp.h"
25
26 #include "Bti.h"
27 #include "bti_btp.h"
28 #include "mfw_mfw.h"
29 #include "mfw_acie.h"
30 #include "mfw_bt.h"
31 #include "mfw_bta.h"
32
33 #include <string.h>
34
35 /* TI BT header */
36 #ifdef BT_INTERFACE
37 #include "rv_general.h"
38 #include "hsg_general.h"
39 #include "hsg_messages.h"
40 #include "rvm_api.h"
41 #include "bmi_api.h"
42
43 /*#ifdef PCA_6350*/
44 #include "pca_gw_mmi.h"
45 /*#endif*/
46 #endif /* BT_INTERFACE */
47
48 #ifdef _SIMULATION_
49 #include "bti_win.h"
50 #endif
51
52 /* global used structures */
53 T_MFW_BT_SERVICE_LST found_headset; /* list with found devices (headset) */
54 T_MFW_BT_DEVICE_LST service_list; /* list with service id's related to a bd_addr */
55 T_MFW_BT_SERVICE_LST found_dial_up; /* list with found services (dial_up) */
56 T_MFW_BT_SERVICE_LST found_fax; /* list with found services (fax) */
57 T_MFW_BT_SERVICE_LST found_opp; /* list with found services (OPP) */
58 T_MFW_BT_SERVICE_LST found_sync; /* list with found services (SYNC) */
59 T_MFW_BT_SERVICE_LST found_sync_cmd; /* list with found services (SYNC_CMD) */
60 T_MFW_BT_AUTHORIZATION_LIST authorized_devices_list; /* list of authorized devices */
61
62 char receiv_object_name[MFW_BT_OPP_OBJECT_NAME_MAX_LEN];/* static buffer for object name: limited with 256 characters */
63 char receiv_object_mime_type[MFW_BT_OPP_OBJECT_MIME_MAX_LEN];/* static buffer for MIME type of object: limited with 256 characters */
64 char receiv_sync_object_mime_type[MFW_BT_OPP_OBJECT_MIME_MAX_LEN];/* static buffer for MIME type of object: limited with 256 characters */
65 char sync_object_name[MFW_BT_OPP_OBJECT_NAME_MAX_LEN];/* static buffer for object name: limited with 256 characters */
66 char sync_object_location_id[MFW_BT_SYNC_OBJECT_IDENTIFIER];/* static buffer for sync object path on server: limited with 256 characters */
67
68 #ifdef _SIMULATION_
69 #define MFW_BT_OPP_BUFFER_LENGTH 10
70 static unsigned char server_syn_object[MFW_BT_OPP_BUFFER_LENGTH];
71 static char mfw_test_syn_obj[] = {'v', 'C', 'a', 'l', '\0'};
72 static char mfw_test_opp_obj_name[] = {'v', 'C', 'a', 'r', 'd', '\0'};
73 static char hsg_default_name [] ={'H', 'S', 'G', '1', '\0'};
74 static char client_obj_name [] ={'C', 'l', 'i', 'e', 'n', 't', '\0'};
75 static unsigned char server_business_card[MFW_BT_OPP_BUFFER_LENGTH];/* temporary field for the pulled server card */
76 static char server_default_name [] ={'S', 'e', 'r', 'v', 'e', 'r', '\0'};
77 static unsigned char server_buffer[MFW_BT_OPP_BUFFER_LENGTH];/* temporary field for received client objects at the server */
78 static unsigned char client_buffer[MFW_BT_OPP_BUFFER_LENGTH];/* temporary field for pushed client objects */
79 static unsigned char client_business_card[MFW_BT_OPP_BUFFER_LENGTH];/* temporary field for his own client card */
80 #endif
81 /*
82 +--------------------------------------------------------------------+
83 | PROJECT: MMI-Framework (8445) MODULE: MFW_BTA |
84 | STATE : code ROUTINE: bta_response_cb |
85 +--------------------------------------------------------------------+
86
87 PURPOSE : Response Callback Handler (receive bt primitive directly)
88 Note that the input paramter opc will be casted to USHORT
89 as Bluetooth is currently still using 16bit opcodes.
90
91 */
92 GLOBAL BOOL bta_response_cb (ULONG opc, void * data)
93 {
94 T_MFW_BT_PROFILE_CREATE_CNF *profile_create_cnf;
95 T_MFW_BT_PROFILE_DELETE_CNF *profile_delete_cnf;
96 T_MFW_BT_SERVICE_LST *id_ptr;
97 T_MFW_BT_DEVICE_LST *idd_ptr;
98 T_MFW_BT_SERVICE_ID *service_id;
99 T_MFW_BT_DEVICE_ID *dev_id;
100 T_MFW_BT_SERVICE_ID *help_id;
101 T_MFW_BT_DEVICE_ID *help_serv_id;
102 T_MFW_BT_PROFILE_CNF *profile_cnf_data;
103 T_MFW_BT_PIN_IND *pin_indication;
104 T_MFW_BT_DEV_PAIR_IND *pair_indication;
105 T_MFW_BT_DEVICE_IND *device_indication;
106 T_MFW_BT_SERVICE_IND *service_indication;
107 T_MFW_BT_REST_CONFIG *restore_configuration;
108 T_MFW_BT_DISCON_DUN_FAX_IND *disc_dun_fax_ind;
109 T_MFW_BT_CALL_STATUS_DUN_FAX *dun_call_state;
110 T_MFW_BT_AUTHORIZATION_IND *authorization_ind;
111 T_MFW_BT_OPP_PUT_CNF *opp_put_cnf;
112 T_MFW_BT_OPP_PUSH_CNF *opp_obj_push_cnf;
113 T_MFW_BT_OPP_PULL_CNF *opp_obj_pull_cnf;
114 T_MFW_BT_SERVICE_SEARCH_CNF *search_conf;
115 T_MFW_BT_DEVICE_SEARCH_CNF *dev_search_conf;
116 T_MFW_BT_CONNECT_IND *connect_ind;
117 T_MFW_BT_CONNECT_INF *connect_inf;
118 T_MFW_BT_CONNECT_CNF *connect_cnf;
119 T_MFW_BT_DISCONNECT_CNF *disconnect_cnf;
120 T_MFW_BT_DISCON_DUN_FAX_CNF *discon_dun_fax_cnf;
121 T_MFW_BT_DISCONNECT_IND *disconnect_ind;
122 T_MFW_BT_TRANSFER_AUDIO_OUT_CNF *audio_out_cnf;
123 T_MFW_BT_TRANSFER_AUDIO_IN_CNF *audio_in_cnf;
124 T_MFW_BT_OPP_PUT_IND *opp_put_ind;
125 T_MFW_BT_SRV_SYNC_CNF *srv_sync_cnf;
126 T_MFW_BT_SRV_SYNC_AUTH_IND * srv_sync_auth;
127 T_MFW_BT_SRV_SYNC_PULL_IND * srv_sync_pull_ind;
128 T_MFW_BT_SRV_SYNC_PUSH_IND * srv_sync_push_ind;
129 T_MFW_BT_SRV_SYNC_PUSH_CNF * srv_sync_push_cnf;
130 U8 len;
131 T_MFW_BT_CHNG_LOCAL_NAME *c_loc_name;
132 T_MFW_BT_READ_LOCAL_NAME *r_loc_name;
133 T_MFW_BT_REMOTE_DEV_INFO_RES *rem_dev_info;
134 T_MFW_BT_CHNG_CONNECTABLE_MODE *chng_cmode;
135 T_MFW_BT_CHNG_DISCOVERABLE_MODE *chng_dmode;
136 T_MFW_BT_READ_BD_ADDR *r_bd_addr;
137 /*#ifdef PCA_6350*/
138 T_MFW_BT_PCA_GW_STATUS_CFM *pca_gw_status;
139 T_MFW_BT_PCA_GW_LINK_MONITORING *pca_link_mon;
140 T_MFW_BT_PCA_GW_CALL_MONITORING *pca_call_mon;
141 T_MFW_BT_PCA_GW_HANGUP_CFM *pca_hangup;
142 /*#endif*/ /*PCA_6350*/
143
144 /* Cartman added begin */
145 T_MFW_BT_HSG_HEADSET_CONNECTION_IND *hsg_headset_connection_ind;
146 T_MFW_BT_HSG_SPECIFIC_CMD_CFM *hsg_specific_cmd_cfm;
147 T_MFW_BT_HSG_SAVE_LIST_CNF *hsg_save_list_cnf;
148 /* Cartman added end */
149
150 #ifdef _SIMULATION_
151
152 T_MFW_BT_SUBTYPE_DEV subtyp;
153 T_MFW_BT_SERVICE_TYPE service;
154 T_MFW_BT_SYNC_OBJECT syn_pull_obj, syn_push_obj;
155 T_MFW_BT_SYN_PASSWD mfw_sync_password[MFW_BT_PIN_MAX_LEN];
156 char * mfw_sync_password_ptr;
157 char j;
158 U8 headset_id, default_security;
159 T_MFW_BT_BD_ADDR client_address[MFW_BT_ADDR_MAX_LEN];
160 T_MFW_BT_BD_ADDR hsg_address[MFW_BT_ADDR_MAX_LEN];
161 T_MFW_BT_BD_ADDR server_address[MFW_BT_ADDR_MAX_LEN];
162 T_MFW_BT_BD_ADDR remote_address[MFW_BT_ADDR_MAX_LEN];
163 T_MFW_BT_SYN_OBJECT_STORE mfw_obj;
164 T_MFW_BT_SYNC_COMMAND mfw_syn_action;
165 T_MFW_BT_SYNC_SERVER_CONFIG syn_serv_config;
166 T_MFW_BT_SYN_OBJECT_STORE_ITEM mfw_obj_list, mfw_obj_list1;
167 T_MFW_BT_SYN_OBJECT_STORE_LIST mfw_obj_list_ptr, mfw_obj_list_ptr1;
168 T_MFW_BT_HSG_CLIENT_CONFIG client_config;
169 T_MFW_BT_HSG_SERVER_CONFIG server_conf;
170 T_MFW_BT_HSG_PHONE_NUMBER test_mfw_phone_list[4][30];
171 T_MFW_BT_HSG_KEY_LIST test_mfw_key_list[1];
172 T_MFW_BT_HSG_NAME hsg_name[MFW_BT_HSG_NAME_MAX_LEN];
173 T_MFW_BT_PRIORITY priority;
174 T_MFW_BT_CNF_ID headset_cnf_id;
175 BOOL rem_audio_ctr_supp_hsg;
176 BOOL mfw_keep_connection_opp;
177 T_MFW_BT_HEADSET_INFO hs_info;
178 U16 new_value;
179 T_MFW_BT_PARAM_NUMBER nb;
180 T_MFW_BT_CHANGE_PARA type;
181 T_MFW_BT_DUN_CONFIG dun_filter;
182 T_MFW_BT_FAX_CONFIG fax_filter;
183 T_MFW_BT_OPP_SERVER_CONFIG serv_config;
184 T_MFW_BT_OPP_PUT_RES opp_put_res;
185 T_MFW_BT_OPP_OBJECT receiv_obj, opp_push_obj, opp_pull_obj;
186 T_MFW_BT_PIN pin_code[MFW_BT_PIN_MAX_LEN];
187 T_MFW_BT_PIN_MODE pin_mode;
188 T_MFW_BT_RESULT_BT result_bt;
189 T_MFW_BT_PAIRABLE_MODE pair_mode;
190 T_MFW_BT_DEV_PAIR_LIST pairing_list;
191 T_MFW_BT_AUTHORIZATION_MASK auth_mask;
192 T_MFW_BT_AUTHORIZATION_MODE auth_mode;
193 T_MFW_BT_SECURITY_MODE sec_mode;
194
195 #endif
196
197 TRACE_FUNCTION ("mfw_bta:bta_response_cb()");
198
199 switch ((USHORT) opc)
200 {
201 case BTP_PROFILE_CREATE_CNF:
202 MALLOC(profile_create_cnf, sizeof(T_MFW_BT_PROFILE_CREATE_CNF));
203 profile_create_cnf->profile = ((T_BTP_PROFILE_CREATE_CNF *)data)->device;
204 bt_signal(BT_CREATE_PROFILE_CNF, profile_create_cnf);
205 MFREE(profile_create_cnf);
206 return TRUE;
207
208 case BTP_PROFILE_DELETE_CNF:
209 MALLOC(profile_delete_cnf, sizeof(T_MFW_BT_PROFILE_DELETE_CNF));
210 profile_delete_cnf->profile = ((T_BTP_PROFILE_DELETE_CNF *)data)->device;
211 bt_signal(BT_DELETE_PROFILE_CNF, profile_delete_cnf);
212 MFREE(profile_delete_cnf);
213 return TRUE;
214
215 case BTP_INIT_PROFILE_CNF:
216 /* BTI confirms initialization of profile */
217 MALLOC(profile_cnf_data, sizeof(T_MFW_BT_PROFILE_CNF));
218 memset(profile_cnf_data, 0, sizeof(T_MFW_BT_PROFILE_CNF));
219 profile_cnf_data->service = ((T_BTP_INIT_PROFILE_CNF *)data)->device;
220 profile_cnf_data->result_bd = ((T_BTP_INIT_PROFILE_CNF *)data)->result;
221 profile_cnf_data->action = ((T_BTP_INIT_PROFILE_CNF *)data)->action;
222 profile_cnf_data->subtype = ((T_BTP_INIT_PROFILE_CNF *)data)->subtype;
223 profile_cnf_data->mfw_opp_mode = ((T_BTP_INIT_PROFILE_CNF *)data)->opp_mode;
224 profile_cnf_data->mfw_sync_mode = ((T_BTP_INIT_PROFILE_CNF *)data)->sync_serv_mode;
225 profile_cnf_data->mfw_syn_aut_mode = ((T_BTP_INIT_PROFILE_CNF *)data)->sync_init_auth;
226 bt_signal(BT_INIT_PROFILE_CNF, profile_cnf_data);
227 #ifdef _SIMULATION_
228 if(profile_cnf_data->service EQ MFW_BT_SYNC)
229 {
230 TRACE_EVENT_P4("init cnf = %d, %d, %d, %d", profile_cnf_data->service, profile_cnf_data->subtype, profile_cnf_data->mfw_sync_mode, profile_cnf_data->mfw_syn_aut_mode);
231 }
232 else
233 {
234 TRACE_EVENT_P2("init cnf = %d, %d", profile_cnf_data->service, profile_cnf_data->subtype);
235 }
236 #endif
237 MFREE(profile_cnf_data);
238 return TRUE;
239
240 case BTP_DEINIT_PROFILE_CNF:
241 /* BTI confirms deinitialization of profile */
242 MALLOC(profile_cnf_data, sizeof(T_MFW_BT_PROFILE_CNF));
243 memset(profile_cnf_data, 0, sizeof(T_MFW_BT_PROFILE_CNF));
244 profile_cnf_data->service = ((T_BTP_DEINIT_PROFILE_CNF *)data)->device;
245 profile_cnf_data->result_bd = ((T_BTP_DEINIT_PROFILE_CNF *)data)->result;
246 profile_cnf_data->subtype = ((T_BTP_DEINIT_PROFILE_CNF *)data)->subtype;
247 profile_cnf_data->mfw_opp_mode = ((T_BTP_DEINIT_PROFILE_CNF *)data)->opp_mode;
248 profile_cnf_data->mfw_sync_mode = ((T_BTP_DEINIT_PROFILE_CNF *)data)->sync_serv_mode;
249 profile_cnf_data->mfw_syn_aut_mode = ((T_BTP_DEINIT_PROFILE_CNF *)data)->sync_init_auth;
250 bt_signal(BT_DEINIT_PROFILE_CNF, profile_cnf_data);
251 #ifdef _SIMULATION_
252 if(profile_cnf_data->service EQ MFW_BT_SYNC)
253 {
254 TRACE_EVENT_P4("deinit cnf = %d, %d, %d, %d", profile_cnf_data->service, profile_cnf_data->subtype, profile_cnf_data->mfw_sync_mode, profile_cnf_data->mfw_syn_aut_mode);
255 }
256 else
257 {
258 TRACE_EVENT_P2("deinit cnf = %d, %d", profile_cnf_data->service, profile_cnf_data->subtype);
259 }
260 #endif
261 MFREE(profile_cnf_data);
262 return TRUE;
263 }
264
265 switch ((USHORT) opc)
266 {
267 case BTP_RECONFIG_PROFILE_CNF:
268 /* BTI confirms reconfiguration of profile */
269 MALLOC(profile_cnf_data, sizeof(T_MFW_BT_PROFILE_CNF));
270 memset(profile_cnf_data, 0, sizeof(T_MFW_BT_PROFILE_CNF));
271 profile_cnf_data->service = ((T_BTP_RECONFIG_PROFILE_CNF *)data)->device;
272 profile_cnf_data->result_bd = ((T_BTP_RECONFIG_PROFILE_CNF *)data)->result;
273 profile_cnf_data->subtype = ((T_BTP_RECONFIG_PROFILE_CNF *)data)->subtype;
274 profile_cnf_data->mfw_opp_mode = ((T_BTP_RECONFIG_PROFILE_CNF *)data)->opp_mode;
275 profile_cnf_data->mfw_sync_mode = ((T_BTP_RECONFIG_PROFILE_CNF *)data)->sync_serv_mode;
276 profile_cnf_data->mfw_syn_aut_mode = ((T_BTP_RECONFIG_PROFILE_CNF *)data)->sync_init_auth;
277 bt_signal(BT_RECONFIG_PROFILE_CNF, profile_cnf_data);
278 #ifdef _SIMULATION_
279 if(profile_cnf_data->service EQ MFW_BT_SYNC)
280 {
281 TRACE_EVENT_P4("reconf cnf = %d, %d, %d, %d", profile_cnf_data->service, profile_cnf_data->subtype, profile_cnf_data->mfw_sync_mode, profile_cnf_data->mfw_syn_aut_mode);
282 }
283 else
284 {
285 TRACE_EVENT_P2("reconf cnf = %d, %d", profile_cnf_data->service, profile_cnf_data->subtype);
286 }
287 #endif
288 MFREE(profile_cnf_data);
289 return TRUE;
290
291 case BTP_RESTORE_LIST_RESULT:
292 /* BTI confirms restoring of default device list */
293 MALLOC(restore_configuration, sizeof(T_MFW_BT_REST_CONFIG));
294 memset(restore_configuration, 0, sizeof(T_MFW_BT_REST_CONFIG));
295 restore_configuration->service = ((T_BTP_RESTORE_LIST_RESULT *)data)->device;
296 restore_configuration->cause = ((T_BTP_RESTORE_LIST_RESULT *)data)->cause;
297 bt_signal(BT_RESTORE_LIST_RESULT, restore_configuration);
298 #ifdef _SIMULATION_
299 if(restore_configuration->cause EQ MFW_BT_REST_LIST_ERR)
300 {
301 TRACE_EVENT("restore list err");
302 }
303 else if(restore_configuration->cause EQ MFW_BT_REST_CONFIG_ERR)
304 {
305 TRACE_EVENT("restore conf err");
306 }
307 else
308 {
309 TRACE_EVENT("restore conf no err");
310 }
311 #endif
312 MFREE(restore_configuration);
313 return TRUE;
314
315 case BTP_RESTORE_CONF_RESULT:
316 /* BTI confirms restoring of configuration parameters */
317 MALLOC(restore_configuration, sizeof(T_MFW_BT_REST_CONFIG));
318 memset(restore_configuration, 0, sizeof(T_MFW_BT_REST_CONFIG));
319 restore_configuration->service = ((T_BTP_RESTORE_CONF_RESULT *)data)->device;
320 restore_configuration->cause = ((T_BTP_RESTORE_CONF_RESULT *)data)->cause;
321 bt_signal(BT_RESTORE_CONF_RESULT, restore_configuration);
322 #ifdef _SIMULATION_
323 if(restore_configuration->cause EQ MFW_BT_REST_LIST_ERR)
324 {
325 TRACE_EVENT("restore list err");
326 }
327 else if(restore_configuration->cause EQ MFW_BT_REST_CONFIG_ERR)
328 {
329 TRACE_EVENT("restore conf err");
330 }
331 else
332 {
333 TRACE_EVENT("restore conf no err");
334 }
335 #endif
336 MFREE(restore_configuration);
337 return TRUE;
338
339 case BTP_DEVICE_FOUND_IND:
340 /* BTI confirms finding of bluetooth device with bd_addr and service id's)*/
341 MALLOC(device_indication, sizeof(T_MFW_BT_DEVICE_IND));
342 memset(device_indication, 0, sizeof(T_MFW_BT_DEVICE_IND));
343
344 memcpy(device_indication->bd_addr, ((T_BTP_DEVICE_FOUND_IND *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
345 memcpy(device_indication->bd_name, ((T_BTP_DEVICE_FOUND_IND *)data)->bd_name, MFW_BT_NAME_MAX_LEN);
346 memcpy(device_indication->cod, ((T_BTP_DEVICE_FOUND_IND *)data)->cod, MFW_BT_DEVICE_CLASS_LEN);
347 device_indication->num_services = ((T_BTP_DEVICE_FOUND_IND *)data)->num_services;
348 device_indication->services = ((T_BTP_DEVICE_FOUND_IND *)data)->services;
349
350 MALLOC(dev_id, sizeof(T_MFW_BT_DEVICE_ID));/* allocate memory for new device id */
351 if(!dev_id)
352 return FALSE; /* no more memory */
353
354 memset(dev_id, 0, sizeof(T_MFW_BT_DEVICE_ID));
355 idd_ptr = &service_list; /* pointer to list of services */
356 if(!idd_ptr->device_id) /* test if any device id exist */
357 {
358 idd_ptr->device_id = dev_id; /* append new device_id */
359 memcpy(idd_ptr->device_id->bd_addr, device_indication->bd_addr, MFW_BT_ADDR_MAX_LEN);/* new address */
360 memcpy(idd_ptr->device_id->bd_name, device_indication->bd_name, MFW_BT_NAME_MAX_LEN);/* new name */
361 memcpy(idd_ptr->device_id->cod, device_indication->cod, MFW_BT_DEVICE_CLASS_LEN);/* new cod */
362 idd_ptr->device_id->num_services = device_indication->num_services;
363 idd_ptr->device_id->services = device_indication->services;
364 idd_ptr->device_id->next = NULL; /* finish chain */
365 #ifdef _SIMULATION_
366 TRACE_EVENT_P2("dev found ind = %x %s", service_list.device_id->services, service_list.device_id->bd_addr);
367 #endif
368 }
369 else
370 {
371 help_serv_id = idd_ptr->device_id;/* first element */
372 while(help_serv_id->next) /* look for next device_id */
373 {
374 help_serv_id = help_serv_id->next;
375 }
376 help_serv_id->next = dev_id;/* append new device_id */
377 memcpy(help_serv_id->next->bd_addr, device_indication->bd_addr, MFW_BT_ADDR_MAX_LEN);/* new address */
378 memcpy(help_serv_id->next->bd_name, device_indication->bd_name, MFW_BT_NAME_MAX_LEN);/* new name */
379 memcpy(help_serv_id->next->cod, device_indication->cod, MFW_BT_DEVICE_CLASS_LEN);/* new cod */
380 help_serv_id->next->num_services = device_indication->num_services;/* number of services */
381 help_serv_id->next->services = device_indication->services;/* service id bitmap */
382 help_serv_id->next->next = NULL;/* finish chain */
383 #ifdef _SIMULATION_
384 TRACE_EVENT_P2("dev found ind = %x %s ", help_serv_id->next->services, help_serv_id->next->bd_addr);
385 #endif
386 }
387 bt_signal(BT_DEVICE_FOUND_IND, device_indication);
388 MFREE(device_indication);
389 return TRUE;
390
391 case BTP_SERVICE_FOUND_IND:
392 /* BTI confirms finding of service names and bd_addr to the desired device typ (service id)*/
393 MALLOC(service_indication, sizeof(T_MFW_BT_SERVICE_IND));
394 memset(service_indication, 0, sizeof(T_MFW_BT_SERVICE_IND));
395
396 service_indication->service = ((T_BTP_SERVICE_FOUND_IND *)data)->device;
397 memcpy(service_indication->bd_addr, ((T_BTP_SERVICE_FOUND_IND *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
398 memcpy(service_indication->bd_name, ((T_BTP_SERVICE_FOUND_IND *)data)->bd_name, MFW_BT_NAME_MAX_LEN);
399 memcpy(service_indication->cod, ((T_BTP_SERVICE_FOUND_IND *)data)->cod, MFW_BT_DEVICE_CLASS_LEN);
400 memcpy(service_indication->service_name, ((T_BTP_SERVICE_FOUND_IND *)data)->serv_name, MFW_BT_SERVICE_NAME_MAX_LEN);
401 /* information of new device(service) will be collected in list of found devices, but only after BT_SERVICE_SEARCH_CNF */
402 /* the list will be sent to MMI */
403 if(service_indication->service EQ MFW_BT_HEADSET)
404 {
405 MALLOC(service_id, sizeof(T_MFW_BT_SERVICE_ID));/* allocate memory for new device id */
406 if(!service_id)
407 return FALSE;
408 memset(service_id, 0, sizeof(T_MFW_BT_SERVICE_ID));
409 len = sizeof(service_indication->service_name);
410 id_ptr = &found_headset; /* pointer to list of founded headset devices */
411 if(!id_ptr->device_id) /* test if does any device id exist */
412 {
413 id_ptr->device_id = service_id; /* append new device_id */
414 memcpy(id_ptr->device_id->bd_addr, service_indication->bd_addr, MFW_BT_ADDR_MAX_LEN);/* new address */
415
416 memcpy(id_ptr->device_id->bd_name, service_indication->bd_name, MFW_BT_NAME_MAX_LEN);
417 memcpy(id_ptr->device_id->cod, service_indication->cod, MFW_BT_DEVICE_CLASS_LEN);
418 memcpy(id_ptr->device_id->service_name, service_indication->service_name, MFW_BT_SERVICE_NAME_MAX_LEN);/* new name */
419
420 id_ptr->device_id->next = NULL; /* finish chain */
421 #ifdef _SIMULATION_
422 TRACE_EVENT_P1("hsg found ind = %s", found_headset.device_id->bd_name);
423 #endif
424 }
425 else
426 {
427 help_id = id_ptr->device_id;/* first element */
428 while(help_id->next) /* look for next device_id */
429 {
430 help_id = help_id->next;
431 }
432
433 help_id->next = service_id;/* append new device_id */
434 memcpy(help_id->next->bd_addr, service_indication->bd_addr, MFW_BT_ADDR_MAX_LEN);/* new address */
435 memcpy(id_ptr->device_id->bd_name, service_indication->bd_name, MFW_BT_NAME_MAX_LEN);
436 memcpy(id_ptr->device_id->cod, service_indication->cod, MFW_BT_DEVICE_CLASS_LEN);
437 memcpy(id_ptr->device_id->service_name, service_indication->service_name, MFW_BT_SERVICE_NAME_MAX_LEN);/* new name */
438
439 help_id->next->next = NULL;/* finish chain */
440 #ifdef _SIMULATION_
441 TRACE_EVENT_P1("hsg found ind = %s", help_id->next->bd_name);
442 #endif
443 }
444 }
445 else if(service_indication->service EQ MFW_BT_DIAL_UP)
446 {
447 MALLOC(service_id, sizeof(T_MFW_BT_SERVICE_ID));/* allocate memory for new device id */
448 if(!service_id)
449 return FALSE;
450 memset(service_id, 0, sizeof(T_MFW_BT_SERVICE_ID));
451 len = sizeof(service_indication->service_name);
452 id_ptr = &found_dial_up; /* pointer to list of detected dial up network services */
453 if(!id_ptr->device_id) /* test if does any device id exist */
454 {
455
456 id_ptr->device_id = service_id; /* append new device_id */
457 memcpy(id_ptr->device_id->bd_addr, service_indication->bd_addr, MFW_BT_ADDR_MAX_LEN);/* new address */
458 memcpy(id_ptr->device_id->bd_name, service_indication->bd_name, MFW_BT_NAME_MAX_LEN);
459 memcpy(id_ptr->device_id->cod, service_indication->cod, MFW_BT_DEVICE_CLASS_LEN);
460 memcpy(id_ptr->device_id->service_name, service_indication->service_name, MFW_BT_SERVICE_NAME_MAX_LEN);/* new name */
461 id_ptr->device_id->next = NULL; /* finish chain */
462 #ifdef _SIMULATION_
463 TRACE_EVENT_P1("dun found ind = %s", found_dial_up.device_id->bd_name);
464 #endif
465 }
466 else
467 {
468 help_id = id_ptr->device_id;/* first element */
469 while(help_id->next) /* look for next device_id */
470 {
471 help_id = help_id->next;
472 }
473
474 help_id->next = service_id;/* append new device_id */
475 memcpy(help_id->next->bd_addr, service_indication->bd_addr, MFW_BT_ADDR_MAX_LEN);/* new address */
476 memcpy(id_ptr->device_id->bd_name, service_indication->bd_name, MFW_BT_NAME_MAX_LEN);
477 memcpy(id_ptr->device_id->cod, service_indication->cod, MFW_BT_DEVICE_CLASS_LEN);
478 memcpy(id_ptr->device_id->service_name, service_indication->service_name, MFW_BT_SERVICE_NAME_MAX_LEN);/* new name */
479
480 help_id->next->next = NULL;/* finish chain */
481 #ifdef _SIMULATION_
482 TRACE_EVENT_P1("dun found ind = %s", help_id->next->bd_name);
483 #endif
484 }
485 }
486 else if(service_indication->service EQ MFW_BT_FAX_GW)
487 {
488 MALLOC(service_id, sizeof(T_MFW_BT_SERVICE_ID));/* allocate memory for new device id */
489 if(!service_id)
490 return FALSE;
491 memset(service_id, 0, sizeof(T_MFW_BT_SERVICE_ID));
492 len = sizeof(service_indication->service_name);
493 id_ptr = &found_fax; /* pointer to list of detected fax services */
494 if(!id_ptr->device_id) /* test if does any device id exist */
495 {
496
497 id_ptr->device_id = service_id; /* append new device_id */
498 memcpy(id_ptr->device_id->bd_addr, service_indication->bd_addr, MFW_BT_ADDR_MAX_LEN);/* new address */
499 memcpy(id_ptr->device_id->bd_name, service_indication->bd_name, MFW_BT_NAME_MAX_LEN);
500 memcpy(id_ptr->device_id->cod, service_indication->cod, MFW_BT_DEVICE_CLASS_LEN);
501 memcpy(id_ptr->device_id->service_name, service_indication->service_name, MFW_BT_SERVICE_NAME_MAX_LEN);/* new name */
502 id_ptr->device_id->next = NULL; /* finish chain */
503 #ifdef _SIMULATION_
504 TRACE_EVENT_P1("fax found ind = %s", found_fax.device_id->bd_name);
505 #endif
506 }
507 else
508 {
509 help_id = id_ptr->device_id;/* first element */
510 while(help_id->next) /* look for next device_id */
511 {
512 help_id = help_id->next;
513 }
514
515 help_id->next = service_id;/* append new device_id */
516 memcpy(help_id->next->bd_addr, service_indication->bd_addr, MFW_BT_ADDR_MAX_LEN);/* new address */
517 memcpy(id_ptr->device_id->bd_name, service_indication->bd_name, MFW_BT_NAME_MAX_LEN);
518 memcpy(id_ptr->device_id->cod, service_indication->cod, MFW_BT_DEVICE_CLASS_LEN);
519 memcpy(id_ptr->device_id->service_name, service_indication->service_name, MFW_BT_SERVICE_NAME_MAX_LEN);/* new name */
520
521 help_id->next->next = NULL;/* finish chain */
522 #ifdef _SIMULATION_
523 TRACE_EVENT_P1("fax found ind = %s", help_id->next->bd_name);
524 #endif
525 }
526 }
527 else if(service_indication->service EQ MFW_BT_OPP)
528 {
529 MALLOC(service_id, sizeof(T_MFW_BT_SERVICE_ID));/* allocate memory for new device id */
530 if(!service_id)
531 return FALSE;
532 memset(service_id, 0, sizeof(T_MFW_BT_SERVICE_ID));
533 len = sizeof(service_indication->service_name);
534 id_ptr = &found_opp; /* pointer to list of detected opp services */
535 if(!id_ptr->device_id) /* test if does any device id exist */
536 {
537
538 id_ptr->device_id = service_id; /* append new device_id */
539 memcpy(id_ptr->device_id->bd_addr, service_indication->bd_addr, MFW_BT_ADDR_MAX_LEN);/* new address */
540 memcpy(id_ptr->device_id->bd_name, service_indication->bd_name, MFW_BT_NAME_MAX_LEN);
541 memcpy(id_ptr->device_id->cod, service_indication->cod, MFW_BT_DEVICE_CLASS_LEN);
542 memcpy(id_ptr->device_id->service_name, service_indication->service_name, MFW_BT_SERVICE_NAME_MAX_LEN);/* new name */
543 id_ptr->device_id->next = NULL; /* finish chain */
544 #ifdef _SIMULATION_
545 TRACE_EVENT_P1("opp found ind = %s", found_opp.device_id->bd_name);
546 #endif
547 }
548 else
549 {
550 help_id = id_ptr->device_id;/* first element */
551 while(help_id->next) /* look for next device_id */
552 {
553 help_id = help_id->next;
554 }
555
556 help_id->next = service_id;/* append new device_id */
557 memcpy(help_id->next->bd_addr, service_indication->bd_addr, MFW_BT_ADDR_MAX_LEN);/* new address */
558 memcpy(id_ptr->device_id->bd_name, service_indication->bd_name, MFW_BT_NAME_MAX_LEN);
559 memcpy(id_ptr->device_id->cod, service_indication->cod, MFW_BT_DEVICE_CLASS_LEN);
560 memcpy(id_ptr->device_id->service_name, service_indication->service_name, MFW_BT_SERVICE_NAME_MAX_LEN);/* new name */
561
562 help_id->next->next = NULL;/* finish chain */
563 #ifdef _SIMULATION_
564 TRACE_EVENT_P1("opp found ind = %s", help_id->next->bd_name);
565 #endif
566 }
567 }
568 else if(service_indication->service EQ MFW_BT_SYNC)
569 {
570 MALLOC(service_id, sizeof(T_MFW_BT_SERVICE_ID));/* allocate memory for new device id */
571 if(!service_id)
572 return FALSE;
573 memset(service_id, 0, sizeof(T_MFW_BT_SERVICE_ID));
574 len = sizeof(service_indication->service_name);
575 id_ptr = &found_sync; /* pointer to list of detected SYNC services */
576 if(!id_ptr->device_id) /* test if does any device id exist */
577 {
578
579 id_ptr->device_id = service_id; /* append new device_id */
580 memcpy(id_ptr->device_id->bd_addr, service_indication->bd_addr, MFW_BT_ADDR_MAX_LEN);/* new address */
581 memcpy(id_ptr->device_id->bd_name, service_indication->bd_name, MFW_BT_NAME_MAX_LEN);
582 memcpy(id_ptr->device_id->cod, service_indication->cod, MFW_BT_DEVICE_CLASS_LEN);
583 memcpy(id_ptr->device_id->service_name, service_indication->service_name, MFW_BT_SERVICE_NAME_MAX_LEN);/* new name */
584 id_ptr->device_id->next = NULL; /* finish chain */
585 }
586 else
587 {
588 help_id = id_ptr->device_id;/* first element */
589 while(help_id->next) /* look for next device_id */
590 {
591 help_id = help_id->next;
592 }
593
594 help_id->next = service_id;/* append new device_id */
595 memcpy(help_id->next->bd_addr, service_indication->bd_addr, MFW_BT_ADDR_MAX_LEN);/* new address */
596 memcpy(id_ptr->device_id->bd_name, service_indication->bd_name, MFW_BT_NAME_MAX_LEN);
597 memcpy(id_ptr->device_id->cod, service_indication->cod, MFW_BT_DEVICE_CLASS_LEN);
598 memcpy(id_ptr->device_id->service_name, service_indication->service_name, MFW_BT_SERVICE_NAME_MAX_LEN);/* new name */
599
600 help_id->next->next = NULL;/* finish chain */
601 }
602 }
603 else if(service_indication->service EQ MFW_BT_SYNC_CMD)
604 {
605 MALLOC(service_id, sizeof(T_MFW_BT_SERVICE_ID));/* allocate memory for new device id */
606 if(!service_id)
607 return FALSE;
608 memset(service_id, 0, sizeof(T_MFW_BT_SERVICE_ID));
609 len = sizeof(service_indication->service_name);
610 id_ptr = &found_sync_cmd; /* pointer to list of detected SYNC services with SYN commands support */
611 if(!id_ptr->device_id) /* test if does any device id exist */
612 {
613
614 id_ptr->device_id = service_id; /* append new device_id */
615 memcpy(id_ptr->device_id->bd_addr, service_indication->bd_addr, MFW_BT_ADDR_MAX_LEN);/* new address */
616 memcpy(id_ptr->device_id->bd_name, service_indication->bd_name, MFW_BT_NAME_MAX_LEN);
617 memcpy(id_ptr->device_id->cod, service_indication->cod, MFW_BT_DEVICE_CLASS_LEN);
618 memcpy(id_ptr->device_id->service_name, service_indication->service_name, MFW_BT_SERVICE_NAME_MAX_LEN);/* new name */
619 id_ptr->device_id->next = NULL; /* finish chain */
620 #ifdef _SIMULATION_
621 TRACE_EVENT_P1("sync found ind = %s", found_sync_cmd.device_id->bd_name);
622 #endif
623 }
624 else
625 {
626 help_id = id_ptr->device_id;/* first element */
627 while(help_id->next) /* look for next device_id */
628 {
629 help_id = help_id->next;
630 }
631
632 help_id->next = service_id;/* append new device_id */
633 memcpy(help_id->next->bd_addr, service_indication->bd_addr, MFW_BT_ADDR_MAX_LEN);/* new address */
634 memcpy(id_ptr->device_id->bd_name, service_indication->bd_name, MFW_BT_NAME_MAX_LEN);
635 memcpy(id_ptr->device_id->cod, service_indication->cod, MFW_BT_DEVICE_CLASS_LEN);
636 memcpy(id_ptr->device_id->service_name, service_indication->service_name, MFW_BT_SERVICE_NAME_MAX_LEN);/* new name */
637
638 help_id->next->next = NULL;/* finish chain */
639 #ifdef _SIMULATION_
640 TRACE_EVENT_P1("sync found ind = %s", help_id->next->bd_name);
641 #endif
642 }
643 }
644 bt_signal(BT_SERVICE_FOUND_IND, service_indication);
645 MFREE(service_indication);
646 return TRUE;
647
648 case BTP_SERVICE_SEARCH_CNF:
649 /* BTI confirms finish of search of services */
650 MALLOC(search_conf, sizeof(T_MFW_BT_SERVICE_SEARCH_CNF));
651 memset(search_conf, 0, sizeof(T_MFW_BT_SERVICE_SEARCH_CNF));
652 search_conf->service = ((T_BTP_SERVICE_SEARCH_CNF *)data)->device;
653 bt_signal(BT_SERVICE_SEARCH_CNF, search_conf);
654 #ifdef _SIMULATION_
655 TRACE_EVENT("sync search cnf");
656 #endif
657 MFREE(search_conf);
658 return TRUE;
659
660 case BTP_DEVICE_SEARCH_CNF:
661 /* BTI confirms finish of search of devices */
662 MALLOC(dev_search_conf, sizeof(T_MFW_BT_DEVICE_SEARCH_CNF));
663 memset(dev_search_conf, 0, sizeof(T_MFW_BT_DEVICE_SEARCH_CNF));
664 dev_search_conf->result = ((T_BTP_DEVICE_SEARCH_CNF *)data)->result;
665 bt_signal(BT_DEVICE_SEARCH_CNF, dev_search_conf);
666 MFREE(dev_search_conf);
667 return TRUE;
668
669 case BTP_CONNECT_DEVICE_CNF:
670 /* BTI confirms connection */
671 MALLOC(connect_cnf, sizeof(T_MFW_BT_CONNECT_CNF));
672 memset(connect_cnf, 0, sizeof(T_MFW_BT_CONNECT_CNF));
673 connect_cnf->service = ((T_BTP_CONNECT_DEVICE_CNF *)data)->device;
674 memcpy(connect_cnf->bd_addr, ((T_BTP_CONNECT_DEVICE_CNF *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
675 connect_cnf->result_bd = ((T_BTP_CONNECT_DEVICE_CNF *)data)->result;
676 connect_cnf->cnf_id = ((T_BTP_CONNECT_DEVICE_CNF *)data)->cnf_id;
677 connect_cnf->cause = ((T_BTP_CONNECT_DEVICE_CNF *)data)->cause;
678 bt_signal(BT_CONNECT_DEVICE_CNF, connect_cnf);
679 #ifdef _SIMULATION_
680 TRACE_EVENT_P4("conn cnf = %d, %d, %d, %s", connect_cnf->service, connect_cnf->result_bd, connect_cnf->cause, connect_cnf->bd_addr);
681 #endif
682 MFREE(connect_cnf);
683 return TRUE;
684
685 case BTP_CONNECT_DEVICE_IND:
686 /* BTI indicates that a remote device wants to establish a connection */
687 MALLOC(connect_ind, sizeof(T_MFW_BT_CONNECT_IND));
688 memset(connect_ind, 0, sizeof(T_MFW_BT_CONNECT_IND));
689 connect_ind->service = ((T_BTP_CONNECT_DEVICE_IND *)data)->device;
690 connect_ind->mfw_src_id = ((T_BTP_CONNECT_DEVICE_IND *)data)->src_id;
691 switch(connect_ind->service)
692 {
693 case MFW_BT_SYNC_CMD:
694 memcpy(connect_ind->bd_addr, ((T_BTP_CONNECT_DEVICE_IND *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
695 memcpy(connect_ind->bd_name, ((T_BTP_CONNECT_DEVICE_IND *)data)->bd_name, MFW_BT_NAME_MAX_LEN);
696 connect_ind->ind_id = ((T_BTP_CONNECT_DEVICE_IND *)data)->ind_id;
697 break;
698 case MFW_BT_HEADSET:
699 if(connect_ind->mfw_src_id NEQ MFW_BT_GSM_NETWORK) /* indication from remote headset */
700 {
701 connect_ind->ind_id = ((T_BTP_CONNECT_DEVICE_IND *)data)->ind_id;
702 memcpy(connect_ind->bd_addr, ((T_BTP_CONNECT_DEVICE_IND *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
703 }
704 break;
705 default:
706 break;
707 }
708 bt_signal(BT_CONNECT_DEVICE_IND, connect_ind);
709 #ifdef _SIMULATION_
710 if((connect_ind->service EQ MFW_BT_SYNC_CMD) OR (connect_ind->service EQ MFW_BT_HEADSET))
711 {
712 TRACE_EVENT_P3("conn ind = %d %d %s", connect_ind->service, connect_ind->mfw_src_id, connect_ind->bd_addr);
713 }
714 else
715 TRACE_EVENT_P2("conn ind = %d %d", connect_ind->service, connect_ind->mfw_src_id);
716 #endif
717 MFREE(connect_ind);
718 return TRUE;
719
720 case BTP_PIN_IND:
721 /* BTI indicates that a pin code is needed */
722 MALLOC(pin_indication, sizeof(T_MFW_BT_PIN_IND));
723 memset(pin_indication, 0, sizeof(T_MFW_BT_PIN_IND));
724 memcpy(pin_indication->bd_addr, ((T_BTP_PIN_IND *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
725 memcpy(pin_indication->bd_name, ((T_BTP_PIN_IND *)data)->bd_name, MFW_BT_NAME_MAX_LEN);
726 bt_signal(BT_PIN_IND, pin_indication);
727 #ifdef _SIMULATION_
728 TRACE_EVENT_P2("pin = %s %s", pin_indication->bd_name, pin_indication->bd_addr);
729 #endif
730 MFREE(pin_indication);
731 return TRUE;
732
733 case BTP_AUTHORIZATION_IND:
734 /* BTI indicates that a authorization reply is needed */
735 MALLOC(authorization_ind, sizeof(T_MFW_BT_AUTHORIZATION_IND));
736 memset(authorization_ind, 0, sizeof(T_MFW_BT_AUTHORIZATION_IND));
737 memcpy(authorization_ind->bd_addr, ((T_BTP_AUTHORIZATION_IND *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
738 memcpy(authorization_ind->bd_name, ((T_BTP_AUTHORIZATION_IND *)data)->bd_name, MFW_BT_NAME_MAX_LEN);
739 memcpy(authorization_ind->appli_name, ((T_BTP_AUTHORIZATION_IND *)data)->appli_name, MFW_BT_APPL_NAME_MAX_LEN);
740 authorization_ind->auth_mask_mfw = ((T_BTP_AUTHORIZATION_IND *)data)->authorization_mask_serv;
741 authorization_ind->connection_dir = ((T_BTP_AUTHORIZATION_IND *)data)->incom_conn;
742 bt_signal(BT_AUTHORIZATION_IND, authorization_ind);
743 #ifdef _SIMULATION_
744 TRACE_EVENT_P4("author ind = %x %d %s %s", authorization_ind->auth_mask_mfw, authorization_ind->connection_dir, authorization_ind->bd_name, authorization_ind->appli_name);
745 #endif
746 MFREE(authorization_ind);
747 return TRUE;
748
749 case BTP_TRANSFER_AUDIO_OUT_CNF:
750 /* BTI confirms audio connection to device */
751 MALLOC(audio_out_cnf, sizeof(T_MFW_BT_TRANSFER_AUDIO_OUT_CNF));
752 memset(audio_out_cnf, 0, sizeof(T_MFW_BT_TRANSFER_AUDIO_OUT_CNF));
753 audio_out_cnf->service = ((T_BTP_TRANSFER_AUDIO_OUT_CNF *)data)->device;
754 audio_out_cnf->result_bd = ((T_BTP_TRANSFER_AUDIO_OUT_CNF *)data)->result;
755 memcpy(audio_out_cnf->bd_addr, ((T_BTP_TRANSFER_AUDIO_OUT_CNF *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
756 audio_out_cnf->cnf_id = ((T_BTP_TRANSFER_AUDIO_OUT_CNF *)data)->cnf_id;
757 bt_signal(BT_TRANSFER_AUDIO_OUT_CNF, audio_out_cnf);
758 #ifdef _SIMULATION_
759 TRACE_EVENT_P2("audio out cnf = %d, %s", audio_out_cnf->service, audio_out_cnf->bd_addr);
760 #endif
761 MFREE(audio_out_cnf);
762 return TRUE;
763
764 case BTP_TRANSFER_AUDIO_IN_CNF:
765 /* BTI confirms audio connection from headset */
766 MALLOC(audio_in_cnf, sizeof(T_MFW_BT_TRANSFER_AUDIO_IN_CNF));
767 memset(audio_in_cnf, 0, sizeof(T_MFW_BT_TRANSFER_AUDIO_IN_CNF));
768 audio_in_cnf->service = ((T_BTP_TRANSFER_AUDIO_IN_CNF *)data)->device;
769 audio_in_cnf->result_bd = ((T_BTP_TRANSFER_AUDIO_IN_CNF *)data)->result;
770 memcpy(audio_in_cnf->bd_addr, ((T_BTP_TRANSFER_AUDIO_IN_CNF *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
771 bt_signal(BT_TRANSFER_AUDIO_IN_CNF, audio_in_cnf);
772 #ifdef _SIMULATION_
773 TRACE_EVENT_P2("audio in cnf = %d, %s", audio_in_cnf->service, audio_in_cnf->bd_addr);
774 #endif
775 MFREE(audio_in_cnf);
776 return TRUE;
777
778 case BTP_DISCONNECT_DEVICE_CNF:
779 /* BTI confirms disconnection for profile hsg */
780 MALLOC(disconnect_cnf, sizeof(T_MFW_BT_DISCONNECT_CNF));
781 memset(disconnect_cnf, 0, sizeof(T_MFW_BT_DISCONNECT_CNF));
782 disconnect_cnf->service = ((T_BTP_DISCONNECT_DEVICE_CNF *)data)->device;
783 disconnect_cnf->cnf_id = ((T_BTP_DISCONNECT_DEVICE_CNF *)data)->cnf_id;
784 memcpy(disconnect_cnf->bd_addr, ((T_BTP_DISCONNECT_DEVICE_CNF *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
785 bt_signal(BT_DISCONNECT_DEVICE_CNF, disconnect_cnf);
786 #ifdef _SIMULATION_
787 TRACE_EVENT_P3("disconn cnf = %d, %d, %s", disconnect_cnf->service, disconnect_cnf->cnf_id, disconnect_cnf->bd_addr);
788 #endif
789 MFREE(disconnect_cnf);
790 return TRUE;
791
792 case BTP_DISCON_DUN_FAX_CNF:
793 /* BTI confirms disconnection for profile dun/fax */
794 MALLOC(discon_dun_fax_cnf, sizeof(T_MFW_BT_DISCON_DUN_FAX_CNF));
795 memset(discon_dun_fax_cnf, 0, sizeof(T_MFW_BT_DISCON_DUN_FAX_CNF));
796 discon_dun_fax_cnf->service = ((T_BTP_DISCON_DUN_FAX_CNF *)data)->device;
797 discon_dun_fax_cnf->result_bd = ((T_BTP_DISCON_DUN_FAX_CNF *)data)->cause;
798 bt_signal(BT_DISCON_DUN_FAX_CNF, discon_dun_fax_cnf);
799 #ifdef _SIMULATION_
800 TRACE_EVENT_P2("disconn cnf = %d, %d", discon_dun_fax_cnf->service, discon_dun_fax_cnf->result_bd);
801 #endif
802 MFREE(discon_dun_fax_cnf);
803 return TRUE;
804
805 case BTP_DISCONNECT_DEVICE_IND:
806 /* BTI indicats disconnection from headset*/
807 MALLOC(disconnect_ind, sizeof(T_MFW_BT_DISCONNECT_IND));
808 memset(disconnect_ind, 0, sizeof(T_MFW_BT_DISCONNECT_IND));
809 disconnect_ind->service = ((T_BTP_DISCONNECT_DEVICE_IND *)data)->device;
810 disconnect_ind->ind_id = ((T_BTP_DISCONNECT_DEVICE_IND *)data)->ind_id;
811 memcpy(disconnect_ind->bd_addr, ((T_BTP_DISCONNECT_DEVICE_IND *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
812 bt_signal(BT_DISCONNECT_DEVICE_IND, disconnect_ind);
813 #ifdef _SIMULATION_
814 TRACE_EVENT_P3("disconn ind hsg = %d, %d, %s", disconnect_ind->service, disconnect_ind->ind_id, disconnect_ind->bd_addr);
815 #endif
816 MFREE(disconnect_ind);
817 return TRUE;
818
819 case BTP_DISCON_DUN_FAX_IND:
820 /* BTI indicates disconnection from remote dun/fax */
821 MALLOC(disc_dun_fax_ind, sizeof(T_MFW_BT_DISCON_DUN_FAX_IND));
822 memset(disc_dun_fax_ind, 0, sizeof(T_MFW_BT_DISCON_DUN_FAX_IND));
823 disc_dun_fax_ind->service = ((T_BTP_DISCON_DUN_FAX_IND *)data)->device;
824 bt_signal(BT_DISCON_DUN_FAX_IND, disc_dun_fax_ind);
825 #ifdef _SIMULATION_
826 TRACE_EVENT_P1("disconn ind dun = %d", disc_dun_fax_ind->service);
827 #endif
828 MFREE(disc_dun_fax_ind);
829 return TRUE;
830
831 case BTP_DEVICE_PAIRED_IND:
832 /* BTI indicates that a pin code is needed */
833 MALLOC(pair_indication, sizeof(T_MFW_BT_DEV_PAIR_IND));
834 memset(pair_indication, 0, sizeof(T_MFW_BT_DEV_PAIR_IND));
835 memcpy(pair_indication->rem_bd_addr, ((T_BTP_DEVICE_PAIRED_IND *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
836 memcpy(pair_indication->rem_bd_name, ((T_BTP_DEVICE_PAIRED_IND *)data)->bd_name, MFW_BT_NAME_MAX_LEN);
837 pair_indication->pair_res = ((T_BTP_DEVICE_PAIRED_IND *)data)->pair_result;
838 bt_signal(BT_DEVICE_PAIRED_IND, pair_indication);
839 #ifdef _SIMULATION_
840 TRACE_EVENT_P2("pair ind = %d %s", pair_indication->pair_res, pair_indication->rem_bd_name);
841 #endif
842 MFREE(pair_indication);
843 return TRUE;
844
845 case BTP_TRUSTED_DEV_LIST_FULL:
846 /* BTI indicates that list of trusted devices is full */
847 bt_signal(BT_TRUSTED_DEV_LIST_FULL, NULL);
848 #ifdef _SIMULATION_
849 TRACE_EVENT("TRUSTED_DEV_LIST_FULL");
850 #endif
851 return TRUE;
852
853 case BTP_CALL_MONITORING_STATUS:
854 /* BTI indicates call monitoring messages by dun/fax */
855 MALLOC(dun_call_state, sizeof(T_MFW_BT_CALL_STATUS_DUN_FAX));
856 memset(dun_call_state, 0, sizeof(T_MFW_BT_CALL_STATUS_DUN_FAX));
857 dun_call_state->service = ((T_BTP_CALL_MONITORING_STATUS *)data)->device;
858 switch(((T_BTP_CALL_MONITORING_STATUS *)data)->call_status)
859 {
860 case BTI_DUN_CALL_IN_PRO:
861 dun_call_state->call_state = MFW_BT_CALL_IN_PROGRESS;
862 break;
863 case BTI_DUN_CALL_ESTABLISHED:
864 dun_call_state->call_state = MFW_BT_CALL_ESTABLISHED;
865 break;
866 case BTI_DUN_CALL_PAUSED:
867 dun_call_state->call_state = MFW_BT_CALL_PAUSED;
868 break;
869 case BTI_DUN_CALL_RESUMED:
870 dun_call_state->call_state = MFW_BT_CALL_RESUMED;
871 break;
872 case BTI_DUN_CALL_HANGUP_IN_PR:
873 dun_call_state->call_state = MFW_BT_HANGUP_IN_PROGRESS;
874 break;
875 case BTI_DUN_CALL_RELEASED:
876 dun_call_state->call_state = MFW_BT_CALL_RELEASED;
877 break;
878 case BTI_FAX_CALL_IN_PRO:
879 dun_call_state->call_state = MFW_BT_CALL_IN_PROGRESS;
880 break;
881 case BTI_FAX_CALL_ESTABLISHED:
882 dun_call_state->call_state = MFW_BT_CALL_ESTABLISHED;
883 break;
884 case BTI_FAX_CALL_HANGUP_IN_PR:
885 dun_call_state->call_state = MFW_BT_HANGUP_IN_PROGRESS;
886 break;
887 case BTI_FAX_CALL_RELEASED:
888 dun_call_state->call_state = MFW_BT_CALL_RELEASED;
889 break;
890 default:
891 break;
892 }
893 bt_signal(BT_CALL_MONITORING_STATUS, dun_call_state);
894 #ifdef _SIMULATION_
895 TRACE_EVENT_P2("dun call monit = %d %d", dun_call_state->service, dun_call_state->call_state);
896 #endif
897 MFREE(dun_call_state);
898 return TRUE;
899 case BTP_OPP_SERV_PUT_IND:
900 /* BTI indicates that a put response is needed (OPP server) */
901 MALLOC(opp_put_ind, sizeof(T_MFW_BT_OPP_PUT_IND));
902 memset(opp_put_ind, 0, sizeof(T_MFW_BT_OPP_PUT_IND));
903 opp_put_ind->service = ((T_BTP_OPP_SERV_PUT_IND *)data)->device;
904 opp_put_ind->subtype = ((T_BTP_OPP_SERV_PUT_IND *)data)->subtype;
905 memcpy(opp_put_ind->bd_addr, ((T_BTP_OPP_SERV_PUT_IND *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
906 memset(&receiv_object_name, 0, MFW_BT_OPP_OBJECT_NAME_MAX_LEN);/* limited with 256 characters */
907 memcpy(&receiv_object_name, &((T_BTP_OPP_SERV_PUT_IND *)data)->object_name, MFW_BT_OPP_OBJECT_NAME_MAX_LEN);
908 /* from string in Primitive to static buffer in MFW, pointer to MMI */
909 opp_put_ind->mfw_opp_object.mfw_object_name = receiv_object_name;
910 opp_put_ind->mfw_opp_object.mfw_object_length = ((T_BTP_OPP_SERV_PUT_IND *)data)->object_length;
911 bt_signal(BT_OPP_SERV_PUT_IND, opp_put_ind);
912 #ifdef _SIMULATION_
913 TRACE_EVENT_P3("opp put ind = %d, %d, %s", opp_put_ind->service, opp_put_ind->subtype, receiv_object_name);
914 #endif
915 MFREE(opp_put_ind);
916 return TRUE;
917 case BTP_OPP_SERV_PUT_CNF:
918 /* BTI indicates that an object push procedure is finished or cancelled */
919 MALLOC(opp_put_cnf, sizeof(T_MFW_BT_OPP_PUT_CNF));
920 memset(opp_put_cnf, 0, sizeof(T_MFW_BT_OPP_PUT_CNF));
921 opp_put_cnf->service = ((T_BTP_OPP_SERV_PUT_CNF *)data)->device;
922 opp_put_cnf->subtype = ((T_BTP_OPP_SERV_PUT_CNF *)data)->subtype;
923 memcpy(opp_put_cnf->bd_addr, ((T_BTP_OPP_SERV_PUT_CNF *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
924 opp_put_cnf->mfw_opp_object.mfw_object_type = ((T_BTP_OPP_SERV_PUT_CNF *)data)->object_type;
925 memset(&receiv_object_name, 0, MFW_BT_OPP_OBJECT_NAME_MAX_LEN);/* limited with 256 characters */
926 memcpy(&receiv_object_name, &((T_BTP_OPP_SERV_PUT_CNF *)data)->object_name, MFW_BT_OPP_OBJECT_NAME_MAX_LEN);
927 opp_put_cnf->mfw_opp_object.mfw_object_name = receiv_object_name;/* from string in Primitive to static buffer in MFW (pointer is not possible in Primitive), pointer of buffer */
928 opp_put_cnf->mfw_opp_object.mfw_object_length = ((T_BTP_OPP_SERV_PUT_CNF *)data)->object_length;
929 opp_put_cnf->error_cause = ((T_BTP_OPP_SERV_PUT_CNF *)data)->cause;
930 bt_signal(BT_OPP_SERV_PUT_CNF, opp_put_cnf);
931 #ifdef _SIMULATION_
932 TRACE_EVENT_P3("opp put cnf = %d, %d, %s", opp_put_cnf->service, opp_put_cnf->subtype, receiv_object_name);
933 #endif
934 MFREE(opp_put_cnf);
935 return TRUE;
936 case BTP_OPP_OBJECT_PUSH_CNF:
937 /* BTI indicates that an object push procedure is finished or cancelled */
938 MALLOC(opp_obj_push_cnf, sizeof(T_MFW_BT_OPP_PUSH_CNF));
939 memset(opp_obj_push_cnf, 0, sizeof(T_MFW_BT_OPP_PUSH_CNF));
940 opp_obj_push_cnf->service = ((T_BTP_OPP_OBJECT_PUSH_CNF *)data)->device;
941 opp_obj_push_cnf->subtype = ((T_BTP_OPP_OBJECT_PUSH_CNF *)data)->subtype;
942 memcpy(opp_obj_push_cnf->bd_addr, ((T_BTP_OPP_OBJECT_PUSH_CNF *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
943 opp_obj_push_cnf->mfw_opp_object.mfw_object_type = ((T_BTP_OPP_OBJECT_PUSH_CNF *)data)->object_type;
944 memset(&receiv_object_name, 0, MFW_BT_OPP_OBJECT_NAME_MAX_LEN);/* limited with 256 characters */
945 memcpy(&receiv_object_name, &((T_BTP_OPP_OBJECT_PUSH_CNF *)data)->object_name, MFW_BT_OPP_OBJECT_NAME_MAX_LEN);
946 opp_obj_push_cnf->mfw_opp_object.mfw_object_name = receiv_object_name;/* from string in Primitive to static buffer in MFW (pointer is not possible in Primitive), pointer of buffer */
947 memset(&receiv_object_mime_type, 0, MFW_BT_OPP_OBJECT_NAME_MAX_LEN);/* limited with 256 characters */
948 memcpy(&receiv_object_mime_type, &((T_BTP_OPP_OBJECT_PUSH_CNF *)data)->object_m_t, MFW_BT_OPP_OBJECT_MIME_MAX_LEN);
949 opp_obj_push_cnf->mfw_opp_object.mfw_object_mime_type = receiv_object_mime_type;/* same comment like for ...object_name */
950 opp_obj_push_cnf->mfw_opp_object.mfw_object_length = ((T_BTP_OPP_OBJECT_PUSH_CNF *)data)->object_length;
951 opp_obj_push_cnf->error_cause = ((T_BTP_OPP_OBJECT_PUSH_CNF *)data)->cause;
952 bt_signal(BT_OPP_OBJECT_PUSH_CNF, opp_obj_push_cnf);
953 #ifdef _SIMULATION_
954 TRACE_EVENT_P3("opp push cnf = %d, %d, %s", opp_obj_push_cnf->service, opp_obj_push_cnf->subtype, receiv_object_name);
955 #endif
956 MFREE(opp_obj_push_cnf);
957 return TRUE;
958 case BTP_OPP_OBJECT_PULL_CNF:
959 /* BTI indicates that an object push procedure is finished or cancelled */
960 MALLOC(opp_obj_pull_cnf, sizeof(T_MFW_BT_OPP_PULL_CNF));
961 memset(opp_obj_pull_cnf, 0, sizeof(T_MFW_BT_OPP_PULL_CNF));
962 opp_obj_pull_cnf->service = ((T_BTP_OPP_OBJECT_PULL_CNF *)data)->device;
963 opp_obj_pull_cnf->subtype = ((T_BTP_OPP_OBJECT_PULL_CNF *)data)->subtype;
964 memcpy(opp_obj_pull_cnf->bd_addr, ((T_BTP_OPP_OBJECT_PULL_CNF *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
965 opp_obj_pull_cnf->mfw_opp_object.mfw_object_type = ((T_BTP_OPP_OBJECT_PULL_CNF *)data)->object_type;
966 memset(&receiv_object_name, 0, MFW_BT_OPP_OBJECT_NAME_MAX_LEN);/* limited with 256 characters */
967 memcpy(&receiv_object_name, &((T_BTP_OPP_OBJECT_PULL_CNF *)data)->object_name, MFW_BT_OPP_OBJECT_NAME_MAX_LEN);
968 opp_obj_pull_cnf->mfw_opp_object.mfw_object_name = receiv_object_name;/* from string in Primitive to static buffer in MFW (pointer is not possible in Primitive), pointer of buffer */
969 memset(&receiv_object_mime_type, 0, MFW_BT_OPP_OBJECT_NAME_MAX_LEN);/* limited with 256 characters */
970 memcpy(&receiv_object_mime_type, &((T_BTP_OPP_OBJECT_PULL_CNF *)data)->object_m_t, MFW_BT_OPP_OBJECT_MIME_MAX_LEN);
971 opp_obj_pull_cnf->mfw_opp_object.mfw_object_mime_type = receiv_object_mime_type;/* same comment like for ...object_name */
972 opp_obj_pull_cnf->mfw_opp_object.mfw_object_length = ((T_BTP_OPP_OBJECT_PULL_CNF *)data)->object_length;
973 opp_obj_pull_cnf->error_cause = ((T_BTP_OPP_OBJECT_PULL_CNF *)data)->cause;
974 bt_signal(BT_OPP_OBJECT_PULL_CNF, opp_obj_pull_cnf);
975 #ifdef _SIMULATION_
976 TRACE_EVENT_P3("opp pull cnf = %d, %d, %s", opp_obj_pull_cnf->service, opp_obj_pull_cnf->subtype, receiv_object_name);
977 #endif
978 MFREE(opp_obj_pull_cnf);
979 return TRUE;
980 case BTP_SRV_SYNC_CNF:
981 /* BTI indicates that synchronization operation completes (initiated by client or server) */
982 MALLOC(srv_sync_cnf, sizeof(T_MFW_BT_SRV_SYNC_CNF));
983 memset(srv_sync_cnf, 0, sizeof(T_MFW_BT_SRV_SYNC_CNF));
984 srv_sync_cnf->service = ((T_BTP_SRV_SYNC_CNF *)data)->device;
985 srv_sync_cnf->subtype = ((T_BTP_SRV_SYNC_CNF *)data)->subtype;
986 memcpy(srv_sync_cnf->mfw_client_bd_addr, ((T_BTP_SRV_SYNC_CNF *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
987 memcpy(srv_sync_cnf->mfw_client_name, ((T_BTP_SRV_SYNC_CNF *)data)->bd_name, MFW_BT_NAME_MAX_LEN);
988 srv_sync_cnf->mfw_error_state = ((T_BTP_SRV_SYNC_CNF *)data)->cause;
989 bt_signal(BT_SRV_SYNC_CNF, srv_sync_cnf);
990 MFREE(srv_sync_cnf);
991 return TRUE;
992 case BTP_SRV_SYNC_AUTH_IND:
993 /* BTI indicates that synchronization operation completes (initiated by client or server) */
994 MALLOC(srv_sync_auth, sizeof(T_MFW_BT_SRV_SYNC_AUTH_IND));
995 memset(srv_sync_auth, 0, sizeof(T_MFW_BT_SRV_SYNC_AUTH_IND));
996 srv_sync_auth->service = ((T_BTP_SRV_SYNC_AUTH_IND *)data)->device;
997 srv_sync_auth->subtype = ((T_BTP_SRV_SYNC_AUTH_IND *)data)->subtype;
998 memcpy(srv_sync_auth->mfw_client_bd_addr, ((T_BTP_SRV_SYNC_AUTH_IND *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
999 memcpy(srv_sync_auth->mfw_client_name, ((T_BTP_SRV_SYNC_AUTH_IND *)data)->bd_name, MFW_BT_NAME_MAX_LEN);
1000 bt_signal(BT_SRV_SYNC_AUTH_IND, srv_sync_auth);
1001 #ifdef _SIMULATION_
1002 TRACE_EVENT_P3("sync auth ind = %d, %d, %s", srv_sync_auth->service, srv_sync_auth->subtype, srv_sync_auth->mfw_client_bd_addr);
1003 #endif
1004 MFREE(srv_sync_auth);
1005 return TRUE;
1006 case BTP_SRV_SYNC_PULL_IND:
1007 /* BTI indicates that the client requests to pull an object from the sync server */
1008 MALLOC(srv_sync_pull_ind, sizeof(T_MFW_BT_SRV_SYNC_PULL_IND));
1009 memset(srv_sync_pull_ind, 0, sizeof(T_MFW_BT_SRV_SYNC_PULL_IND));
1010 srv_sync_pull_ind->service = ((T_BTP_SRV_SYNC_PULL_IND *)data)->device;
1011 srv_sync_pull_ind->subtype = ((T_BTP_SRV_SYNC_PULL_IND *)data)->subtype;
1012 memcpy(srv_sync_pull_ind->mfw_client_bd_addr, ((T_BTP_SRV_SYNC_PULL_IND *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
1013 srv_sync_pull_ind->mfw_object_id.mfw_object_size = ((T_BTP_SRV_SYNC_PULL_IND *)data)->object_id_size;
1014 memset(&sync_object_location_id, 0, MFW_BT_SYNC_OBJECT_IDENTIFIER);/* limited with 256 characters */
1015 memcpy(&sync_object_location_id, &((T_BTP_SRV_SYNC_PULL_IND *)data)->object_id_loc, MFW_BT_SYNC_OBJECT_IDENTIFIER);
1016 srv_sync_pull_ind->mfw_object_id.mfw_location = sync_object_location_id;/* from string in Primitive to static buffer in MFW (pointer is not possible in Primitive), pointer of buffer */
1017 bt_signal(BT_SRV_SYNC_PULL_IND, srv_sync_pull_ind);
1018 #ifdef _SIMULATION_
1019 TRACE_EVENT_P3("sync pull ind = %d, %d, %d", srv_sync_pull_ind->service, srv_sync_pull_ind->subtype, srv_sync_pull_ind->mfw_object_id.mfw_object_size);
1020 #endif
1021 MFREE(srv_sync_pull_ind);
1022 return TRUE;
1023 case BTP_SRV_SYNC_PUSH_IND:
1024 /* BTI indicates that the client requests to pull an object from the sync server */
1025 MALLOC(srv_sync_push_ind, sizeof(T_MFW_BT_SRV_SYNC_PUSH_IND));
1026 memset(srv_sync_push_ind, 0, sizeof(T_MFW_BT_SRV_SYNC_PUSH_IND));
1027 srv_sync_push_ind->service = ((T_BTP_SRV_SYNC_PUSH_IND *)data)->device;
1028 srv_sync_push_ind->subtype = ((T_BTP_SRV_SYNC_PUSH_IND *)data)->subtype;
1029 memcpy(srv_sync_push_ind->mfw_client_bd_addr, ((T_BTP_SRV_SYNC_PUSH_IND *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
1030 srv_sync_push_ind->mfw_object_id.mfw_object_size = ((T_BTP_SRV_SYNC_PUSH_IND *)data)->object_id_size;
1031 memset(&sync_object_location_id, 0, MFW_BT_SYNC_OBJECT_IDENTIFIER);/* limited with 256 characters */
1032 memcpy(&sync_object_location_id, &((T_BTP_SRV_SYNC_PUSH_IND *)data)->object_id_loc, MFW_BT_SYNC_OBJECT_IDENTIFIER);
1033 srv_sync_push_ind->mfw_object_id.mfw_location = sync_object_location_id;/* from string in Primitive to static buffer in MFW (pointer is not possible in Primitive), pointer of buffer */
1034 bt_signal(BT_SRV_SYNC_PUSH_IND, srv_sync_push_ind);
1035 #ifdef _SIMULATION_
1036 TRACE_EVENT_P3("sync push ind = %d, %d, %d", srv_sync_push_ind->service, srv_sync_push_ind->subtype, srv_sync_push_ind->mfw_object_id.mfw_object_size);
1037 #endif
1038 MFREE(srv_sync_push_ind);
1039 return TRUE;
1040 case BTP_SRV_SYNC_PUSH_CNF:
1041 /* BTI indicates that the client requests to pull an object from the sync server */
1042 MALLOC(srv_sync_push_cnf, sizeof(T_MFW_BT_SRV_SYNC_PUSH_CNF));
1043 memset(srv_sync_push_cnf, 0, sizeof(T_MFW_BT_SRV_SYNC_PUSH_CNF));
1044 srv_sync_push_cnf->service = ((T_BTP_SRV_SYNC_PUSH_CNF *)data)->device;
1045 srv_sync_push_cnf->subtype = ((T_BTP_SRV_SYNC_PUSH_CNF *)data)->subtype;
1046 memcpy(srv_sync_push_cnf->mfw_client_bd_addr, ((T_BTP_SRV_SYNC_PUSH_CNF *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
1047 srv_sync_push_cnf->mfw_object.mfw_object_type = ((T_BTP_SRV_SYNC_PUSH_CNF *)data)->object_type;
1048 memset(&sync_object_name, 0, MFW_BT_OPP_OBJECT_NAME_MAX_LEN);/* limited with 256 characters */
1049 memcpy(&sync_object_name, &((T_BTP_SRV_SYNC_PUSH_CNF *)data)->object_name, MFW_BT_OPP_OBJECT_NAME_MAX_LEN);
1050 srv_sync_push_cnf->mfw_object.mfw_object_name = sync_object_name;/* from string in Primitive to static buffer in MFW (pointer is not possible in Primitive), pointer of buffer */
1051 memset(&receiv_sync_object_mime_type, 0, MFW_BT_OPP_OBJECT_NAME_MAX_LEN);/* limited with 256 characters */
1052 memcpy(&receiv_sync_object_mime_type, &((T_BTP_SRV_SYNC_PUSH_CNF *)data)->object_m_t, MFW_BT_OPP_OBJECT_MIME_MAX_LEN);
1053 srv_sync_push_cnf->mfw_object.mfw_object_mime_type = receiv_sync_object_mime_type;/* same comment like for ...object_name */
1054 srv_sync_push_cnf->mfw_object.mfw_object_length = ((T_BTP_SRV_SYNC_PUSH_CNF *)data)->object_length;
1055 srv_sync_push_cnf->mfw_object_id.mfw_object_size = ((T_BTP_SRV_SYNC_PUSH_CNF *)data)->object_id_size;
1056 memset(&sync_object_location_id, 0, MFW_BT_SYNC_OBJECT_IDENTIFIER);/* limited with 256 characters */
1057 memcpy(&sync_object_location_id, &((T_BTP_SRV_SYNC_PUSH_CNF *)data)->object_id_loc, MFW_BT_SYNC_OBJECT_IDENTIFIER);
1058 srv_sync_push_cnf->mfw_object_id.mfw_location = sync_object_location_id;/* from string in Primitive to static buffer in MFW (pointer is not possible in Primitive), pointer of buffer */
1059 bt_signal(BT_SRV_SYNC_PUSH_CNF, srv_sync_push_cnf);
1060 #ifdef _SIMULATION_
1061 TRACE_EVENT_P3("sync push cnf = %d, %d, %s", srv_sync_push_cnf->service, srv_sync_push_cnf->subtype, srv_sync_push_cnf->mfw_client_bd_addr);
1062 #endif
1063 MFREE(srv_sync_push_cnf);
1064 return TRUE;
1065
1066 case BTP_CONNECT_DEVICE_INF:
1067 /* BTI indicates that hsg manages a connection on RFCOMM level */
1068 MALLOC(connect_inf, sizeof(T_MFW_BT_CONNECT_INF));
1069 memset(connect_inf, 0, sizeof(T_MFW_BT_CONNECT_INF));
1070 connect_inf->service = ((T_BTP_CONNECT_DEVICE_INF *)data)->device;
1071 connect_inf->ind_id = ((T_BTP_CONNECT_DEVICE_INF *)data)->ind_id;
1072
1073 if(connect_inf->ind_id EQ MFW_BT_INVALID_HEADSET_ID)
1074 {
1075 memcpy(connect_inf->bd_addr, ((T_BTP_CONNECT_DEVICE_INF *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
1076 }
1077 bt_signal(BT_CONNECT_DEVICE_INF, connect_inf);
1078 #ifdef _SIMULATION_
1079 TRACE_EVENT_P3("conn inf = %d %d %s", connect_inf->service, connect_inf->ind_id, connect_inf->bd_addr);
1080 #endif
1081 MFREE(connect_inf);
1082 return TRUE;
1083
1084 /* BT CTRL */
1085 case BTP_CHNG_LOCAL_NAME:
1086 MALLOC(c_loc_name, sizeof(T_MFW_BT_CHNG_LOCAL_NAME));
1087 c_loc_name->success = ((T_BTP_CHNG_LOCAL_NAME *)data)->success;
1088 bt_signal(BT_CHNG_LOCAL_NAME, c_loc_name);
1089 MFREE(c_loc_name);
1090 return TRUE;
1091
1092 case BTP_READ_LOCAL_NAME:
1093 MALLOC(r_loc_name, sizeof(T_MFW_BT_READ_LOCAL_NAME));
1094 r_loc_name->success = ((T_BTP_READ_LOCAL_NAME *)data)->success;
1095 memcpy(r_loc_name->bd_name, ((T_BTP_READ_LOCAL_NAME *)data)->bd_name, MFW_BT_NAME_MAX_LEN);
1096 bt_signal(BT_READ_LOCAL_NAME, r_loc_name);
1097 MFREE(r_loc_name);
1098 return TRUE;
1099
1100 case BTP_REMOTE_DEV_INFO_RES:
1101 MALLOC(rem_dev_info, sizeof(T_MFW_BT_REMOTE_DEV_INFO_RES));
1102 rem_dev_info->success = ((T_BTP_REMOTE_DEV_INFO_RES *)data)->success;
1103 memcpy(rem_dev_info->bd_addr, ((T_BTP_REMOTE_DEV_INFO_RES *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
1104 memcpy(rem_dev_info->bd_name, ((T_BTP_REMOTE_DEV_INFO_RES *)data)->bd_name, MFW_BT_NAME_MAX_LEN);
1105 memcpy(rem_dev_info->cod, ((T_BTP_REMOTE_DEV_INFO_RES *)data)->cod, MFW_BT_DEVICE_CLASS_LEN);
1106
1107 bt_signal(BT_REMOTE_DEV_INFO_RES, rem_dev_info);
1108 MFREE(rem_dev_info);
1109 return TRUE;
1110
1111 case BTP_CHNG_CONNECTABLE_MODE:
1112 MALLOC(chng_cmode, sizeof(T_MFW_BT_CHNG_CONNECTABLE_MODE));
1113 chng_cmode->success = ((T_BTP_CHNG_CONNECTABLE_MODE *)data)->success;
1114 chng_cmode->mode = (T_MFW_BT_CONNECTABLE_MODE)((T_BTP_CHNG_CONNECTABLE_MODE *)data)->mode;
1115 chng_cmode->scan_interval = ((T_BTP_CHNG_CONNECTABLE_MODE *)data)->scan_interval;
1116 chng_cmode->scan_window = ((T_BTP_CHNG_CONNECTABLE_MODE *)data)->scan_window;
1117
1118 bt_signal(BT_CHNG_CONNECTABLE_MODE, chng_cmode);
1119 MFREE(chng_cmode);
1120 return TRUE;
1121
1122 case BTP_CHNG_DISCOVERABLE_MODE:
1123 MALLOC(chng_dmode, sizeof(T_MFW_BT_CHNG_DISCOVERABLE_MODE));
1124 chng_dmode->success = ((T_BTP_CHNG_DISCOVERABLE_MODE *)data)->success;
1125 chng_dmode->mode = (T_MFW_BT_DISCOVERABLE_MODE)((T_BTP_CHNG_DISCOVERABLE_MODE *)data)->mode;
1126 chng_dmode->scan_interval = ((T_BTP_CHNG_DISCOVERABLE_MODE *)data)->scan_interval;
1127 chng_dmode->scan_window = ((T_BTP_CHNG_DISCOVERABLE_MODE *)data)->scan_window;
1128
1129 bt_signal(BT_CHNG_DISCOVERABLE_MODE, chng_dmode);
1130 MFREE(chng_dmode);
1131 return TRUE;
1132
1133 case BTP_READ_BD_ADDR:
1134 MALLOC(r_bd_addr, sizeof(T_MFW_BT_READ_BD_ADDR));
1135 r_bd_addr->success = ((T_BTP_READ_BD_ADDR *)data)->success;
1136 memcpy(r_bd_addr->bd_addr, ((T_BTP_READ_BD_ADDR *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
1137 bt_signal(BT_READ_BD_ADDR, r_bd_addr);
1138 MFREE(r_bd_addr);
1139 return TRUE;
1140
1141 /*#ifdef PCA_6350*/
1142 case BTP_PCA_EVENT:
1143 if (((T_BTP_PCA_EVENT*)data)->pca_event == BTI_PCA_GW_STATUS_CFM)
1144 {
1145 MALLOC(pca_gw_status, sizeof(T_MFW_BT_PCA_GW_STATUS_CFM));
1146 pca_gw_status->status = ((T_BTP_PCA_EVENT*)data)->pca_gw_status;
1147 bt_signal(BT_PCA_GW_STATUS_CFM, pca_gw_status);
1148 return TRUE;
1149 }
1150
1151 if (((T_BTP_PCA_EVENT*)data)->pca_event == BTI_PCA_GW_LINK_MONITORING)
1152 {
1153 MALLOC(pca_link_mon, sizeof(T_MFW_BT_PCA_GW_LINK_MONITORING));
1154 pca_link_mon->link_status = ((T_BTP_PCA_EVENT*)data)->pca_link_status;
1155 memcpy(pca_link_mon->bd_addr, ((T_BTP_PCA_EVENT *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
1156 bt_signal(BT_PCA_GW_LINK_MONITORING, pca_link_mon);
1157 return TRUE;
1158 }
1159
1160 if (((T_BTP_PCA_EVENT*)data)->pca_event == BTI_PCA_GW_CALL_MONITORING)
1161 {
1162 MALLOC(pca_call_mon, sizeof(T_MFW_BT_PCA_GW_CALL_MONITORING));
1163 pca_call_mon->call_status = ((T_BTP_PCA_EVENT*)data)->pca_call_status;
1164 bt_signal(BT_PCA_GW_CALL_MONITORING, pca_call_mon);
1165 return TRUE;
1166 }
1167
1168 if (((T_BTP_PCA_EVENT*)data)->pca_event == BTI_PCA_GW_HANGUP_CFM)
1169 {
1170 MALLOC(pca_hangup, sizeof(T_MFW_BT_PCA_GW_HANGUP_CFM));
1171 pca_hangup->hangup = ((T_BTP_PCA_EVENT*)data)->pca_hangup;
1172 bt_signal(BT_PCA_GW_HANGUP_CFM, pca_hangup);
1173 return TRUE;
1174 }
1175
1176 /* Cartman added begin */
1177
1178 case BTP_HSG_HEADSET_CONNECTION_IND:
1179 MALLOC(hsg_headset_connection_ind, sizeof(T_MFW_BT_HSG_HEADSET_CONNECTION_IND));
1180 memset(hsg_headset_connection_ind, 0, sizeof(T_MFW_BT_HSG_HEADSET_CONNECTION_IND));
1181
1182 hsg_headset_connection_ind->service = ((T_BTP_HSG_HEADSET_CONNECTION_IND *)data)->device;
1183 hsg_headset_connection_ind->ind_id = ((T_BTP_HSG_HEADSET_CONNECTION_IND *)data)->ind_id;
1184 memcpy(hsg_headset_connection_ind->bd_addr, ((T_BTP_HSG_HEADSET_CONNECTION_IND *)data)->bd_addr, MFW_BT_ADDR_MAX_LEN);
1185
1186 bt_signal(BT_HSG_HEADSET_CONNECTION_IND, hsg_headset_connection_ind);
1187 return TRUE;
1188
1189 case BTP_HSG_SPECIFIC_CMD_RDY:
1190 MALLOC(hsg_specific_cmd_cfm, sizeof(T_MFW_BT_HSG_SPECIFIC_CMD_CFM));
1191
1192 memcpy(hsg_specific_cmd_cfm->cmd,((T_BTP_HSG_SPECIFIC_CMD_RDY *)data)->cmd,100);
1193
1194 bt_signal(BT_HSG_SPECIFIC_CMD_CFM,hsg_specific_cmd_cfm);
1195 return TRUE;
1196
1197 case BTP_HSG_SAVE_LIST_CNF:
1198 MALLOC(hsg_save_list_cnf, sizeof(T_MFW_BT_HSG_SAVE_LIST_CNF));
1199 hsg_save_list_cnf->result=((T_BTP_HSG_SAVE_LIST_CNF *)data)->result;
1200
1201 bt_signal(BT_HSG_SAVE_LIST_CNF,hsg_save_list_cnf);
1202 return TRUE;
1203
1204 /* Cartman added end */
1205
1206 /*#endif*/ /* PCA_6350 */
1207 }
1208
1209 #ifdef _SIMULATION_
1210 /*
1211 * kk 12.01.01
1212 * these primitives are available only for testing. they describe
1213 * function calls (loopbacked to ACI/MFW) made from MFW
1214 */
1215
1216 switch ((USHORT) opc)
1217 {
1218 case BTP_INIT_PROFILE_REQ:
1219 TRACE_EVENT("bta_response_cb:BTP_INIT_PROFILE_REQ");
1220 return TRUE;
1221
1222 case BTP_DEINIT_PROFILE_REQ:
1223 TRACE_EVENT("bta_response_cb:BTP_DEINIT_PROFILE_REQ");
1224 return TRUE;
1225
1226 case BTP_DEVICE_SEARCH_REQ:
1227 TRACE_EVENT("bta_response_cb:BTP_DEVICE_SEARCH_REQ");
1228 return TRUE;
1229
1230 case BTP_CONNECT_DEVICE_REQ:
1231 TRACE_EVENT("bta_response_cb:BTP_CONNECT_DEVICE_REQ");
1232 return TRUE;
1233
1234 case BTP_CONNECT_DEVICE_RES:
1235 TRACE_EVENT("bta_response_cb:BTP_CONNECT_DEVICE_RES");
1236 return TRUE;
1237
1238 case BTP_DISCONNECT_DEVICE_REQ:
1239 TRACE_EVENT("bta_response_cb:BTP_DISCONNECT_DEVICE_REQ");
1240 return TRUE;
1241
1242 case BTP_TRANSFER_AUDIO_IN_REQ:
1243 TRACE_EVENT("bta_response_cb:BTP_TRANSFER_AUDIO_IN_REQ");
1244 return TRUE;
1245
1246 case BTP_TRANSFER_AUDIO_OUT_REQ:
1247 TRACE_EVENT("bta_response_cb:BTP_TRANSFER_AUDIO_OUT_REQ");
1248 return TRUE;
1249
1250 case BTP_RECONFIG_PROFILE_REQ:
1251 TRACE_EVENT("bta_response_cb:BTP_RECONFIG_PROFILE_REQ");
1252 return TRUE;
1253
1254 case BTI_SEND_DATA_TEST:
1255 TRACE_EVENT("BTI_SEND_DATA_TEST");
1256 {
1257 UBYTE buf[2048];
1258 memset(buf, 0, 2048);
1259 memcpy(buf, ((T_BTI_SEND_DATA_TEST *)data)->ind_data, ((T_BTI_SEND_DATA_TEST *)data)->len);
1260
1261 bti_simulate_dti_data_ind(((T_BTI_SEND_DATA_TEST *)data)->port_nb, ((T_BTI_SEND_DATA_TEST *)data)->len, buf);
1262 }
1263 return TRUE;
1264
1265 case BTI_GET_DATA_TEST:
1266 TRACE_EVENT("BTI_GET_DATA_TEST");
1267 {
1268 UBYTE buf[2048];
1269 memset(buf, 0, 2048);
1270 memcpy(buf, ((T_BTI_GET_DATA_TEST *)data)->ind_data, ((T_BTI_GET_DATA_TEST *)data)->len);
1271
1272 bti_simulate_data_bt_to_gsm(((T_BTI_GET_DATA_TEST *)data)->port_nb, ((T_BTI_GET_DATA_TEST *)data)->len, buf);
1273 }
1274 return TRUE;
1275 /* for test bluetooth without BMI/MMI ******************************************/
1276 case BTP_SRV_SYNC_TEST:/* test SYNC profile */
1277 TRACE_EVENT("bta_response_cb:BTP_SRV_SYNC_TEST");
1278 switch(((T_BTP_SRV_SYNC_TEST *)data)->func_id)
1279 {
1280 case 1:/* start bluetooth primitive SYN_SERVER_SYNC_COMPLETE */
1281 bti_syn_server_sync_compl();
1282 break;
1283 case 2: /* start bluetooth function syn_server_sync_termination() */
1284 service = MFW_BT_SYNC;
1285 subtyp = MFW_BT_SERVER;
1286 if(bt_syn_s_sync_terminate(service, subtyp) NEQ MFW_BT_OK)
1287 {
1288 TRACE_EVENT("mfw_bta:sync termination Failure");
1289 }
1290 else
1291 TRACE_EVENT("sync termination ok");
1292 break;
1293 case 3: /* start bluetooth function syn_server_get_response() */
1294 memset(&syn_pull_obj, 0, sizeof(syn_pull_obj));
1295 memset(&server_syn_object, 0, MFW_BT_OPP_BUFFER_LENGTH);
1296 service = MFW_BT_SYNC;
1297 subtyp = MFW_BT_SERVER;
1298 syn_pull_obj.mfw_buffer_start = server_syn_object;
1299 syn_pull_obj.mfw_buffer_size = sizeof(&server_syn_object);
1300 syn_pull_obj.mfw_object_type = MFW_BT_BUFFER;/* store pulled object in buffer */
1301 syn_pull_obj.mfw_path = NULL;
1302 syn_pull_obj.mfw_object_length = sizeof(&server_syn_object);
1303 syn_pull_obj.mfw_object_mime_type = NULL;/* MIME directory information only for object_type: MFW_BT_PATH */
1304
1305 if(bt_syn_s_pull_resp(service, subtyp, syn_pull_obj) NEQ MFW_BT_OK)
1306 {
1307 TRACE_EVENT("mfw_bta:sync pull response Failure");
1308 }
1309 else
1310 TRACE_EVENT("sync pull response ok");
1311 break;
1312 case 4:/* start bluetooth primitive SYN_SERVER_PUT_REQUEST with TRACE_EVENT in mfw_bta */
1313 bti_sync_put_req();
1314 break;
1315 case 5:/* start bluetooth primitive SYN_SERVER_PUT_CFM with TRACE_EVENT in mfw_bta */
1316 bti_syn_server_put_confirm();
1317 break;
1318 case 6:/* start bluetooth primitive SYN_SERVER_GET_REQUEST with TRACE_EVENT in mfw_bta */
1319 bti_sync_get_req();
1320 break;
1321 case 7:/* start bluetooth primitive SYN_SERVER_AUTHENTICATION_REQUEST with TRACE_EVENT in mfw_bta */
1322 bti_sync_auth_req();
1323 break;
1324 case 8:/* start bluetooth primitive SYN_SERVER_CLIENT_IS_CONNECTED with TRACE_EVENT in mfw_bta */
1325 bti_sync_client_con_ind();
1326 break;
1327 case 9: /* start bluetooth function syn_server_put_response() */
1328 memset(&syn_push_obj, 0, sizeof(syn_push_obj));
1329 memset(&server_syn_object, 0, MFW_BT_OPP_BUFFER_LENGTH);
1330 service = MFW_BT_SYNC;
1331 subtyp = MFW_BT_SERVER;
1332 syn_push_obj.mfw_buffer_start = server_syn_object;
1333 syn_push_obj.mfw_buffer_size = sizeof(&server_syn_object);
1334 syn_push_obj.mfw_object_type = MFW_BT_BUFFER;/* store pushed object in buffer */
1335 syn_push_obj.mfw_path = NULL;
1336 syn_push_obj.mfw_object_length = sizeof(&server_syn_object);
1337 syn_push_obj.mfw_object_mime_type = NULL;/* MIME directory information only for object_type: MFW_BT_PATH */
1338
1339 if(bt_syn_s_push_resp(service, subtyp, syn_push_obj) NEQ MFW_BT_EXECUTE)
1340 {
1341 TRACE_EVENT("mfw_bta:sync push response Failure");
1342 }
1343 else
1344 TRACE_EVENT("sync push response ok");
1345 break;
1346 case 10: /* start bluetooth function syn_server_authentication_response() */
1347 memset(mfw_sync_password, 0, MFW_BT_PIN_MAX_LEN);
1348 service = MFW_BT_SYNC;
1349 subtyp = MFW_BT_SERVER;
1350 for(j=0;j<10;j++)
1351 mfw_sync_password[j] = j | 0x30;
1352 mfw_sync_password_ptr = &mfw_sync_password[0];
1353 if(bt_syn_s_auth_res(service, subtyp, mfw_sync_password_ptr) NEQ MFW_BT_OK)
1354 {
1355 TRACE_EVENT("mfw_bta:sync authentication response Failure");
1356 }
1357 else
1358 TRACE_EVENT("sync authentication response ok");
1359 break;
1360 case 11: /* start bluetooth function syn_server_send_sync_command() */
1361 service = MFW_BT_SYNC;
1362 subtyp = MFW_BT_SERVER;
1363 mfw_obj = mfw_test_syn_obj;/* object which will be supposed to be synchronized */
1364 mfw_syn_action = MFW_BT_SYNC_CO_SYNC; /* request synchronization by specified SYNC client */
1365 /* specified client address by browsing SYNC Server with SYNC command support */
1366 memset(&client_address, 0xdd, MFW_BT_ADDR_MAX_LEN);/* example */
1367 if(bt_syn_s_send_com(service, subtyp, mfw_syn_action, mfw_obj, client_address) NEQ MFW_BT_EXECUTE)
1368 {
1369 TRACE_EVENT("mfw_bta:sync server send command Failure");
1370 }
1371 else
1372 TRACE_EVENT("sync server send command ok");
1373 break;
1374 case 12: /* start bluetooth function syn_server_enable() */
1375 /* receive bluetooth primitive BTP_INIT_PROFILE_CNF in BTI */
1376 memset(&syn_serv_config, 0, sizeof(syn_serv_config));
1377 service = MFW_BT_SYNC;
1378 mfw_obj_list.object_store = mfw_test_syn_obj;
1379 mfw_obj_list.next_object = NULL;
1380 mfw_obj_list_ptr = &mfw_obj_list;
1381 service = MFW_BT_SYNC;
1382 subtyp = MFW_BT_SERVER;
1383 /* default value SYNC server mode */
1384 syn_serv_config.mfw_syn_srv_mode = MFW_BT_SYNC_GEN_MODE;
1385 /* default value SYNC server authentication mode */
1386 syn_serv_config.mfw_syn_srv_auth_mode = MFW_BT_SYNC_INIT_AUTH_MODE;
1387 if(bt_init_profile_syn_s(service, subtyp, mfw_obj_list_ptr, syn_serv_config) NEQ MFW_BT_EXECUTE)
1388 {
1389 TRACE_EVENT("mfw_bta:sync server enable Failure");
1390 }
1391 else
1392 TRACE_EVENT("sync server enable ok");
1393 break;
1394 case 13: /* start bluetooth SYNC server application function rvm_start_application() and syn_server_enable() */
1395 /* receive bluetooth primitive SYN_SERVER_CFM in BTI */
1396 service = MFW_BT_SYNC;
1397 if(bt_start_profile_application((T_BTI_DEVICE_TYPE)service) NEQ MFW_BT_OK)
1398 {
1399 TRACE_EVENT("mfw_bta:sync server start and enable Failure");
1400 }
1401 else
1402 TRACE_EVENT("sync server start and enable ok");
1403 break;
1404 case 14: /* start bluetooth function syn_server_disable() */
1405 /* receive bluetooth primitive SYN_SERVER_CFM in BTI */
1406 service = MFW_BT_SYNC;
1407 subtyp = MFW_BT_SERVER;
1408 if(bt_deinit_profile(service, subtyp) NEQ MFW_BT_EXECUTE)
1409 {
1410 TRACE_EVENT("mfw_bta:sync server disable Failure");
1411 }
1412 else
1413 TRACE_EVENT("sync server disable ok");
1414 break;
1415 case 15: /* start bluetooth function syn_server_enable() */
1416 /* receive bluetooth primitive SYN_SERVER_CFM in BTI */
1417 memset(&syn_serv_config, 0, sizeof(syn_serv_config));
1418 service = MFW_BT_SYNC;
1419 subtyp = MFW_BT_SERVER;
1420 mfw_obj_list.object_store = mfw_test_syn_obj;
1421 mfw_obj_list1.object_store = mfw_test_syn_obj;
1422 mfw_obj_list_ptr1 = &mfw_obj_list1;
1423 mfw_obj_list.next_object = mfw_obj_list_ptr1;
1424 mfw_obj_list1.next_object = NULL;
1425 mfw_obj_list_ptr = &mfw_obj_list;
1426 syn_serv_config.mfw_syn_srv_mode = MFW_BT_SYNC_INIT_MODE;/* change in test is not possible that means it is not changed in call back func */
1427 syn_serv_config.mfw_syn_srv_auth_mode = MFW_BT_SYNC_NO_INIT_AUTH_MODE;/* change in test is not possible that means it is not changed in call back func */
1428 if(bt_reconf_profile_syn_s(service, subtyp, mfw_obj_list_ptr1, syn_serv_config) NEQ MFW_BT_EXECUTE)
1429 {
1430 TRACE_EVENT("mfw_bta:sync server reconfiguration Failure");
1431 }
1432 else
1433 TRACE_EVENT("sync server reconfiguration ok");
1434 break;
1435 case 16: /* start bluetooth SYNC server application function syn_server_disable() and rvm_stop_application()*/
1436 service = MFW_BT_SYNC;
1437 subtyp = MFW_BT_SERVER;
1438 if(bt_stop_profile_application(service, subtyp) NEQ MFW_BT_EXECUTE)
1439 {
1440 TRACE_EVENT("mfw_bta:sync server disable and stop application Failure");
1441 }
1442 else
1443 TRACE_EVENT("sync server disable and stop application ok");
1444 break;
1445 case 17: /* start bluetooth function bmi_service_browse() for sync client with SYNC command support*/
1446 service = MFW_BT_SYNC_CMD;
1447 if(bt_service_search(service) NEQ MFW_BT_EXECUTE)
1448 {
1449 TRACE_EVENT("mfw_bta:sync search sync client Failure");
1450 }
1451 else
1452 TRACE_EVENT("sync search sync client ok");
1453 break;
1454 case 18: /* start mfw function bt_clear_list_found_serv() of found sync */
1455 service = MFW_BT_SYNC_CMD;
1456 if(bt_clear_list_found_serv(service) NEQ MFW_BT_RET_OK)
1457 {
1458 TRACE_EVENT("mfw_bta:sync list del Failure");
1459 }
1460 else
1461 TRACE_EVENT("sync list del ok");
1462 break;
1463 }
1464 return TRUE;
1465 case BTP_SRV_OPP_TEST:/* test OPP profile, server */
1466 TRACE_EVENT("bta_response_cb:BTP_SRV_OPP_TEST");
1467 switch(((T_BTP_SRV_OPP_TEST *)data)->func_id)
1468 {
1469 case 1: /* start bluetooth OPP server and client application function
1470 rvm_start_application() and opp_server_enable() and opp_client_enable() */
1471 /* receive bluetooth primitive OPP_SERVER_CFM/OPP_CLIENT_CFM in BTI*/
1472 service = MFW_BT_OPP;
1473 if(bt_start_profile_application((T_BTI_DEVICE_TYPE)service) NEQ MFW_BT_OK)
1474 {
1475 TRACE_EVENT("mfw_bta:opp client + server start and enable Failure");
1476 }
1477 else
1478 TRACE_EVENT("opp client + server start and enable ok");
1479 break;
1480 case 2: /* start bluetooth OPP server application function opp_server_enable()*/
1481 /* receive bluetooth primitive OPP_SERVER_CFM in BTI */
1482 /* initialize opp server */
1483 memset(&serv_config, 0, sizeof(serv_config));
1484 subtyp = MFW_BT_SERVER;
1485 service = MFW_BT_OPP;
1486 /* example for default business card;mfw_path and mime_type parameters are NULL because
1487 mode MFW_BT_OPP_BUFFER_MODE */
1488 serv_config.mfw_opp_mode = MFW_BT_OPP_BUFFER_MODE;/* OPP server mode */
1489 serv_config.mfw_inbox_path = NULL;/* not use file system currently */
1490 serv_config.mfw_opp_object.mfw_object_type = MFW_BT_BUFFER;/* server_business_card in buffer */
1491 serv_config.mfw_opp_object.mfw_buffer_start = server_business_card;
1492 serv_config.mfw_opp_object.mfw_buffer_size = sizeof(&server_business_card);
1493 serv_config.mfw_opp_object.mfw_object_name = server_default_name;
1494 serv_config.mfw_opp_object.mfw_object_length = sizeof(server_business_card);
1495 serv_config.mfw_opp_object.mfw_path = NULL;
1496 serv_config.mfw_opp_object.mfw_object_mime_type = NULL;/* MIME directory information only for object_type: MFW_BT_PATH */
1497
1498 if(bt_init_profile_opp(service, subtyp, serv_config) NEQ MFW_BT_EXECUTE)
1499 {
1500 TRACE_EVENT("mfw_bta:opp server initialize Failure");
1501 }
1502 else
1503 TRACE_EVENT("opp server initialize ok");
1504 break;
1505 case 3: /* start bluetooth function opp_server_disable() */
1506 /* receive bluetooth primitive OPP_SERVER_CFM in BTI */
1507 subtyp = MFW_BT_SERVER;
1508 service = MFW_BT_OPP;
1509 if(bt_deinit_profile(service, subtyp) NEQ MFW_BT_EXECUTE)
1510 {
1511 TRACE_EVENT("mfw_bta:opp server disable Failure");
1512 }
1513 else
1514 TRACE_EVENT("opp server disable ok");
1515 break;
1516 case 4: /* start bluetooth OPP server application function opp_server_enable()*/
1517 /* receive bluetooth primitive OPP_SERVER_CFM in BTI */
1518 /* reconfigure opp server */
1519 memset(&serv_config, 0, sizeof(serv_config));
1520 subtyp = MFW_BT_SERVER;
1521 service = MFW_BT_OPP;
1522 /* example for default business card;mfw_path and mime_type parameters are NULL because
1523 mode MFW_BT_OPP_BUFFER_MODE */
1524 serv_config.mfw_opp_mode = MFW_BT_OPP_BUFFER_MODE;/* OPP server mode */
1525 serv_config.mfw_inbox_path = NULL;/* not use file system currently */
1526 serv_config.mfw_opp_object.mfw_object_type = MFW_BT_BUFFER;/* bmi_server_business_card in buffer */
1527 serv_config.mfw_opp_object.mfw_buffer_start = server_business_card;
1528 serv_config.mfw_opp_object.mfw_buffer_size = sizeof(&server_business_card);
1529 serv_config.mfw_opp_object.mfw_object_name = server_default_name;
1530 serv_config.mfw_opp_object.mfw_path = NULL;
1531 serv_config.mfw_opp_object.mfw_object_mime_type = NULL;/* MIME directory information only for object_type: MFW_BT_PATH */
1532 serv_config.mfw_opp_object.mfw_object_length = sizeof(server_business_card);
1533
1534 if(bt_reconf_profile_opp(service, subtyp, serv_config) NEQ MFW_BT_EXECUTE)
1535 {
1536 TRACE_EVENT("mfw_bta:opp server reconfigure Failure");
1537 }
1538 else
1539 TRACE_EVENT("opp server reconfigure ok");
1540 break;
1541 case 5: /* start bluetooth OPP server application function opp_server_disable() and rvm_stop_application()*/
1542 service = MFW_BT_OPP;
1543 subtyp = MFW_BT_SERVER;
1544 if(bt_stop_profile_application(service, subtyp) NEQ MFW_BT_EXECUTE)
1545 {
1546 TRACE_EVENT("mfw_bta:opp server disable and stop application Failure");
1547 }
1548 else
1549 TRACE_EVENT("opp server disable and stop application ok");
1550 break;
1551 case 6: /* start bluetooth OPP server application function opp_server_put_response()*/
1552 /* reply to OPP_SERVER_PUT_REQUEST of remote opp client(about server)*/
1553 service = MFW_BT_OPP;
1554 subtyp = MFW_BT_SERVER;
1555 memset(&receiv_obj, 0, sizeof(receiv_obj));
1556 opp_put_res = MFW_BT_OPP_CONTINUE;/* positive response */
1557 receiv_obj.mfw_object_type = MFW_BT_BUFFER;
1558 /* requested location for store of objects*/
1559 receiv_obj.mfw_buffer_start = server_buffer;
1560 /* with respect to object length delivered in BTP_OPP_SERV_PUT_IND;it can be bigger or smaller (loss data) - MMI decision */
1561 receiv_obj.mfw_buffer_size = sizeof(&server_buffer);
1562 receiv_obj.mfw_path = NULL;
1563 /* with respect to delivered object name in BTP_OPP_SERV_PUT_IND */
1564 receiv_obj.mfw_object_name = mfw_test_opp_obj_name;
1565 /* with respect to delivered object length in BTP_OPP_SERV_PUT_IND */
1566 receiv_obj.mfw_object_length = sizeof(&server_buffer);
1567 if(bt_opp_put_reply(service, subtyp, opp_put_res, receiv_obj) NEQ MFW_BT_OK)
1568 {
1569 TRACE_EVENT("mfw_bta:opp response to put request Failure");
1570 }
1571 else
1572 TRACE_EVENT("opp response to put request ok");
1573 break;
1574 case 7: /* start bluetooth primitive OPP_SERVER_PUT_REQUEST with TRACE_EVENT in mfw_bta */
1575 bti_opp_s_put_req();
1576 break;
1577 case 8: /* start bluetooth primitive OPP_SERVER_PUT_CFM with TRACE_EVENT in mfw_bta */
1578 bti_opp_server_put_cnf();
1579 break;
1580
1581 }
1582 return TRUE;
1583 case BTP_CL_OPP_TEST:/* test OPP profile, client */
1584 TRACE_EVENT("bta_response_cb:BTP_CL_OPP_TEST");
1585 switch(((T_BTP_CL_OPP_TEST *)data)->func_id)
1586 {
1587 case 1: /* start bluetooth OPP client application function opp_client_enable()*/
1588 /* receive bluetooth primitive OPP_CLIENT_CFM in BTI */
1589 /* initialize opp client */
1590 memset(&serv_config, 0, sizeof(serv_config));
1591 subtyp = MFW_BT_CLIENT;
1592 service = MFW_BT_OPP;
1593 if(bt_init_profile_opp(service, subtyp, serv_config) NEQ MFW_BT_EXECUTE)
1594 {
1595 TRACE_EVENT("mfw_bta:opp client initialize Failure");
1596 }
1597 else
1598 TRACE_EVENT("opp client initialize ok");
1599 break;
1600 case 2: /* start bluetooth function opp_client_disable() */
1601 /* receive bluetooth primitive OPP_CLIENT_CFM in BTI */
1602 subtyp = MFW_BT_CLIENT;
1603 service = MFW_BT_OPP;
1604 if(bt_deinit_profile(service, subtyp) NEQ MFW_BT_EXECUTE)
1605 {
1606 TRACE_EVENT("mfw_bta:opp client disable Failure");
1607 }
1608 else
1609 TRACE_EVENT("opp client disable ok");
1610 break;
1611 case 3: /* start bluetooth function bmi_service_browse() for OPP server
1612 because only servers are registered in data base and clients
1613 has to look for remote OPP server */
1614 service = MFW_BT_OPP;
1615 if(bt_service_search(service) NEQ MFW_BT_EXECUTE)
1616 {
1617 TRACE_EVENT("mfw_bta:opp search Failure");
1618 }
1619 else
1620 TRACE_EVENT("opp search client ok");
1621 break;
1622 case 4: /* start mfw function bt_clear_list_found_serv() of found opp */
1623 service = MFW_BT_OPP;
1624 if(bt_clear_list_found_serv(service) NEQ MFW_BT_RET_OK)
1625 {
1626 TRACE_EVENT("mfw_bta:opp list del Failure");
1627 }
1628 else
1629 TRACE_EVENT("opp list del ok");
1630 break;
1631 case 5: /* start bluetooth OPP client application function opp_client_disable() and rvm_stop_application()*/
1632 service = MFW_BT_OPP;
1633 subtyp = MFW_BT_CLIENT;
1634 if(bt_stop_profile_application(service, subtyp) NEQ MFW_BT_EXECUTE)
1635 {
1636 TRACE_EVENT("mfw_bta:opp client disable and stop application Failure");
1637 }
1638 else
1639 TRACE_EVENT("opp client disable and stop application ok");
1640 break;
1641 case 6: /* start bluetooth OPP client application function opp_push_object() */
1642 /* push object to a specific server */
1643 memset(&opp_push_obj, 0, sizeof(opp_push_obj));
1644 service = MFW_BT_OPP;
1645 subtyp = MFW_BT_CLIENT;
1646 memset(&server_address, 0xaa, MFW_BT_ADDR_MAX_LEN);/* OPP address with help of browsing procedure */
1647 mfw_keep_connection_opp = FALSE; /* first block is also last block */
1648 /* mfw_keep_connection_opp = TRUE; further blocks will follow */
1649 opp_push_obj.mfw_buffer_start = client_buffer;/* content: client object which is desired to push */
1650 opp_push_obj.mfw_buffer_size = sizeof(&client_buffer);
1651 opp_push_obj.mfw_object_type = MFW_BT_BUFFER;
1652 opp_push_obj.mfw_path = NULL;
1653 opp_push_obj.mfw_object_name = client_obj_name;
1654 opp_push_obj.mfw_object_length = sizeof(&client_buffer);
1655 opp_push_obj.mfw_object_mime_type = NULL;/* MMI must know the mime_type of pushed object */
1656 if(bt_opp_push_object(service, subtyp, server_address, mfw_keep_connection_opp, opp_push_obj) NEQ MFW_BT_EXECUTE)
1657 {
1658 TRACE_EVENT("mfw_bta:opp client pushs an object Failure");
1659 }
1660 else
1661 TRACE_EVENT("opp client pushs an object ok");
1662 break;
1663 case 7: /* start bluetooth primitive OPP_OBJECT_PUSH_CFM with TRACE_EVENT in mfw_bta */
1664 bti_opp_client_push_cnf();
1665 break;
1666 case 8: /* start bluetooth OPP client application function opp_pull_object() */
1667 /* pull object from a specific server */
1668 memset(&opp_pull_obj, 0, sizeof(opp_pull_obj));
1669 service = MFW_BT_OPP;
1670 subtyp = MFW_BT_CLIENT;
1671 memset(&server_address, 0xaa, MFW_BT_ADDR_MAX_LEN);
1672 /* the specific server address can received
1673 with help of function bt_service_search(service) and BT_SERVICE_SEARCH_CNF */
1674 mfw_keep_connection_opp = FALSE; /* first block is also last block */
1675 /* mfw_keep_connection_opp = TRUE; further pull procedures will follow; MMI decision */
1676 opp_pull_obj.mfw_buffer_start = server_business_card;
1677 opp_pull_obj.mfw_buffer_size = sizeof(&server_business_card);
1678 opp_pull_obj.mfw_object_type = MFW_BT_BUFFER;/* store pulled object in buffer */
1679 opp_pull_obj.mfw_path = NULL;
1680 opp_pull_obj.mfw_object_length = sizeof(&server_business_card);
1681 opp_pull_obj.mfw_object_mime_type = NULL;/* MMI must know the mime_type of pulled object; it is only a test value */
1682 if(bt_opp_pull_object(service, subtyp, server_address, mfw_keep_connection_opp, opp_pull_obj) NEQ MFW_BT_EXECUTE)
1683 {
1684 TRACE_EVENT("mfw_bta:opp client pulls an object Failure");
1685 }
1686 else
1687 TRACE_EVENT("opp client pulls an object ok");
1688 break;
1689 case 9: /* start bluetooth primitive OPP_OBJECT_PULL_CFM with TRACE_EVENT in mfw_bta */
1690 bti_opp_client_pull_cnf();
1691 break;
1692 case 10: /* start bluetooth OPP client application function opp_exchange_card() */
1693 /* push an object to a specific server and pull object from a specific server */
1694 memset(&opp_push_obj, 0, sizeof(opp_push_obj));
1695 memset(&opp_pull_obj, 0, sizeof(opp_pull_obj));
1696 service = MFW_BT_OPP;
1697 subtyp = MFW_BT_CLIENT;
1698 memset(&server_address, 0xaa, MFW_BT_ADDR_MAX_LEN);
1699 /* the specific server address can received
1700 with help of function bt_service_search(service) and BT_SERVICE_SEARCH_CNF */
1701 mfw_keep_connection_opp = FALSE; /* first block is also last block */
1702 /* mfw_keep_connection_opp = TRUE; further blocks will follow */
1703 opp_push_obj.mfw_buffer_start = client_business_card;
1704 opp_push_obj.mfw_buffer_size = sizeof(&client_business_card);
1705 opp_push_obj.mfw_object_type = MFW_BT_BUFFER;
1706 opp_push_obj.mfw_path = NULL;
1707 opp_push_obj.mfw_object_name = client_obj_name;
1708 opp_push_obj.mfw_object_length = sizeof(&client_buffer);
1709 opp_push_obj.mfw_object_mime_type = NULL;
1710
1711 opp_pull_obj.mfw_buffer_start = server_business_card;
1712 opp_pull_obj.mfw_buffer_size = sizeof(&server_business_card);
1713 opp_pull_obj.mfw_object_type = MFW_BT_BUFFER;
1714 opp_pull_obj.mfw_path = NULL;
1715 opp_pull_obj.mfw_object_length = sizeof(&server_business_card);
1716 opp_pull_obj.mfw_object_mime_type = NULL;
1717
1718 if(bt_opp_exch_objects(service, subtyp, opp_push_obj, opp_pull_obj, server_address, mfw_keep_connection_opp) NEQ MFW_BT_EXECUTE)
1719 {
1720 TRACE_EVENT("mfw_bta:opp client and server exchange object Failure");
1721 }
1722 else
1723 TRACE_EVENT("opp client and server exchange an object ok");
1724 break;
1725 }
1726 return TRUE;
1727
1728 case BTP_CL_HSG_TEST:/* test HSG profile, client and common hsg features */
1729 TRACE_EVENT("bta_response_cb:BTP_CL_HSG_TEST");
1730 switch(((T_BTP_CL_HSG_TEST *)data)->func_id)
1731 {
1732 case 1: /* start bluetooth HSG server and client application function rvm_start_application()
1733 and hsg_client_enable() and hsg_server_enable() */
1734 /* receive bluetooth primitive HSG_CLIENT_ENABLE_CFM/HSG_SERVER_ENABLE_CFM in BTI */
1735 service = MFW_BT_HEADSET;
1736 if(bt_start_profile_application((T_BTI_DEVICE_TYPE)service) NEQ MFW_BT_OK)
1737 {
1738 TRACE_EVENT("mfw_bta:hsg client + server start and enable Failure");
1739 }
1740 else
1741 TRACE_EVENT("hsg client + server start and enable ok");
1742 break;
1743 case 2: /* start bluetooth HSG client application function hsg_client_enable()*/
1744 /* receive bluetooth primitive HSG_CLIENT_ENABLE_CFM in BTI */
1745 /* initialize headset client */
1746 memset(&client_config, 0, sizeof(client_config));
1747 service = MFW_BT_HEADSET;
1748 client_config.config_mode = MFW_BT_AUTO_OUTG_DEF_CONN_ON;
1749 if(bt_init_profile_hsg_cl(service, client_config) NEQ MFW_BT_EXECUTE)
1750 {
1751 TRACE_EVENT("mfw_bta:hsg client initialize Failure");
1752 }
1753 else
1754 TRACE_EVENT("hsg client initialize ok");
1755 break;
1756 case 3: /* start bluetooth HSG client application function hsg_client_enable()*/
1757 /* receive bluetooth primitive HSG_CLIENT_ENABLE_CFM in BTI */
1758 /* reconfigure headset client */
1759 memset(&client_config, 0, sizeof(client_config));
1760 service = MFW_BT_HEADSET;
1761 client_config.config_mode = MFW_BT_AUTO_OUTG_DEF_CONN_OFF;
1762 if(bt_reconfig_profile_hsg_cl(service, client_config) NEQ MFW_BT_EXECUTE)
1763 {
1764 TRACE_EVENT("mfw_bta:hsg client reconfigure Failure");
1765 }
1766 else
1767 TRACE_EVENT("hsg client reconfigure ok");
1768 break;
1769 case 4: /* start bluetooth HSG client application function hsg_get_configs()*/
1770 /* get state of connection mode for headset client */
1771 memset(&client_config, 0, sizeof(client_config));
1772 service = MFW_BT_HEADSET;
1773 if(bt_get_auto_connect(service, &client_config) NEQ MFW_BT_OK)
1774 {
1775 TRACE_EVENT("mfw_bta:hsg client connection mode Failure");
1776 }
1777 else
1778 {
1779 TRACE_EVENT_P1("connect mode = %d", client_config.config_mode);
1780 }
1781 break;
1782 case 5: /* start bluetooth HSG client application function hsg_get_configs()*/
1783 /* get headset client and server configuration */
1784 memset(&server_conf, 0, sizeof(server_conf));
1785 memset(&client_config, 0, sizeof(client_config));
1786 service = MFW_BT_HEADSET;
1787 if(bt_get_config(service, &client_config, &server_conf) NEQ MFW_BT_OK)
1788 {
1789 TRACE_EVENT("mfw_bta:hsg client and server configuration failure");
1790 }
1791 else
1792 {
1793 TRACE_EVENT_P1("client connect mode = %d", client_config.config_mode);
1794 TRACE_EVENT_P1("server number phone list = %d", server_conf.nb_phone);
1795 }
1796 break;
1797 case 6: /* start bluetooth HSG client application function hsg_client_enable()*/
1798 /* set state of connection mode for headset client */
1799 service = MFW_BT_HEADSET;
1800 if(bt_auto_connect(service, MFW_BT_AUTO_CONNECT_ON) NEQ MFW_BT_OK)
1801 {
1802 TRACE_EVENT("mfw_bta:hsg client set connection mode failure");
1803 }
1804 else
1805 TRACE_EVENT("hsg client set connection mode ok");
1806 break;
1807 case 7: /* start bluetooth function hsg_client_disable() */
1808 /* receive bluetooth primitive HSG_CLIENT_ENABLE_CFM in BTI */
1809 service = MFW_BT_HEADSET;
1810 subtyp = MFW_BT_CLIENT;
1811 if(bt_deinit_profile(service, subtyp) NEQ MFW_BT_EXECUTE)
1812 {
1813 TRACE_EVENT("mfw_bta:hsg client disable Failure");
1814 }
1815 else
1816 TRACE_EVENT("hsg client disable ok");
1817 break;
1818 case 8: /* start bluetooth HSG client application function hsg_client_disable() and rvm_stop_application()*/
1819 service = MFW_BT_HEADSET;
1820 subtyp = MFW_BT_CLIENT;
1821 if(bt_stop_profile_application(service, subtyp) NEQ MFW_BT_EXECUTE)
1822 {
1823 TRACE_EVENT("mfw_bta:hsg client disable and stop application Failure");
1824 }
1825 else
1826 TRACE_EVENT("hsg client disable and stop application ok");
1827 break;
1828 case 9: /* start bluetooth HSG client application function hsg_out_connection_transfer()*/
1829 service = MFW_BT_HEADSET;
1830 for(j =0;j<MFW_BT_ADDR_MAX_LEN;j++)
1831 hsg_address[j] = 0xbb;
1832 headset_id = MFW_BT_INVALID_HEADSET_ID;
1833 if(bt_transfer_audio_out(service, headset_id, hsg_address) NEQ MFW_BT_EXECUTE)
1834 {
1835 TRACE_EVENT("mfw_bta:transfer audio out Failure");
1836 }
1837 else
1838 TRACE_EVENT("transfer audio out ok");
1839 break;
1840 case 10: /* start bluetooth HSG client application function hsg_in_connection_transfer()*/
1841 service = MFW_BT_HEADSET;
1842 if(bt_transfer_audio_in(service) NEQ MFW_BT_EXECUTE)
1843 {
1844 TRACE_EVENT("mfw_bta:transfer audio in Failure");
1845 }
1846 else
1847 TRACE_EVENT("transfer audio in ok");
1848 break;
1849 case 11: /* start bluetooth HSG client application function hsg_save_config()*/
1850 /* not supported TI 5.3.0 BT */
1851 service = MFW_BT_HEADSET;
1852 if(bt_save_config(service) NEQ MFW_BT_OK)
1853 {
1854 TRACE_EVENT("mfw_bta:save hsg config Failure");
1855 }
1856 else
1857 TRACE_EVENT("save hsg config ok");
1858 break;
1859 case 12: /* start bluetooth HSG client application function hsg_restore_config()*/
1860 /* not supported TI 5.3.0 BT */
1861 service = MFW_BT_HEADSET;
1862 if(bt_restore_config(service) NEQ MFW_BT_EXECUTE)
1863 {
1864 TRACE_EVENT("mfw_bta:restore hsg config Failure");
1865 }
1866 else
1867 TRACE_EVENT("restore hsg config ok");
1868 break;
1869 case 13: /* start bluetooth HSG client application function hsg_save_default_list()*/
1870 /* save in non-volatile memory, not supported TI 5.3.0 BT */
1871 service = MFW_BT_HEADSET;
1872 if(bt_save_default_list(service) NEQ MFW_BT_OK)
1873 {
1874 TRACE_EVENT("mfw_bta:save hsg def list Failure");
1875 }
1876 else
1877 TRACE_EVENT("save hsg def list ok");
1878 break;
1879 case 14: /* start bluetooth HSG client application function hsg_restore_default_list()*/
1880 /* save in non-volatile memory, not supported TI 5.3.0 BT */
1881 service = MFW_BT_HEADSET;
1882 if( bt_restore_default_list(service) NEQ MFW_BT_EXECUTE)
1883 {
1884 TRACE_EVENT("mfw_bta:restore hsg def list Failure");
1885 }
1886 else
1887 TRACE_EVENT("restore hsg def list ok");
1888 break;
1889 case 15: /* start bluetooth primitive HSG_DEVICE_CONNECTION_IND */
1890 bti_conn_ind_hsg();
1891 break;
1892 case 16: /* start bluetooth primitive HSG_HEADSET_CONNECTION_CLOSED */
1893 bti_hsg_disconnect();
1894 break;
1895 case 17: /* start bluetooth primitive HSG_CONNECTION_FAILED */
1896 bti_hsg_connect_failed();
1897 break;
1898 case 18: /* start bluetooth primitive HSG_GSM_CONNECTION_IND */
1899 bti_hsg_gsm_connect_ind();
1900 break;
1901 }
1902 return TRUE;
1903 case BTP_SRV_HSG_TEST:/* test HSG profile, server and common hsg functions */
1904 TRACE_EVENT("bta_response_cb:BTP_SRV_HSG_TEST");
1905 switch(((T_BTP_SRV_HSG_TEST *)data)->func_id)
1906 {
1907 case 1: /* start bluetooth HSG server application function hsg_server_enable()*/
1908 /* receive bluetooth primitive HSG_SERVER_ENABLE_CFM in BTI */
1909 /* initialize headset server */
1910 memset(&server_conf, 0, sizeof(server_conf));
1911 memset(test_mfw_key_list, 0, sizeof(test_mfw_key_list));
1912 test_mfw_key_list[0] = 0xFE; /* f.e.KEY_F1 */
1913 memset(test_mfw_phone_list, 0, sizeof(test_mfw_phone_list));
1914 for(j=0;j<4;j++)
1915 test_mfw_phone_list[1][j] = j | 0x30;
1916 service = MFW_BT_HEADSET;
1917 server_conf.serv_con_conf = 0; /* TI not used */
1918 server_conf.conn_break = MFW_BT_CONN_SCAN_BREAK_DEFAULT_VALUE;
1919 server_conf.conn_time = MFW_BT_CONN_SCAN_TIME_DEFAULT_VALUE;
1920 server_conf.nb_phone = 1;/* currently only one number from remote headset is supported */
1921 memcpy(server_conf.mfw_phone_list, test_mfw_phone_list, sizeof(test_mfw_phone_list));
1922 memcpy(server_conf.mfw_key_list, test_mfw_key_list, sizeof(test_mfw_key_list));
1923 if(bt_init_profile_hsg_serv(service, server_conf) NEQ MFW_BT_EXECUTE)
1924 {
1925 TRACE_EVENT("mfw_bta:hsg server initialize Failure");
1926 }
1927 else
1928 TRACE_EVENT("hsg server initialize ok");
1929 break;
1930 case 2: /* start bluetooth HSG server application function hsg_server_enable()*/
1931 /* receive bluetooth primitive HSG_SERVER_ENABLE_CFM in BTI */
1932 /* reconfigure headset server */
1933 memset(&server_conf, 0, sizeof(server_conf));
1934 memset(test_mfw_key_list, 0, sizeof(test_mfw_key_list));
1935 test_mfw_key_list[0] = 0xFE; /* f.e. KEY_F1 */
1936 memset(test_mfw_phone_list, 0, sizeof(test_mfw_phone_list));
1937 for(j=0;j<4;j++)
1938 test_mfw_phone_list[1][j] = j | 0x30;
1939 service = MFW_BT_HEADSET;
1940 server_conf.serv_con_conf = 0; /* TI not used */
1941 server_conf.conn_break = MFW_BT_CONN_SCAN_BREAK_DEFAULT_VALUE;
1942 server_conf.conn_time = MFW_BT_CONN_SCAN_TIME_DEFAULT_VALUE;
1943 server_conf.nb_phone = 1;/* currently only one number from remote headset is supported */
1944 memcpy(server_conf.mfw_phone_list, test_mfw_phone_list, sizeof(test_mfw_phone_list));
1945 memcpy(server_conf.mfw_key_list, test_mfw_key_list, sizeof(test_mfw_key_list));
1946 if(bt_reconfig_profile_hsg_serv(service, server_conf) NEQ MFW_BT_EXECUTE)
1947 {
1948 TRACE_EVENT("mfw_bta:hsg server reconfigure Failure");
1949 }
1950 else
1951 TRACE_EVENT("hsg server reconfigure ok");
1952 break;
1953 case 3: /* start bluetooth function hsg_server_disable() */
1954 /* receive bluetooth primitive HSG_SERVER_ENABLE_CFM in BTI */
1955 service = MFW_BT_HEADSET;
1956 subtyp = MFW_BT_SERVER;
1957 if(bt_deinit_profile(service, subtyp) NEQ MFW_BT_EXECUTE)
1958 {
1959 TRACE_EVENT("mfw_bta:hsg server disable Failure");
1960 }
1961 else
1962 TRACE_EVENT("hsg server disable ok");
1963 break;
1964 case 4: /* start bluetooth HSG client application function hsg_server_disable() and rvm_stop_application()*/
1965 service = MFW_BT_HEADSET;
1966 subtyp = MFW_BT_SERVER;
1967 if(bt_stop_profile_application(service, subtyp) NEQ MFW_BT_EXECUTE)
1968 {
1969 TRACE_EVENT("mfw_bta:hsg server disable and stop application Failure");
1970 }
1971 else
1972 TRACE_EVENT("hsg server disable and stop application ok");
1973 break;
1974 case 5: /* start bluetooth HSG client application function hsg_add_default_headset()*/
1975 memset(&hsg_name, 0, sizeof(hsg_name));
1976 service = MFW_BT_HEADSET;
1977 for(j =0;j<MFW_BT_ADDR_MAX_LEN;j++)
1978 hsg_address[j] = 0xbb;/* address of new add headset */
1979 strcpy(hsg_name, hsg_default_name);/* name of new add headset */
1980 priority = 2;/* desired priority of new add headset in list */
1981 rem_audio_ctr_supp_hsg = TRUE;/* headset supports remote audio control */
1982 if(bt_set_pref_headset(service, hsg_address, hsg_name, priority, rem_audio_ctr_supp_hsg, &headset_cnf_id) NEQ MFW_BT_OK)
1983 /* get id in default headset list */
1984 {
1985 TRACE_EVENT("mfw_bta:hsg add default headset Failure");
1986 }
1987 else
1988 TRACE_EVENT_P1("add hsg: id = %d", headset_cnf_id);
1989 break;
1990 case 6: /* start bluetooth function bmi_service_browse() for headset */
1991 service = MFW_BT_HEADSET;
1992 if(bt_service_search(service) NEQ MFW_BT_EXECUTE)
1993 {
1994 TRACE_EVENT("mfw_bta:headset search Failure");
1995 }
1996 else
1997 TRACE_EVENT("headset search ok");
1998 break;
1999 case 7: /* start bluetooth function hsg_remove_default_headset() */
2000 headset_id = 1;
2001 service = MFW_BT_HEADSET;
2002 if(bt_reset_pref_hsg(service, headset_id) NEQ MFW_BT_OK)
2003 {
2004 TRACE_EVENT("mfw_bta:remove headset Failure");
2005 }
2006 else
2007 TRACE_EVENT("remove headset ok");
2008 break;
2009 case 8: /* start bluetooth function hsg_get_default_headset_info() */
2010 memset(&hs_info, 0, sizeof(hs_info));
2011 headset_id = 3;
2012 service = MFW_BT_HEADSET;
2013 if(bt_get_default_service_info(service, headset_id, &hs_info) NEQ MFW_BT_OK)
2014 {
2015 TRACE_EVENT("mfw_bta:get headset info Failure");
2016 }
2017 else
2018 TRACE_EVENT_P4("hsg info: %d %d %s %s", hs_info.priority, hs_info.mfw_remote_audio_control_support, hs_info.hsg_name, hs_info.bd_addr);
2019 break;
2020 case 9: /* start bluetooth function hsg_change_default_headset_info() */
2021 service = MFW_BT_HEADSET;
2022 headset_id = 3;
2023 priority = 4;
2024 if(bt_set_prio_default_service(service, headset_id, priority) NEQ MFW_BT_OK)
2025 {
2026 TRACE_EVENT("mfw_bta:change headset info Failure");
2027 }
2028 else
2029 TRACE_EVENT("change headset info ok");
2030 break;
2031 case 10: /* start bluetooth function hsg_connect() */
2032 service = MFW_BT_HEADSET;
2033 for(j =0;j<MFW_BT_ADDR_MAX_LEN;j++)
2034 hsg_address[j] = 0xbb;
2035 headset_id = MFW_BT_INVALID_HEADSET_ID;
2036 if(bt_connect_hsg(service, headset_id, hsg_address, 0) NEQ MFW_BT_EXECUTE)
2037 {
2038 TRACE_EVENT("mfw_bta:connect headset Failure");
2039 }
2040 else
2041 TRACE_EVENT("connect headset ok");
2042 break;
2043 case 11: /* start bluetooth function hsg_disconnect() */
2044 service = MFW_BT_HEADSET;
2045 if(bt_disconnect_service(service) NEQ MFW_BT_EXECUTE)
2046 {
2047 TRACE_EVENT("mfw_bta:disconnect headset Failure");
2048 }
2049 else
2050 TRACE_EVENT("disconnect headset ok");
2051 break;
2052 case 12: /* start bluetooth function hsg_update_params() */
2053 service = MFW_BT_HEADSET;
2054 nb = MFW_BT_SPEAKER_GAIN;/* MFW_BT_MIC_GAIN */
2055 type = MFW_BT_PARA_INC; /* MFW_BT_PARA_SET */
2056 new_value = 0;
2057 if(bt_set_param_headset(service, nb, type, new_value) NEQ MFW_BT_OK)
2058 {
2059 TRACE_EVENT("mfw_bta:set params headset Failure");
2060 }
2061 else
2062 TRACE_EVENT("set params headset ok");
2063 break;
2064 case 13: /* start mfw function bt_clear_list_found_serv() of found hsg */
2065 service = MFW_BT_HEADSET;
2066 if(bt_clear_list_found_serv(service) NEQ MFW_BT_RET_OK)
2067 {
2068 TRACE_EVENT("mfw_bta:hsg list del Failure");
2069 }
2070 else
2071 TRACE_EVENT("hsg list del ok");
2072 break;
2073 case 14: /* start bluetooth primitive HSG_DEVICE_CONNECTION_PERFORMED */
2074 bti_hsg_dev_connect_inf();
2075 break;
2076 case 15: /* start mfw function hsg_is_default_headset()*/
2077 service = MFW_BT_HEADSET;
2078 for(j =0;j<MFW_BT_ADDR_MAX_LEN;j++)
2079 hsg_address[j] = 0xbb;
2080 if(bt_is_pref_headset(service, hsg_address, &headset_cnf_id) NEQ MFW_BT_RET_OK)
2081 {
2082 TRACE_EVENT("mfw_bta:hsg list del Failure");
2083 }
2084 else
2085 {
2086 if(headset_cnf_id EQ MFW_BT_INVALID_HEADSET_ID)
2087 {
2088 TRACE_EVENT("hsg not in default list");
2089 }
2090 else
2091 {
2092 TRACE_EVENT_P1("hsg id in default list:%d", headset_cnf_id);
2093 }
2094 }
2095 break;
2096 }
2097 return TRUE;
2098 case BTP_FAX_TEST:/* test FAX profile */
2099 TRACE_EVENT("bta_response_cb:BTP_FAX_TEST");
2100 switch(((T_BTP_FAX_TEST *)data)->func_id)
2101 {
2102 case 1:/*start bluetooth function fax_gw_config()*/
2103 service = MFW_BT_FAX_GW;
2104 fax_filter.link_event = MFW_BT_LINK_MONIT_ON;
2105 fax_filter.call_event = MFW_BT_CALL_MONIT_ON;
2106 if(bt_init_profile_fax(service, fax_filter) NEQ MFW_BT_EXECUTE)
2107 {
2108 TRACE_EVENT("mfw_bta:init fax Failure");
2109 }
2110 else
2111 TRACE_EVENT("init fax ok");
2112 break;
2113 case 2: /* start bluetooth fax application function
2114 rvm_start_application(), fax_gw_enable(), fax_gw_config() */
2115 /* receive bluetooth primitive FAX_GW_STATUS_CFM in BTI */
2116 service = MFW_BT_FAX_GW;
2117 if(bt_start_profile_application((T_BTI_DEVICE_TYPE)service) NEQ MFW_BT_OK)
2118 {
2119 TRACE_EVENT("mfw_bta:fax server start and enable Failure");
2120 }
2121 else
2122 TRACE_EVENT("fax start and enable ok");
2123 break;
2124 case 3:/* start bluetooth function fax_gw_config()*/
2125 service = MFW_BT_FAX_GW;
2126 fax_filter.link_event = MFW_BT_LINK_MONIT_OFF;
2127 fax_filter.call_event = MFW_BT_CALL_MONIT_OFF;
2128 if(bt_reconfig_profile_fax(service, fax_filter) NEQ MFW_BT_EXECUTE)
2129 {
2130 TRACE_EVENT("mfw_bta:reconfig fax Failure");
2131 }
2132 else
2133 TRACE_EVENT("reconfig fax ok");
2134 break;
2135 case 4: /* start bluetooth FAX application function fax_gw_disable() and rvm_stop_application()*/
2136 service = MFW_BT_FAX_GW;
2137 subtyp = MFW_BT_NO_SUBTYPE;
2138 if(bt_stop_profile_application(service, subtyp) NEQ MFW_BT_EXECUTE)
2139 {
2140 TRACE_EVENT("mfw_bta:fax disable and stop application Failure");
2141 }
2142 else
2143 TRACE_EVENT("fax disable and stop application ok");
2144 break;
2145 case 5: /* start bluetooth function fax_gw_disable() */
2146 service = MFW_BT_FAX_GW;
2147 subtyp = MFW_BT_NO_SUBTYPE;
2148 if(bt_deinit_profile(service, subtyp) NEQ MFW_BT_EXECUTE)
2149 {
2150 TRACE_EVENT("mfw_bta:deinit fax Failure");
2151 }
2152 else
2153 TRACE_EVENT("deinit fax ok");
2154 break;
2155 case 6: /* start bluetooth function bmi_service_browse() for FAX */
2156 service = MFW_BT_FAX_GW;
2157 if(bt_service_search(service) NEQ MFW_BT_EXECUTE)
2158 {
2159 TRACE_EVENT("mfw_bta:search fax Failure");
2160 }
2161 else
2162 TRACE_EVENT("search fax ok");
2163 break;
2164 case 7: /* start bluetooth function bmi_service_browse() for FAX and delete list of found fax*/
2165 service = MFW_BT_FAX_GW;
2166 if(bt_clear_list_found_serv(service) NEQ MFW_BT_RET_OK)
2167 {
2168 TRACE_EVENT("mfw_bta:search/delete fax Failure");
2169 }
2170 else
2171 TRACE_EVENT("search/delete fax ok");
2172 break;
2173 case 8: /* start bluetooth function fax_gw_hangup() */
2174 service = MFW_BT_FAX_GW;
2175 if(bt_disconnect_service(service) NEQ MFW_BT_EXECUTE)
2176 {
2177 TRACE_EVENT("mfw_bta:disconn req fax Failure");
2178 }
2179 else
2180 TRACE_EVENT("disconn req fax ok");
2181 break;
2182 case 9: /* start bluetooth primitive FAX_GW_LINK_MONITORING:FAX_GW_CONNECTED */
2183 bti_conn_ind_fax();
2184 break;
2185 case 10: /* start bluetooth primitive FAX_GW_LINK_MONITORING:FAX_GW_NOT_CONNECTED */
2186 bti_fax_disconnect();
2187 break;
2188 case 11: /* start bluetooth primitive FAX_GW_CALL_MONITORING:FAX_GW_CALL_IN_PROGRESS */
2189 bti_fax_call_mon();
2190 break;
2191 }
2192 return TRUE;
2193 case BTP_DUN_TEST:/* test DUN profile */
2194 TRACE_EVENT("bta_response_cb:BTP_DUN_TEST");
2195 switch(((T_BTP_DUN_TEST *)data)->func_id)
2196 {
2197 case 1: /* start bluetooth function dun_gw_config() */
2198 service = MFW_BT_DIAL_UP;
2199 dun_filter.link_event = MFW_BT_LINK_MONIT_ON;
2200 dun_filter.call_event = MFW_BT_CALL_MONIT_ON;
2201 if(bt_init_profile_dun(service, dun_filter) NEQ MFW_BT_EXECUTE)
2202 {
2203 TRACE_EVENT("mfw_bta:init dun Failure");
2204 }
2205 else
2206 TRACE_EVENT("init dun ok");
2207 break;
2208 case 2: /* start bluetooth dial up application function
2209 rvm_start_application(), dun_gw_enable(), dun_gw_config() */
2210 /* receive bluetooth primitive DUN_GW_STATUS_CFM in BTI */
2211 service = MFW_BT_DIAL_UP;
2212 if(bt_start_profile_application((T_BTI_DEVICE_TYPE)service) NEQ MFW_BT_OK)
2213 {
2214 TRACE_EVENT("mfw_bta:dun server start and enable Failure");
2215 }
2216 else
2217 TRACE_EVENT("dun start and enable ok");
2218 break;
2219 case 3: /* start bluetooth function dun_gw_config() */
2220 service = MFW_BT_DIAL_UP;
2221 dun_filter.link_event = MFW_BT_LINK_MONIT_ON;
2222 dun_filter.call_event = MFW_BT_CALL_MONIT_ON;
2223 if(bt_reconfig_profile_dun(service, dun_filter) NEQ MFW_BT_EXECUTE)
2224 {
2225 TRACE_EVENT("mfw_bta:reconf dun Failure");
2226 }
2227 else
2228 TRACE_EVENT("reconf dun ok");
2229 break;
2230 case 4: /* start bluetooth function dun_gw_disable() */
2231 service = MFW_BT_DIAL_UP;
2232 subtyp = MFW_BT_NO_SUBTYPE;
2233 if(bt_deinit_profile(service, subtyp) NEQ MFW_BT_EXECUTE)
2234 {
2235 TRACE_EVENT("mfw_bta:deinit dun Failure");
2236 }
2237 else
2238 TRACE_EVENT("deinit dun ok");
2239 break;
2240 case 5: /* start bluetooth DUN application function dun_gw_disable() and rvm_stop_application()*/
2241 service = MFW_BT_DIAL_UP;
2242 subtyp = MFW_BT_NO_SUBTYPE;
2243 if(bt_stop_profile_application(service, subtyp) NEQ MFW_BT_EXECUTE)
2244 {
2245 TRACE_EVENT("mfw_bta:stop dun Failure");
2246 }
2247 else
2248 TRACE_EVENT("stop dun ok");
2249 break;
2250 case 6: /* start bluetooth function bmi_service_browse() for DUN */
2251 service = MFW_BT_DIAL_UP;
2252 if(bt_service_search(service) NEQ MFW_BT_EXECUTE)
2253 {
2254 TRACE_EVENT("mfw_bta:search dun Failure");
2255 }
2256 else
2257 TRACE_EVENT("search dun ok");
2258 break;
2259 case 7: /* start bluetooth function bmi_service_browse() for DUN and delete list of found dun*/
2260 service = MFW_BT_DIAL_UP;
2261 if(bt_clear_list_found_serv(service) NEQ MFW_BT_RET_OK)
2262 {
2263 TRACE_EVENT("mfw_bta:search/delete dun Failure");
2264 }
2265 else
2266 TRACE_EVENT("search/delete dun ok");
2267 break;
2268 case 8: /* start bluetooth function dun_gw_hangup() */
2269 service = MFW_BT_DIAL_UP;
2270 if(bt_disconnect_service(service) NEQ MFW_BT_EXECUTE)
2271 {
2272 TRACE_EVENT("mfw_bta:disconn req dun Failure");
2273 }
2274 else
2275 TRACE_EVENT("disconn req dun ok");
2276 break;
2277 case 9: /* start bluetooth primitive DUN_GW_LINK_MONITORING:DUN_GW_NOT_CONNECTED */
2278 bti_dun_disconnect();
2279 break;
2280 case 10: /* start bluetooth primitive DUN_GW_LINK_MONITORING:DUN_GW_CONNECTED */
2281 bti_conn_ind_dun();
2282 break;
2283 case 11: /* start bluetooth primitive DUN_GW_CALL_MONITORING:DUN_GW_CALL_IN_PROGRESS ... */
2284 bti_dun_call_mon();
2285 break;
2286 }
2287 return TRUE;
2288 case BTP_SEC_BROWS_TEST:/* test browsing and security bluetooth function */
2289 TRACE_EVENT("bta_response_cb:BTP_SEC_BROWS_TEST");
2290 switch(((T_BTP_SEC_BROWS_TEST *)data)->func_id)
2291 {
2292 case 1:/* register in security managment of bluetooth */
2293 if(bt_register_sm() NEQ MFW_BT_RET_OK)
2294 {
2295 TRACE_EVENT("mfw_bta:SCM register Failure");
2296 }
2297 else
2298 TRACE_EVENT("SCM register ok");
2299 break;
2300 case 2:/* set general security mode of bluetooth device with default value */
2301 if(bt_set_security_mode(MFW_BT_SECURITY_MODE_2) NEQ MFW_BT_RET_OK)
2302 {
2303 TRACE_EVENT("mfw_bta:SCM sec mode Failure");
2304 }
2305 else
2306 TRACE_EVENT("SCM sec mode ok");
2307 break;
2308 case 3:/* set bluetooth device in pairable mode */
2309 if(bt_set_pair_mode (MFW_BT_PAIRABLE) NEQ MFW_BT_RET_OK)
2310 {
2311 TRACE_EVENT("mfw_bta:SCM pair mode Failure");
2312 }
2313 else
2314 TRACE_EVENT("SCM pair mode ok");
2315 break;
2316 case 4:/* search bluetooth devices with their services */
2317 if(bt_device_search() NEQ MFW_BT_EXECUTE)
2318 {
2319 TRACE_EVENT("mfw_bta:search devices Failure");
2320 }
2321 else
2322 TRACE_EVENT("search devices ok");
2323 break;
2324 case 5:/* terminate browsing procedure */
2325 if(bt_search_abort() NEQ MFW_BT_OK)
2326 {
2327 TRACE_EVENT("mfw_bta:search abort Failure");
2328 }
2329 else
2330 TRACE_EVENT("search abort ok");
2331 break;
2332 case 6: /* start bluetooth primitive SCM_PIN_CODE_REQUEST */
2333 bti_send_pin_request();
2334 break;
2335 case 7: /* start bluetooth function scm_pin_code_reply() */
2336 memset(&hsg_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2337 memset(&pin_code, 0x35, MFW_BT_PIN_MAX_LEN);
2338 pin_mode = PIN_PROVIDED;
2339 result_bt = bt_send_pin(hsg_address, pin_code, pin_mode);
2340 if(result_bt EQ MFW_BT_INVALID_PARA)
2341 {
2342 TRACE_EVENT("mfw_bta:Wrong Pin");
2343 }
2344 else if(result_bt NEQ MFW_BT_OK)
2345 {
2346 TRACE_EVENT("mfw_bta:pin Failure");
2347 }
2348 else
2349 TRACE_EVENT("pin ok");
2350 break;
2351 case 8: /* start bluetooth primitive SCM_DEVICE_PAIRED_RESULT */
2352 bti_pin_code_cnf();
2353 break;
2354 case 9: /* start bluetooth function scm_get_next_authorized_device() for sync */
2355 memset(&authorized_devices_list, 0, sizeof(authorized_devices_list));
2356 auth_mask = MFW_SERVICE_SYNC_C;
2357 if(bt_authorized_devices(&authorized_devices_list, auth_mask) NEQ MFW_BT_RET_OK)
2358 {
2359 TRACE_EVENT("mfw_bta:auth list Failure");
2360 }
2361 else
2362 TRACE_EVENT_P3("auth sync:%d %x %s", authorized_devices_list.count, authorized_devices_list.auth_devices[1].mask_authorization, authorized_devices_list.auth_devices[1].remote_bd_addr);
2363 break;
2364 case 10: /* start bluetooth function scm_get_next_authorized_device() for opp */
2365 memset(&authorized_devices_list, 0, sizeof(authorized_devices_list));
2366 auth_mask = MFW_SERVICE_OPP;
2367 if(bt_authorized_devices(&authorized_devices_list, auth_mask) NEQ MFW_BT_RET_OK)
2368 {
2369 TRACE_EVENT("mfw_bta:auth list Failure");
2370 }
2371 else
2372 TRACE_EVENT_P3("auth opp:%d %x %s", authorized_devices_list.count, authorized_devices_list.auth_devices[1].mask_authorization, authorized_devices_list.auth_devices[1].remote_bd_addr);
2373 break;
2374 case 11: /* start bluetooth function scm_get_next_authorized_device() for fax */
2375 memset(&authorized_devices_list, 0, sizeof(authorized_devices_list));
2376 auth_mask = MFW_SERVICE_FAX;
2377 if(bt_authorized_devices(&authorized_devices_list, auth_mask) NEQ MFW_BT_RET_OK)
2378 {
2379 TRACE_EVENT("mfw_bta:auth list Failure");
2380 }
2381 else
2382 TRACE_EVENT_P3("auth fax:%d %x %s", authorized_devices_list.count, authorized_devices_list.auth_devices[1].mask_authorization, authorized_devices_list.auth_devices[1].remote_bd_addr);
2383 break;
2384 case 12: /* start bluetooth function scm_get_next_authorized_device() for hsg */
2385 memset(&authorized_devices_list, 0, sizeof(authorized_devices_list));
2386 auth_mask = MFW_SERVICE_HSG;
2387 if(bt_authorized_devices(&authorized_devices_list, auth_mask) NEQ MFW_BT_RET_OK)
2388 {
2389 TRACE_EVENT("mfw_bta:auth list Failure");
2390 }
2391 else
2392 TRACE_EVENT_P3("auth hsg:%d %x %s", authorized_devices_list.count, authorized_devices_list.auth_devices[1].mask_authorization, authorized_devices_list.auth_devices[1].remote_bd_addr);
2393 break;
2394 case 13: /* start bluetooth function scm_get_next_authorized_device() for dun */
2395 memset(&authorized_devices_list, 0, sizeof(authorized_devices_list));
2396 auth_mask = MFW_SERVICE_DUN;
2397 if(bt_authorized_devices(&authorized_devices_list, auth_mask) NEQ MFW_BT_RET_OK)
2398 {
2399 TRACE_EVENT("mfw_bta:auth list Failure");
2400 }
2401 else
2402 TRACE_EVENT_P3("auth dun:%d %x %s", authorized_devices_list.count, authorized_devices_list.auth_devices[1].mask_authorization, authorized_devices_list.auth_devices[1].remote_bd_addr);
2403 break;
2404 case 14: /* start bluetooth function scm_get_next_authorized_device() for all existing services */
2405 memset(&authorized_devices_list, 0, sizeof(authorized_devices_list));
2406 if(bt_list_auth_dev(&authorized_devices_list) NEQ MFW_BT_RET_OK)
2407 {
2408 TRACE_EVENT("mfw_bta:auth list Failure");
2409 }
2410 else
2411 TRACE_EVENT_P1("auth list:%d", authorized_devices_list.count);
2412 break;
2413 case 15: /* start bluetooth function scm_set_device_authorization() for sync */
2414 memset(&remote_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2415 auth_mask = MFW_SERVICE_SYNC_C;
2416 if(bt_del_authorization(remote_address, auth_mask) NEQ MFW_BT_OK)
2417 {
2418 TRACE_EVENT("mfw_bta:del auth Failure");
2419 }
2420 else
2421 TRACE_EVENT("del auth ok");
2422 break;
2423 case 16: /* start bluetooth function scm_set_device_authorization() for dun */
2424 memset(&remote_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2425 auth_mask = MFW_SERVICE_DUN;
2426 if(bt_del_authorization(remote_address, auth_mask) NEQ MFW_BT_OK)
2427 {
2428 TRACE_EVENT("mfw_bta:del auth Failure");
2429 }
2430 else
2431 TRACE_EVENT("del auth ok");
2432 break;
2433 case 17: /* start bluetooth function scm_set_device_authorization() for fax */
2434 memset(&remote_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2435 auth_mask = MFW_SERVICE_FAX;
2436 if(bt_del_authorization(remote_address, auth_mask) NEQ MFW_BT_OK)
2437 {
2438 TRACE_EVENT("mfw_bta:del auth Failure");
2439 }
2440 else
2441 TRACE_EVENT("del auth ok");
2442 break;
2443 case 18: /* start bluetooth function scm_set_device_authorization() for opp */
2444 memset(&remote_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2445 auth_mask = MFW_SERVICE_OPP;
2446 if(bt_del_authorization(remote_address, auth_mask) NEQ MFW_BT_OK)
2447 {
2448 TRACE_EVENT("mfw_bta:del auth Failure");
2449 }
2450 else
2451 TRACE_EVENT("del auth ok");
2452 break;
2453 case 19: /* start bluetooth function scm_set_device_authorization() for hsg */
2454 memset(&remote_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2455 auth_mask = MFW_SERVICE_HSG;
2456 if(bt_del_authorization(remote_address, auth_mask) NEQ MFW_BT_OK)
2457 {
2458 TRACE_EVENT("mfw_bta:del auth Failure");
2459 }
2460 else
2461 TRACE_EVENT("del auth ok");
2462 break;
2463 case 20: /* start bluetooth function scm_set_device_authorization() for hsg */
2464 memset(&remote_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2465 if(bt_del_authorizations_device(remote_address) NEQ MFW_BT_OK)
2466 {
2467 TRACE_EVENT("mfw_bta:del authorization device Failure");
2468 }
2469 else
2470 TRACE_EVENT("del authorization device auth ok");
2471 break;
2472 case 21: /* start bluetooth function scm_set_security_mode() */
2473 sec_mode = MFW_BT_SECURITY_MODE_3;
2474 if(bt_set_security_mode(sec_mode) NEQ MFW_BT_OK)
2475 {
2476 TRACE_EVENT("mfw_bta:set common security level Failure");
2477 }
2478 else
2479 TRACE_EVENT("set common security level ok");
2480 break;
2481 case 22: /* start bluetooth function scm_set_default_security_requirements() */
2482 default_security = MFW_BT_INCOM_AUTHENTICATION | MFW_BT_INCOM_AUTHORIZATION |MFW_BT_OUTGO_ENCRYPTION;
2483 if(bt_set_default_security(default_security) NEQ MFW_BT_OK)
2484 {
2485 TRACE_EVENT("mfw_bta:set default security values Failure");
2486 }
2487 else
2488 TRACE_EVENT("set default security values ok");
2489 break;
2490 case 23:/* deregister in security managment of bluetooth */
2491 if(bt_deregister_sm() NEQ MFW_BT_RET_OK)
2492 {
2493 TRACE_EVENT("mfw_bta:SCM deregister Failure");
2494 }
2495 else
2496 TRACE_EVENT("SCM deregister ok");
2497 break;
2498 }
2499 return TRUE;
2500 case BTP_OTHER_TEST:/* test common bluetooth function (lists) */
2501 TRACE_EVENT("bta_response_cb:BTP_OTHER_TEST");
2502 switch(((T_BTP_OTHER_TEST *)data)->func_id)
2503 {
2504 case 1:/* delete list of found bluetooth devices */
2505 if(bt_clear_list_found_dev() NEQ MFW_BT_RET_OK)
2506 {
2507 TRACE_EVENT("mfw_bta:clear device list Failure");
2508 }
2509 else
2510 TRACE_EVENT("clear device list ok");
2511 break;
2512 case 2:/* delete lists of found bluetooth services */
2513 if(bt_clear_all_lists_found_serv() NEQ MFW_BT_RET_OK)
2514 {
2515 TRACE_EVENT("mfw_bta:clear service lists Failure");
2516 }
2517 else
2518 TRACE_EVENT("clear service lists ok");
2519 break;
2520 case 3:/* start bluetooth function scm_set_pairable_mode() */
2521 pair_mode = MFW_BT_PAIRABLE;
2522 if(bt_set_pair_mode(pair_mode) NEQ MFW_BT_OK)
2523 {
2524 TRACE_EVENT("mfw_bta:set pair mode Failure");
2525 }
2526 else
2527 TRACE_EVENT("set pair mode on ok");
2528 break;
2529 case 4:/* start bluetooth function scm_set_pairable_mode() */
2530 pair_mode = MFW_BT_NON_PAIRABLE;
2531 if(bt_set_pair_mode(pair_mode) NEQ MFW_BT_OK)
2532 {
2533 TRACE_EVENT("mfw_bta:set pair mode Failure");
2534 }
2535 else
2536 TRACE_EVENT("set pair mode off ok");
2537 break;
2538 case 5:/* start bluetooth function scm_start_pairing() */
2539 memset(&hsg_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2540 memset(&pin_code, 0x35, MFW_BT_PIN_MAX_LEN);
2541 pin_mode = PIN_PROVIDED;
2542 if(bt_start_pairing(hsg_address, pin_code, pin_mode) NEQ MFW_BT_EXECUTE)
2543 {
2544 TRACE_EVENT("mfw_bta:start pairing mode Failure");
2545 }
2546 else
2547 TRACE_EVENT("start pairing ok");
2548 break;
2549 case 6: /* start bluetooth primitive SCM_DEVICE_PAIRED_RESULT */
2550 bti_pairing_cnf();
2551 break;
2552 case 7:/* start bluetooth function scm_is_device_paired() */
2553 memset(&hsg_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2554 if(bt_check_pair(hsg_address) NEQ MFW_BT_OK)
2555 {
2556 TRACE_EVENT("mfw_bta:check pairing Failure");
2557 }
2558 else
2559 TRACE_EVENT("check pairing ok");
2560 break;
2561 case 8:/* start bluetooth function scm_get_next_paired_device() */
2562 memset(&pairing_list, 0, sizeof(T_MFW_BT_DEV_PAIR_LIST));
2563 if(bt_list_paired_dev(&pairing_list) NEQ MFW_BT_RET_OK)
2564 {
2565 TRACE_EVENT("mfw_bta:pairing list Failure");
2566 }
2567 else
2568 TRACE_EVENT("pairing list ok");
2569 break;
2570 case 9:/* start bluetooth function scm_delete_paired_device() */
2571 memset(&hsg_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2572 if(bt_delete_paired_device(hsg_address) NEQ MFW_BT_OK)
2573 {
2574 TRACE_EVENT("mfw_bta:delete paired device Failure");
2575 }
2576 else
2577 TRACE_EVENT("delete paired devicet ok");
2578 break;
2579 case 10: /* start bluetooth primitive SCM_AUTHORIZATION_REQUEST for profile sync */
2580 bti_send_sync_authorization_request();
2581 break;
2582 case 11: /* start bluetooth primitive SCM_AUTHORIZATION_REQUEST for profile hsg */
2583 bti_send_hsg_authorization_request();
2584 break;
2585 case 12: /* start bluetooth primitive SCM_AUTHORIZATION_REQUEST for profile fsx */
2586 bti_send_fax_authorization_request();
2587 break;
2588 case 13: /* start bluetooth primitive SCM_AUTHORIZATION_REQUEST for profile dun */
2589 bti_send_dun_authorization_request();
2590 break;
2591 case 14: /* start bluetooth primitive SCM_AUTHORIZATION_REQUEST for profile opp */
2592 bti_send_opp_authorization_request();
2593 break;
2594 case 15: /* start bluetooth function scm_authorization_reply() for sync */
2595 auth_mode = MFW_BT_AUTHORIZED_ONCE;
2596 memset(&remote_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2597 auth_mask = MFW_SERVICE_SYNC_C;
2598 if(bt_authorization_reply(remote_address, auth_mask, auth_mode) NEQ MFW_BT_OK)
2599 {
2600 TRACE_EVENT("mfw_bta:auth reply sync Failure");
2601 }
2602 else
2603 TRACE_EVENT("auth reply sync ok");
2604 break;
2605 case 16: /* start bluetooth function scm_authorization_reply() for hsg */
2606 auth_mode = MFW_BT_AUTHORIZED_ONCE;
2607 memset(&remote_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2608 auth_mask = MFW_SERVICE_HSG;
2609 if(bt_authorization_reply(remote_address, auth_mask, auth_mode) NEQ MFW_BT_OK)
2610 {
2611 TRACE_EVENT("mfw_bta:auth reply hsg Failure");
2612 }
2613 else
2614 TRACE_EVENT("auth reply hsg ok");
2615 break;
2616 case 17: /* start bluetooth function scm_authorization_reply() for dun */
2617 auth_mode = MFW_BT_AUTHORIZED_ONCE;
2618 memset(&remote_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2619 auth_mask = MFW_SERVICE_DUN;
2620 if(bt_authorization_reply(remote_address, auth_mask, auth_mode) NEQ MFW_BT_OK)
2621 {
2622 TRACE_EVENT("mfw_bta:auth reply dun Failure");
2623 }
2624 else
2625 TRACE_EVENT("auth reply dun ok");
2626 break;
2627 case 18: /* start bluetooth function scm_authorization_reply() for fax */
2628 auth_mode = MFW_BT_AUTHORIZED_ONCE;
2629 memset(&remote_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2630 auth_mask = MFW_SERVICE_FAX;
2631 if(bt_authorization_reply(remote_address, auth_mask, auth_mode) NEQ MFW_BT_OK)
2632 {
2633 TRACE_EVENT("mfw_bta:auth reply fax Failure");
2634 }
2635 else
2636 TRACE_EVENT("auth reply fax ok");
2637 break;
2638 case 19: /* start bluetooth function scm_authorization_reply() for opp */
2639 auth_mode = MFW_BT_AUTHORIZED_ONCE;
2640 memset(&remote_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2641 auth_mask = MFW_SERVICE_OPP;
2642 if(bt_authorization_reply(remote_address, auth_mask, auth_mode) NEQ MFW_BT_OK)
2643 {
2644 TRACE_EVENT("mfw_bta:auth reply opp Failure");
2645 }
2646 else
2647 TRACE_EVENT("auth reply opp ok");
2648 break;
2649 case 20: /* start bluetooth function scm_get_device_authorization() */
2650 memset(&remote_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2651 if(bt_get_authorization_device(remote_address, &auth_mask) NEQ MFW_BT_OK)
2652 {
2653 TRACE_EVENT("mfw_bta:get device authorizations Failure");
2654 }
2655 else
2656 {
2657 TRACE_EVENT_P1("get authorizations:%x", auth_mask);
2658 }
2659 break;
2660 case 21: /* start bluetooth function scm_set_device_authorization() for fax */
2661 memset(&remote_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2662 auth_mask = MFW_SERVICE_FAX;
2663 if(bt_set_authorization_device(remote_address, auth_mask) NEQ MFW_BT_OK)
2664 {
2665 TRACE_EVENT("mfw_bta:set device authorization Failure");
2666 }
2667 else
2668 TRACE_EVENT("set authorization ok");
2669 break;
2670 case 22: /* start bluetooth function scm_set_device_authorization() for dun */
2671 memset(&remote_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2672 auth_mask = MFW_SERVICE_DUN;
2673 if(bt_set_authorization_device(remote_address, auth_mask) NEQ MFW_BT_OK)
2674 {
2675 TRACE_EVENT("mfw_bta:set device authorization Failure");
2676 }
2677 else
2678 TRACE_EVENT("set authorization ok");
2679 break;
2680 case 23: /* start bluetooth function scm_set_device_authorization() for hsg */
2681 memset(&remote_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2682 auth_mask = MFW_SERVICE_HSG;
2683 if(bt_set_authorization_device(remote_address, auth_mask) NEQ MFW_BT_OK)
2684 {
2685 TRACE_EVENT("mfw_bta:set device authorization Failure");
2686 }
2687 else
2688 TRACE_EVENT("set authorization ok");
2689 break;
2690 case 24: /* start bluetooth function scm_set_device_authorization() for opp */
2691 memset(&remote_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2692 auth_mask = MFW_SERVICE_OPP;
2693 if(bt_set_authorization_device(remote_address, auth_mask) NEQ MFW_BT_OK)
2694 {
2695 TRACE_EVENT("mfw_bta:set device authorization Failure");
2696 }
2697 else
2698 TRACE_EVENT("set authorization ok");
2699 break;
2700 case 25: /* start bluetooth function scm_set_device_authorization() for sync */
2701 memset(&remote_address, 0xcc, MFW_BT_ADDR_MAX_LEN);
2702 auth_mask = MFW_SERVICE_SYNC_C;
2703 if(bt_set_authorization_device(remote_address, auth_mask) NEQ MFW_BT_OK)
2704 {
2705 TRACE_EVENT("mfw_bta:set device authorization Failure");
2706 }
2707 else
2708 TRACE_EVENT("set authorization ok");
2709 break;
2710 }
2711 return TRUE;
2712
2713 /* end for test bluetooth without BMI/MMI ******************************************/
2714 }
2715 #endif
2716
2717 return FALSE; /* not processed by extension */
2718 }
2719