FreeCalypso > hg > fc-tourmaline
comparison src/ui/bmi/mmiBtipsBmg.c @ 3:67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:33:10 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:3a14ee9a9843 | 3:67bfe9f274f6 |
---|---|
1 /* ========================================================= | |
2 * Texas Instruments OMAP(TM) Platform Software | |
3 * (c) Copyright Texas Instruments, Incorporated. All Rights Reserved. | |
4 * | |
5 * Use of this software is controlled by the terms and conditions found | |
6 * in the license agreement under which this software has been supplied. | |
7 * ========================================================== */ | |
8 /* | |
9 $Project name: Basic Bluetooth MMI | |
10 $Project code: | |
11 $Module: Bluetooth BMG APPlication | |
12 $File: MmiBtipsBmg.c | |
13 $Revision: 1.0 | |
14 $Author: Texas Instruments | |
15 $Date: 26/06/07 | |
16 | |
17 ******************************************************************************** | |
18 | |
19 Description: | |
20 | |
21 This module provides the BTIPS BMG APPlication functionality. | |
22 | |
23 ******************************************************************************** | |
24 $History: MmiBtipsBmg.c | |
25 | |
26 26/06/07 Sasken original version | |
27 | |
28 $End | |
29 | |
30 *******************************************************************************/ | |
31 | |
32 | |
33 | |
34 | |
35 /******************************************************************************* | |
36 | |
37 Include files | |
38 | |
39 *******************************************************************************/ | |
40 | |
41 #define ENTITY_MFW | |
42 | |
43 #include <string.h> | |
44 | |
45 /* BTIPS Includes */ | |
46 #include "me.h" | |
47 | |
48 | |
49 #if defined (NEW_FRAME) | |
50 | |
51 #include "typedefs.h" | |
52 #include "vsi.h" | |
53 #include "pei.h" | |
54 #include "custom.h" | |
55 #include "gsm.h" | |
56 #include "prim.h" | |
57 | |
58 #else | |
59 | |
60 #include "STDDEFS.H" | |
61 #include "custom.h" | |
62 #include "gsm.h" | |
63 #include "vsi.h" | |
64 | |
65 #endif | |
66 | |
67 #include "mfw_mfw.h" | |
68 #include "mfw_win.h" | |
69 #include "mfw_icn.h" /* included for mfw_mnu.h */ | |
70 #include "mfw_mnu.h" | |
71 #include "mfw_tim.h" | |
72 #include "mfw_kbd.h" | |
73 #include "mfw_sat.h" /* included for MmiDummy.h, included for MmiMenu.h */ | |
74 #include "MmiBlkLangDB.h" | |
75 #include "mmiColours.h" | |
76 #include "MmiDialogs.h" | |
77 #include "MmiDummy.h" /* included for MmiMenu.h */ | |
78 #include "MmiLists.h" | |
79 #include "MmiMenu.h" | |
80 #include "MmiSoftKeys.h" | |
81 #include "AUIEditor.h" | |
82 #include "MmiMain.h" | |
83 #include "Mmiicons.h" | |
84 #include "MmiWindow.h" | |
85 #include "MmiCall.h" | |
86 #include "mmiBookShared.h" | |
87 | |
88 #include "mfw_Btips.h" | |
89 #include "Mfw_BtipsBmg.h" | |
90 | |
91 #include "mmiBtips.h" | |
92 #include "MmiBtipsBmg.h" | |
93 #include "AUIEditor_i.h" | |
94 CHAR noDeviceString[] = "No Devices"; | |
95 CHAR FindNewDeviceString[] = "Find New Device"; | |
96 CHAR SearchingDeviceString[] = "Searching Devices..."; | |
97 | |
98 extern MMI_Btips_data g_btipsData; | |
99 //UBYTE g_device_name[BT_MAX_REM_DEV_NAME] ; | |
100 T_MMI_BTIPS_SERVICES_STRUCT *services_data; | |
101 extern T_MFW_HND g_win_infodialog; | |
102 | |
103 #ifdef FF_MMI_BTIPS_APP | |
104 //Global Function calls | |
105 static int mmi_btips_bmg_devices_root_cb(T_MFW_EVENT evnt, void *para); | |
106 //static int mmi_btips_bmg_connected_devices_root_cb(T_MFW_EVENT evnt, void *para); | |
107 static int mmi_btips_bmg_devices_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter); | |
108 static int mmi_btips_bmg_connected_devices_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter); | |
109 static int mmi_btips_bmg_devices_win_cb (MfwEvt evt, MfwWin *win); | |
110 static int mmi_btips_bmg_connected_devices_win_cb (MfwEvt evt, MfwWin *win) ; | |
111 static int mmi_btips_bmg_devices_kbd_cntrl (MfwEvt e, MfwKbd *k); | |
112 static void mmi_btips_bmg_devices_win_exit (T_MFW_HND win); | |
113 static void mmi_btips_bmg_connected_devices_win_exit (T_MFW_HND win); | |
114 static T_MFW_HND mmi_btips_bmg_phoneName_editor_create(MfwHnd parent_window); | |
115 static void mmi_btips_bmg_phoneName_editor_exec_cb(T_MFW_HND win, USHORT event, void *parameter); | |
116 static void mmi_btips_bmg_phoneName_editor_edit_cb (T_MFW_HND win, USHORT Identifier, SHORT reason); | |
117 static void mmi_btips_bmg_phoneName_editor_destroy(MfwHnd own_window); | |
118 T_MFW_HND mmi_btips_bmg_ShowPairedDeviceList(T_MFW_HND win); | |
119 T_MFW_HND mmi_btips_bmg_ShowConnectedDevicesList(T_MFW_HND win); | |
120 T_MFW_HND mmi_btips_bmg_ShowInquiredDeviceList(T_MFW_HND win); | |
121 static void mmi_btips_bmg_device_list_cb(T_MFW_HND * parent, ListMenuData * ListData); | |
122 static void mmi_btips_bmg_connected_device_list_cb(T_MFW_HND * parent, ListMenuData* ListConnectedData); | |
123 static void mmi_btips_bmg_pinCode_editor_exec_cb(T_MFW_HND win, USHORT event, void *parameter); | |
124 static void mmi_btips_bmg_pinCode_editor_edit_cb (T_MFW_HND win, USHORT Identifier, SHORT reason); | |
125 static void mmi_btips_bmg_pinCode_editor_destroy(MfwHnd own_window); | |
126 static int mmi_btips_bmg_SetConnectPermission(T_MFW_HND win, BOOL permission); | |
127 BOOL mmi_btips_bmgDeviceShowServices(T_MFW_HND win , BOOL discoverServices); | |
128 static void mmi_btips_bmg_services_editor_exec_cb(T_MFW_HND win, USHORT identifier, SHORT reason); | |
129 void mmi_btips_bmg_services_editor_destroy(void); | |
130 T_MFW_HND mmi_btips_bmg_ask_cancelBond(T_MFW_HND parent, char * str1, char * str2, T_VOID_FUNC callback); | |
131 void mmi_btips_bmg_bonding_cancelled_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason); | |
132 void mmi_btips_refreshScreen(T_MFW_HND win, UBYTE identifier, UBYTE reason); | |
133 void mmi_btips_ResumeBTMainMenu(T_MFW_HND win, UBYTE identifier, UBYTE reason); | |
134 extern void mmi_btips_app_incoming_pairing_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason); | |
135 /****************************************************************************** | |
136 MFW BTIPS BMG Window Module (Creation, Deletion, Callbacks for MFW, Keyboard, etc) | |
137 ******************************************************************************/ | |
138 | |
139 /******************************************************************************* | |
140 | |
141 $Function: mmi_btips_bmg_devices_win_create | |
142 | |
143 $Description: This function performs the necessary steps to create the a window to handle the | |
144 viewfinder related softkeys and the viewfinder bitmaps. It will be removed, | |
145 or rather remove itself on returning the data to the Mfw. | |
146 | |
147 $Returns: T_MFW_HND : Window Handle to the New Window, Null if failed. | |
148 | |
149 $Arguments: parent : pointer to the parent window. | |
150 | |
151 *******************************************************************************/ | |
152 T_MFW_HND mmi_btips_bmg_devices_win_create(T_MFW_HND parent, BOOL searchType, T_MFW_BTIPS_SEARCH_CB searchCB) | |
153 { | |
154 T_MMI_Btips_Bmg_DevicesWin_data *data; | |
155 T_MFW_WIN * win; | |
156 | |
157 TRACE_FUNCTION ("mmi_btips_bmg_devices_win_create()"); | |
158 data = (T_MMI_Btips_Bmg_DevicesWin_data *)mfwAlloc((U16)sizeof(T_MMI_Btips_Bmg_DevicesWin_data)); | |
159 | |
160 data->win =(T_MFW_WIN * ) winCreate(parent, 0, MfwWinVisible|MfwWinSuspend|MfwWinResume|MfwWinDelete, | |
161 (MfwCb)mmi_btips_bmg_devices_win_cb); | |
162 TRACE_EVENT_P2("New window - %x , parent = %x",parent,data->win); | |
163 | |
164 if (data->win == NULL) | |
165 { | |
166 | |
167 //Failed to start : Free Memory, and exit | |
168 mfwFree((U8 *)data, (U16)sizeof(T_MMI_Btips_Bmg_DevicesWin_data)); | |
169 data = NULL; | |
170 return data; | |
171 } | |
172 else | |
173 { | |
174 | |
175 /* | |
176 ** Setup the Dialog control functions | |
177 */ | |
178 data->mmi_control.dialog = (T_DIALOG_FUNC)mmi_btips_bmg_devices_exec_cb; | |
179 data->mmi_control.data = data; | |
180 data->parent=parent; | |
181 win = (T_MFW_WIN *)getWinData(data->win); | |
182 win->user = (void *)data; | |
183 | |
184 //Create a BTIPS MFW component | |
185 if (data->mfwwin == NULL) | |
186 { | |
187 data->mfwwin = (T_MFW_HND)mfw_btips_create(data->win, | |
188 E_BTIPS_BMG_NAME_RESULT|E_BTIPS_BMG_SEARCH_COMPLETE| | |
189 E_BTIPS_BMG_SEARCH_CANCELLED|E_BTIPS_BMG_BOND_COMPLETE| | |
190 E_BTIPS_BMG_DEVICE_SERVICES|E_BTIPS_BMG_BOND_CANCELLED, | |
191 MfwTyBtipsBmg, (MfwCb)mmi_btips_bmg_devices_root_cb); | |
192 } | |
193 if (data->mfwwin== NULL) | |
194 { | |
195 TRACE_EVENT ("mfwwin create failed"); | |
196 /* | |
197 ** BTIPS mfw Component Failed to start | |
198 */ | |
199 winDelete(data->win); | |
200 return NULL; | |
201 } | |
202 | |
203 data->bondState = BOND_NOT_STARTED; | |
204 data->inquiryState = INQUIRY_NOT_STARTED; | |
205 data->searchCB = searchCB; | |
206 data->searchType = searchType; | |
207 | |
208 if (data->win NEQ NULL) | |
209 { | |
210 data->listID= SHOW_PAIRED_LIST; | |
211 data->list_win = mmi_btips_bmg_ShowPairedDeviceList(data->win); | |
212 } | |
213 | |
214 } | |
215 | |
216 /*Do the initialization of MMI BTIPS state-machine here, if any*/ | |
217 TRACE_EVENT_P1("mmi_btips_bmg_devices_win_create - new window %x", data->win); | |
218 | |
219 return data->win; | |
220 | |
221 } | |
222 /******************************************************************************* | |
223 | |
224 $Function: mmi_btips_bmg_connected_devices_win_create | |
225 | |
226 $Description: This function performs the necessary steps to create the a window to handle the | |
227 viewfinder related softkeys and the viewfinder bitmaps. It will be removed, | |
228 or rather remove itself on returning the data to the Mfw. | |
229 | |
230 $Returns: T_MFW_HND : Window Handle to the New Window, Null if failed. | |
231 | |
232 $Arguments: parent : pointer to the parent window. | |
233 | |
234 *******************************************************************************/ | |
235 T_MFW_HND mmi_btips_bmg_connected_devices_win_create(T_MFW_HND parent, BOOL searchType, T_MFW_BTIPS_SEARCH_CB searchCB) //CONNECTED | |
236 { | |
237 | |
238 T_MMI_Btips_Bmg_DevicesWin_data *data; | |
239 T_MFW_WIN * win; | |
240 | |
241 TRACE_FUNCTION ("mmi_btips_bmg_connected_devices_win_create()"); | |
242 data = (T_MMI_Btips_Bmg_DevicesWin_data *)mfwAlloc((U16)sizeof(T_MMI_Btips_Bmg_DevicesWin_data)); | |
243 | |
244 data->win =(T_MFW_WIN * ) winCreate(parent, 0, MfwWinVisible|MfwWinSuspend|MfwWinResume|MfwWinDelete, (MfwCb)mmi_btips_bmg_connected_devices_win_cb); | |
245 TRACE_EVENT_P2("New window - %x , parent = %x",parent,data->win); | |
246 | |
247 if (data->win == NULL) | |
248 { | |
249 | |
250 //Failed to start : Free Memory, and exit | |
251 mfwFree((U8 *)data, (U16)sizeof(T_MMI_Btips_Bmg_DevicesWin_data)); | |
252 data = NULL; | |
253 return data; | |
254 } | |
255 else | |
256 { | |
257 | |
258 /* | |
259 ** Setup the Dialog control functions | |
260 */ | |
261 data->mmi_control.dialog = (T_DIALOG_FUNC)mmi_btips_bmg_connected_devices_exec_cb; | |
262 data->mmi_control.data = data; | |
263 data->parent=parent; | |
264 win = (T_MFW_WIN *)getWinData(data->win); | |
265 win->user = (void *)data; | |
266 | |
267 | |
268 if (data->win NEQ NULL) | |
269 { | |
270 //data->listID= SHOW_PAIRED_LIST; | |
271 TRACE_FUNCTION("data->win NEQ NULL"); | |
272 data->list_connected_win = mmi_btips_bmg_ShowConnectedDevicesList(data->win); | |
273 } | |
274 | |
275 } | |
276 | |
277 /*Do the initialization of MMI BTIPS state-machine here, if any*/ | |
278 TRACE_EVENT_P1("mmi_btips_bmg_devices_win_create - new window %x", data->win); | |
279 | |
280 return data->win; | |
281 } | |
282 /******************************************************************************* | |
283 | |
284 $Function: mmi_btips_bmg_devices_root_cb | |
285 | |
286 $Description: This function is the notification from MFW to MMI for the FM Stack events that needs | |
287 updation on the FM Radio Main Window | |
288 | |
289 $Returns: None | |
290 | |
291 $Arguments: | |
292 | |
293 *******************************************************************************/ | |
294 static int mmi_btips_bmg_devices_root_cb(T_MFW_EVENT evnt, void *para) | |
295 { | |
296 T_MFW_HND win = mfw_parent(mfw_header()); | |
297 T_MFW_WIN * win_data; | |
298 T_MMI_Btips_Bmg_DevicesWin_data *data; | |
299 MfwBtBmgEvent bmgBtEvent; | |
300 | |
301 win_data = ((T_MFW_HDR *) win)->data; | |
302 data = (T_MMI_Btips_Bmg_DevicesWin_data *)win_data->user; | |
303 if(para != NULL) | |
304 { | |
305 bmgBtEvent = ((T_BTIPS_MMI_IND * )para)->data.bmgBtEvent; | |
306 } | |
307 | |
308 TRACE_FUNCTION_P1("mmi_btips_bmg_devices_root_cb - %d", evnt); | |
309 switch (evnt) | |
310 { | |
311 case E_BTIPS_BMG_NAME_RESULT: | |
312 /*Copy BD_ADDR and DeviceName from the Para*/ | |
313 if(INQUIRY_STARTED == data->inquiryState) | |
314 { | |
315 OS_MemCopy((U8*)&data->deviceList[data->noInquiredDevices].bdAddr, (U8*)&bmgBtEvent.bdAddr, sizeof(BD_ADDR)); | |
316 strcpy(data->deviceList[data->noInquiredDevices].name, bmgBtEvent.p.deviceName); | |
317 data->deviceList[data->noInquiredDevices].myIndex = data->noInquiredDevices; | |
318 data->noInquiredDevices++; | |
319 | |
320 /*Signal to create a new list with all newly found devices once the current list is deleted*/ | |
321 SEND_EVENT (data->win, BTIPS_BMG_INQUIRY_RESULT_DEVICES_INIT,0, (void *)NULL); | |
322 /*Delete the current list whatever - previous window showing paired devices or | |
323 the window showing the devices being discovered*/ | |
324 SEND_EVENT (data->win, BTIPS_BMG_DEVICES_LIST_WIN_DEINIT, 0, (void *)NULL); | |
325 } | |
326 else | |
327 return MFW_EVENT_REJECTED; | |
328 break; | |
329 | |
330 case E_BTIPS_BMG_SEARCH_COMPLETE: | |
331 data->inquiryState = INQUIRY_COMPLETE; | |
332 /*Signal to create a new list with all newly found devices once the current list is deleted*/ | |
333 SEND_EVENT (data->win, BTIPS_BMG_INQUIRY_RESULT_DEVICES_INIT,0, (void *)NULL); | |
334 /*Delete the current list : window showing the devices being discovered | |
335 Title should change to Find New Device*/ | |
336 SEND_EVENT (data->win, BTIPS_BMG_DEVICES_LIST_WIN_DEINIT, 0, (void *)NULL); | |
337 break; | |
338 | |
339 case E_BTIPS_BMG_SEARCH_CANCELLED: | |
340 #if 0 | |
341 /*We fail to get this event, hence commented for the time-being*/ | |
342 /*User might have requested to do a bonding while the inquiry was ongoing | |
343 Now that the inquiry is cancelled, start the bond-process*/ | |
344 if(BOND_USER_REQUESTED == data->bondState) | |
345 SEND_EVENT (data->win, BTIPS_BMG_BONDING_REQUEST_INIT, 0, (void *)NULL); | |
346 #endif | |
347 break; | |
348 | |
349 case E_BTIPS_BMG_BOND_COMPLETE: | |
350 { | |
351 MfwBtBmgEvent bmgBtEvent = ((T_BTIPS_MMI_IND * )para)->data.bmgBtEvent; | |
352 TRACE_EVENT_P1("E_BTIPS_BMG_BOND_COMPLETE: current state = %d", data->bondState); | |
353 | |
354 | |
355 if(BOND_PIN_TAKEN == data->bondState) | |
356 { | |
357 data->bondState = BOND_NOT_STARTED; | |
358 | |
359 if (bmgBtEvent.errCode == 0) //Success | |
360 { | |
361 mmi_btips_app_show_text(win, "Bonded with",data->deviceList[data->currentListIndex-1].name, NULL); | |
362 } | |
363 else | |
364 { | |
365 mmi_btips_app_show_text(win, "Bond failed with",data->deviceList[data->currentListIndex-1].name, NULL); | |
366 } | |
367 //26-07-07 | |
368 mfw_btips_bmgSetDeviceNameInRecord(&data->deviceList[data->currentListIndex-1].bdAddr, data->deviceList[data->currentListIndex-1].name); | |
369 | |
370 dialog_info_destroy(data->bondCancellationWindow); | |
371 data->bondCancellationWindow = NULL; | |
372 | |
373 if(BTIPS_GENERIC_DEVICE_SEARCH == data->searchType) | |
374 { | |
375 SEND_EVENT (data->win, BTIPS_BMG_PAIRED_DEVICES_INIT,0, (void *)NULL); | |
376 } | |
377 else | |
378 { | |
379 if (bmgBtEvent.errCode == 0) | |
380 data->searchCB(data->deviceList[data->currentListIndex-1].bdAddr); | |
381 else | |
382 { | |
383 BD_ADDR bdAddr = {0}; | |
384 data->searchCB(bdAddr); | |
385 } | |
386 } | |
387 } | |
388 break; | |
389 } | |
390 case E_BTIPS_BMG_BOND_CANCELLED: | |
391 #if 0 | |
392 /*Signal to create a new list with all newly found devices once the current list is deleted*/ | |
393 SEND_EVENT (data->win, BTIPS_BMG_PAIRED_DEVICES_INIT,0, (void *)NULL); | |
394 /*Delete the current list whatever - previous window showing paired devices or | |
395 the window showing the devices being discovered*/ | |
396 SEND_EVENT (data->win, BTIPS_BMG_DEVICES_LIST_WIN_DEINIT, 0, (void *)NULL); | |
397 #endif | |
398 break; | |
399 | |
400 case E_BTIPS_BMG_DEVICE_SERVICES : | |
401 | |
402 TRACE_EVENT_P1(" mmi_btips_bmg_devices_root_cb services mask %x",bmgBtEvent.p.discoveredServicesMask); | |
403 dialog_info_destroy (g_win_infodialog); | |
404 if(bmgBtEvent.p.discoveredServicesMask) | |
405 mfw_btips_bmgSetDeviceRecord(&bmgBtEvent.bdAddr, bmgBtEvent.p.discoveredServicesMask); | |
406 | |
407 mmi_btips_bmg_services_editor_create(win , bmgBtEvent.p.discoveredServicesMask); | |
408 break; | |
409 | |
410 default: | |
411 TRACE_EVENT("E_BTIPS_BMG_DEFAULT"); | |
412 return MFW_EVENT_REJECTED; | |
413 } | |
414 | |
415 dspl_Enable(1); | |
416 return MFW_EVENT_CONSUMED; | |
417 } | |
418 | |
419 | |
420 /******************************************************************************* | |
421 | |
422 $Function: mmi_btips_bmg_devices_exec_cb | |
423 | |
424 $Description: This is the dialog control function for the FMRadio Window. It | |
425 receives the signals from the MFW and determines what action, if any, to take. | |
426 | |
427 $Returns: None | |
428 | |
429 $Arguments: win : The pointer to the window handler, so the function can reference the | |
430 dynamic user data, if any. | |
431 event : The incoming event | |
432 value : Generic incoming Parameter, it will be 'event' dependant | |
433 parameter : Generic incoming Parameter, it will be 'event' dependant | |
434 | |
435 *******************************************************************************/ | |
436 static int mmi_btips_bmg_devices_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
437 { | |
438 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
439 T_MMI_Btips_Bmg_DevicesWin_data * data = (T_MMI_Btips_Bmg_DevicesWin_data *)win_data->user; | |
440 | |
441 TRACE_FUNCTION("mmi_btips_bmg_devices_exec_cb()"); | |
442 TRACE_EVENT_P2("mmi_btips_bmg_devices_exec_cb - list-win - %x %d", data->list_win, event); | |
443 | |
444 switch (event) | |
445 { | |
446 case BTIPS_BMG_PAIRED_DEVICES_INIT: | |
447 /*Create the Paired device List in Resume of mmi_btips_bmg_devices_win_cb*/ | |
448 data->listID = SHOW_PAIRED_LIST; | |
449 break; | |
450 | |
451 case BTIPS_BMG_INQUIRY_RESULT_DEVICES_INIT: | |
452 /* create the list with the newly discovered devices Resume of mmi_btips_bmg_devices_win_cb*/ | |
453 data->listID = SHOW_SEARCH_LIST; | |
454 break; | |
455 | |
456 case BTIPS_BMG_DEVICES_LIST_WIN_DEINIT: | |
457 if(data->list_win) | |
458 { | |
459 listsDestroy(data->list_win); | |
460 } | |
461 break; | |
462 | |
463 case BTIPS_BMG_BONDING_REQUEST_INIT: | |
464 TRACE_EVENT("BTIPS_BMG_BONDING_REQUEST_INIT"); | |
465 if(INQUIRY_NOT_STARTED == data->inquiryState || INQUIRY_COMPLETE == data->inquiryState) | |
466 { | |
467 | |
468 data->inquiryState = INQUIRY_NOT_STARTED; | |
469 /*Launch the editor for taking pin-code request*/ | |
470 data->pinCode_editor = mmi_btips_bmg_pinCode_editor_create(win); | |
471 SEND_EVENT(data->pinCode_editor, BTIPS_BMG_LOCAL_EDITOR_INIT, 0, 0); | |
472 } | |
473 break; | |
474 | |
475 case BTIPS_BMG_BONDING_REQUEST_SENT: | |
476 data->bondCancellationWindow = mmi_btips_bmg_ask_cancelBond(win, "Bonding", "in Progress", mmi_btips_bmg_bonding_cancelled_cb); | |
477 break; | |
478 | |
479 case BTIPS_BMG_DEVICES_EXIT_WIN: | |
480 mmi_btips_bmg_devices_win_exit(data->win); | |
481 break; | |
482 case LISTS_REASON_RESUME: | |
483 break; | |
484 case LISTS_REASON_SUSPEND: | |
485 break; | |
486 case LISTS_REASON_VISIBLE: | |
487 break; | |
488 | |
489 default: | |
490 TRACE_EVENT("BTIPS BMG DEVICES DEFAULT "); | |
491 } | |
492 | |
493 TRACE_EVENT_P2("EXEC CB LEAVE - list-win - %x %d", data->list_win, event); | |
494 | |
495 return MFW_EVENT_CONSUMED; | |
496 } | |
497 | |
498 | |
499 /******************************************************************************* | |
500 | |
501 $Function: mmi_btips_bmg_connected_devices_exec_cb | |
502 | |
503 $Description: This is the dialog control function for the FMRadio Window. It | |
504 receives the signals from the MFW and determines what action, if any, to take. | |
505 | |
506 $Returns: None | |
507 | |
508 $Arguments: win : The pointer to the window handler, so the function can reference the | |
509 dynamic user data, if any. | |
510 event : The incoming event | |
511 value : Generic incoming Parameter, it will be 'event' dependant | |
512 parameter : Generic incoming Parameter, it will be 'event' dependant | |
513 | |
514 *******************************************************************************/ | |
515 static int mmi_btips_bmg_connected_devices_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) //CONNECTED | |
516 { | |
517 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
518 T_MMI_Btips_Bmg_DevicesWin_data * data = (T_MMI_Btips_Bmg_DevicesWin_data *)win_data->user; | |
519 | |
520 TRACE_FUNCTION("mmi_btips_bmg_connected_devices_exec_cb()"); | |
521 TRACE_EVENT_P2("mmi_btips_bmg_connected_devices_exec_cb - list-win - %x %d", data->list_win, event); | |
522 | |
523 switch (event) | |
524 { | |
525 case BTIPS_BMG_CONNECTED_DEVICES_EXIT_WIN: | |
526 TRACE_FUNCTION("BTIPS_BMG_CONNECTED_DEVICES_EXIT_WIN"); | |
527 mmi_btips_bmg_connected_devices_win_exit(data->win); | |
528 break; | |
529 case LISTS_REASON_RESUME: | |
530 break; | |
531 case LISTS_REASON_SUSPEND: | |
532 break; | |
533 case LISTS_REASON_VISIBLE: | |
534 break; | |
535 | |
536 default: | |
537 TRACE_EVENT("BTIPS_BMG_CONNECTED_DEVICES_DEFAULT "); | |
538 } | |
539 | |
540 TRACE_EVENT_P2("EXEC CB LEAVE - list-win - %x %d", data->list_win, event); | |
541 | |
542 return MFW_EVENT_CONSUMED; | |
543 } | |
544 | |
545 /******************************************************************************* | |
546 | |
547 $Function: mmi_btips_bmg_devices_win_cb | |
548 | |
549 $Description: This function is the windows callback function for the mmi FMRadio Root window. | |
550 It has no display. | |
551 | |
552 $Returns: MFW_EVENT_CONSUMED | |
553 | |
554 $Arguments: event - window handle event | |
555 win - FMRadio window | |
556 | |
557 *******************************************************************************/ | |
558 static int mmi_btips_bmg_devices_win_cb (MfwEvt evt, MfwWin *win) | |
559 { | |
560 T_MMI_Btips_Bmg_DevicesWin_data *data = (T_MMI_Btips_Bmg_DevicesWin_data *)win->user; | |
561 | |
562 TRACE_FUNCTION("mmi_btips_bmg_devices_win_cb()"); | |
563 TRACE_EVENT_P2("mmi_btips_bmg_devices_win_cb - list-data - %x %d",data->list_win, data->listID); | |
564 | |
565 switch (evt) | |
566 { | |
567 case MfwWinVisible: /* window is visible */ | |
568 TRACE_EVENT("MfwWinVisible"); | |
569 break; | |
570 case MfwWinSuspend: /* window is suspended */ | |
571 TRACE_EVENT("MfwWinSuspend"); | |
572 break; | |
573 case MfwWinResume: /* window is resumed */ | |
574 TRACE_EVENT("MfwWinResume"); | |
575 | |
576 if(BOND_PIN_TAKEN != data->bondState ) | |
577 { | |
578 /*Thsi window is resumed because | |
579 1. User navigated back from the Device List OR wanted to refresh the list | |
580 2. After bonding process, the editor is destroyed. In this case, there is no | |
581 menu_list_data to be destroyed*/ | |
582 if (data->menu_list_data != NULL) | |
583 { | |
584 mfwFree( (U8 *)data->menu_list_data->List,((data->listCount) * sizeof(T_MFW_MNU_ITEM) )); | |
585 mfwFree ((U8 *)data->menu_list_data, sizeof(ListMenuData)); | |
586 } | |
587 } | |
588 if(SHOW_PAIRED_LIST == data->listID) | |
589 data->list_win = mmi_btips_bmg_ShowPairedDeviceList(data->win); | |
590 else if(SHOW_SEARCH_LIST == data->listID) | |
591 data->list_win = mmi_btips_bmg_ShowInquiredDeviceList(data->win); | |
592 else if(SHOW_NONE_EXIT == data->listID) | |
593 {} | |
594 else if(SHOW_NO_LIST == data->listID) | |
595 {/*No action*/} | |
596 | |
597 break; | |
598 case MfwWinDelete: /* window will be deleted */ | |
599 TRACE_EVENT("MfwWinDelete"); | |
600 break; | |
601 case MfwWinFocussed: /* input focus / selected */ | |
602 TRACE_EVENT("MfwWinFocussed"); | |
603 break; | |
604 default: | |
605 TRACE_EVENT("DEFAULT"); | |
606 return MFW_EVENT_REJECTED; | |
607 } | |
608 dspl_Enable(1); | |
609 | |
610 return MFW_EVENT_CONSUMED; | |
611 | |
612 } | |
613 | |
614 | |
615 /******************************************************************************* | |
616 | |
617 $Function: mmi_btips_bmg_connected_devices_win_cb | |
618 | |
619 $Description: This function is the windows callback function for the mmi FMRadio Root window. | |
620 It has no display. | |
621 | |
622 $Returns: MFW_EVENT_CONSUMED | |
623 | |
624 $Arguments: event - window handle event | |
625 win - FMRadio window | |
626 | |
627 *******************************************************************************/ | |
628 static int mmi_btips_bmg_connected_devices_win_cb (MfwEvt evt, MfwWin *win) //CONNECTED | |
629 { | |
630 T_MMI_Btips_Bmg_DevicesWin_data *data = (T_MMI_Btips_Bmg_DevicesWin_data *)win->user; | |
631 | |
632 TRACE_FUNCTION("mmi_btips_bmg_connected_devices_win_cb()"); | |
633 TRACE_EVENT_P1("mmi_btips_bmg_connected_devices_win_cb - list-data - %x ",data->list_connected_win); | |
634 | |
635 switch (evt) | |
636 { | |
637 case MfwWinVisible: /* window is visible */ | |
638 TRACE_EVENT("MfwWinVisible"); | |
639 break; | |
640 case MfwWinSuspend: /* window is suspended */ | |
641 TRACE_EVENT("MfwWinSuspend"); | |
642 break; | |
643 case MfwWinResume: /* window is resumed */ | |
644 TRACE_EVENT("MfwWinResume"); | |
645 if (data->menu_list_data != NULL) | |
646 { | |
647 mfwFree( (U8 *)data->menu_list_connected_data->List,((data->listCountConnectedDevices) * sizeof(T_MFW_MNU_ITEM) )); | |
648 mfwFree ((U8 *)data->menu_list_connected_data, sizeof(ListMenuData)); | |
649 } | |
650 /*noConnectedDevices:- This value was just now computed in the List Menu creation. | |
651 Now the control is here because the a device was disconnected and | |
652 the list may have to be recreated depending on noConnectedDevices */ | |
653 if(data->noConnectedDevices) | |
654 { | |
655 data->list_win = mmi_btips_bmg_ShowConnectedDevicesList(data->win); | |
656 } | |
657 break; | |
658 case MfwWinDelete: /* window will be deleted */ | |
659 TRACE_EVENT("MfwWinDelete"); | |
660 break; | |
661 case MfwWinFocussed: /* input focus / selected */ | |
662 TRACE_EVENT("MfwWinFocussed"); | |
663 break; | |
664 default: | |
665 TRACE_EVENT("DEFAULT"); | |
666 return MFW_EVENT_REJECTED; | |
667 } | |
668 | |
669 | |
670 return MFW_EVENT_CONSUMED; | |
671 | |
672 } | |
673 /******************************************************************************* | |
674 | |
675 $Function: mmi_btips_bmg_devices_exit | |
676 | |
677 $Description: exits the FM application | |
678 | |
679 $Returns: None | |
680 | |
681 $Arguments: win | |
682 | |
683 *******************************************************************************/ | |
684 static void mmi_btips_bmg_devices_win_exit (T_MFW_HND win) | |
685 { | |
686 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
687 T_MMI_Btips_Bmg_DevicesWin_data * data = (T_MMI_Btips_Bmg_DevicesWin_data *)win_data->user; | |
688 | |
689 TRACE_FUNCTION("mmi_btips_bmg_devices_exit()"); | |
690 | |
691 mfw_btips_delete(data->mfwwin); | |
692 if(data->win != NULL) | |
693 { | |
694 winDelete (data->win); | |
695 mfwFree((void *)data, sizeof (T_MMI_Btips_Bmg_DevicesWin_data)); | |
696 } | |
697 return; | |
698 } | |
699 | |
700 /******************************************************************************* | |
701 | |
702 $Function: mmi_btips_bmg_connected_devices_win_exit | |
703 | |
704 $Description: exits the FM application | |
705 | |
706 $Returns: None | |
707 | |
708 $Arguments: win | |
709 | |
710 *******************************************************************************/ | |
711 static void mmi_btips_bmg_connected_devices_win_exit (T_MFW_HND win) | |
712 { | |
713 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
714 T_MMI_Btips_Bmg_DevicesWin_data * data = (T_MMI_Btips_Bmg_DevicesWin_data *)win_data->user; | |
715 | |
716 TRACE_FUNCTION("mmi_btips_bmg_connected_devices_win_exit()"); | |
717 | |
718 mfw_btips_delete(data->mfwwin); | |
719 if(data->win != NULL) | |
720 { | |
721 winDelete (data->win); | |
722 mfwFree((void *)data, sizeof (T_MMI_Btips_Bmg_DevicesWin_data)); | |
723 } | |
724 return; | |
725 } | |
726 | |
727 /****************************************************************************** | |
728 BTIPS BMG EDITOR for Phone Name | |
729 ******************************************************************************/ | |
730 | |
731 /******************************************************************************* | |
732 | |
733 $Function: mmi_btips_bmg_phoneName_editor_create | |
734 | |
735 $Description: Create a window for entering the text | |
736 | |
737 $Returns: window handle | |
738 | |
739 $Arguments: parent_window - parent window. | |
740 | |
741 *******************************************************************************/ | |
742 | |
743 static T_MFW_HND mmi_btips_bmg_phoneName_editor_create(MfwHnd parent_window) | |
744 { | |
745 | |
746 T_MMI_Btips_Bmg_PhoneName_Win_data * data = (T_MMI_Btips_Bmg_PhoneName_Win_data *)mfwAlloc (sizeof (T_MMI_Btips_Bmg_PhoneName_Win_data)); | |
747 T_MFW_WIN * win; | |
748 TRACE_FUNCTION ("mmi_btips_bmg_phoneName_editor_create()"); | |
749 | |
750 // Create window handler | |
751 data->win = win_create (parent_window, 0, E_WIN_VISIBLE, NULL); | |
752 if (data->win EQ NULL) | |
753 { | |
754 return NULL; | |
755 } | |
756 | |
757 // connect the dialog data to the MFW-window | |
758 data->mmi_control.dialog = (T_DIALOG_FUNC)mmi_btips_bmg_phoneName_editor_exec_cb; | |
759 data->mmi_control.data = data; | |
760 win = ((T_MFW_HDR *)data->win)->data; | |
761 win->user = (void *)data; | |
762 data->parent = parent_window; | |
763 | |
764 winShow(data->win); | |
765 return data->win; | |
766 } | |
767 | |
768 /******************************************************************************* | |
769 | |
770 $Function: mmi_btips_bmg_phoneName_editor_exec_cb | |
771 | |
772 $Description: Callback handler for events sent by the CENTREEDIT editor | |
773 | |
774 $Returns: none | |
775 | |
776 $Arguments: win - current window | |
777 event - event id | |
778 parameter - optional data. | |
779 *******************************************************************************/ | |
780 | |
781 static void mmi_btips_bmg_phoneName_editor_exec_cb(T_MFW_HND win, USHORT event, void *parameter) | |
782 { | |
783 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
784 T_MMI_Btips_Bmg_PhoneName_Win_data * data = (T_MMI_Btips_Bmg_PhoneName_Win_data *)win_data->user; | |
785 | |
786 #ifdef NEW_EDITOR | |
787 T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */ | |
788 #else | |
789 T_EDITOR_DATA editor_data; | |
790 #endif | |
791 | |
792 TRACE_FUNCTION ("mmi_btips_bmg_phoneName_editor_exec_cb()"); | |
793 | |
794 switch (event) | |
795 { | |
796 case BTIPS_BMG_LOCAL_EDITOR_INIT: | |
797 /* SPR#1428 - SH - New Editor changes */ | |
798 data->local_device = TRUE; //Indicates we are setting a local device name | |
799 memset(data->phoneNameBuffer,0,BT_MAX_REM_DEV_NAME); | |
800 /*Display the current value*/ | |
801 mfw_btips_bmgGetLocalDeviceName(data->phoneNameBuffer); | |
802 #ifdef NEW_EDITOR | |
803 AUI_edit_SetDefault(&editor_data); | |
804 AUI_edit_SetDisplay(&editor_data, CENTRE_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT); | |
805 AUI_edit_SetEvents(&editor_data, *(USHORT*)parameter, TRUE, FOREVER, (T_AUI_EDIT_CB)mmi_btips_bmg_phoneName_editor_edit_cb); | |
806 AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtBtipsPhoneName, NULL); | |
807 AUI_edit_SetAltTextStr(&editor_data, 1, TxtNull, TRUE, TxtSoftBack); | |
808 AUI_edit_SetMode(&editor_data, ED_MODE_ALPHA, ED_CURSOR_UNDERLINE); | |
809 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, data->phoneNameBuffer, PHB_MAX_LEN); | |
810 data->phoneName_editor = AUI_edit_Start(data->win, &editor_data); | |
811 #else /* NEW_EDITOR */ | |
812 | |
813 SmsSend_loadEditDefault(&editor_data); | |
814 bookSetEditAttributes( CENTRE_EDITOR, COLOUR_EDITOR_XX, 0, edtCurBar1, 0, | |
815 (char *) data->phoneNameBuffer, NUMBER_LENGTH, &editor_data.editor_attr); | |
816 | |
817 editor_data.TextId = TxtBtipsPhoneName; | |
818 editor_data.editor_attr.text = (char *)data->phoneNameBuffer; | |
819 editor_data.editor_attr.size = PHB_MAX_LEN; | |
820 editor_data.LeftSoftKey = TxtSoftOK; | |
821 editor_data.RightSoftKey = TxtDelete; | |
822 editor_data.Identifier = *(USHORT*)parameter; | |
823 editor_data.Callback = (T_EDIT_CB)mmi_btips_bmg_phoneName_editor_edit_cb; | |
824 editor_data.mode = E_EDIT_ALPHA_MODE; | |
825 editor_data.destroyEditor = TRUE ; | |
826 data->phoneName_editor = editor_start(data->win,&editor_data); | |
827 /* start the Service Centre Number editor */ | |
828 #endif /* NEW_EDITOR */ | |
829 break; | |
830 case BTIPS_BMG_REMOTE_EDITOR_INIT: | |
831 { | |
832 T_MMI_Btips_Bmg_DevicesWin_data *parent_data = (T_MMI_Btips_Bmg_DevicesWin_data *)win_data->user; | |
833 | |
834 /* SPR#1428 - SH - New Editor changes */ | |
835 /*T_MFW_WIN * win_data_remote = ((T_MFW_HDR *) win)->data; | |
836 tBookStandard * data_remote = (tBookStandard *)win_data_remote->user; | |
837 | |
838 T_MFW_WIN *parent_win_data = ((T_MFW_HDR *) data_remote->parent_win)->data; | |
839 T_MMI_Btips_Bmg_DevicesWin_data * parent_data = (T_MMI_Btips_Bmg_DevicesWin_data *)parent_win_data->user; | |
840 T_MFW_HND parent_win = parent_data->win;*/ | |
841 data->local_device = FALSE; //Indicates we are setting a local device name | |
842 #ifdef NEW_EDITOR | |
843 AUI_edit_SetDefault(&editor_data); | |
844 AUI_edit_SetDisplay(&editor_data, CENTRE_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT); | |
845 AUI_edit_SetEvents(&editor_data, *(USHORT*)parameter, TRUE, FOREVER, (T_AUI_EDIT_CB)mmi_btips_bmg_phoneName_editor_edit_cb); | |
846 AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtBtipsPhoneName, NULL); | |
847 AUI_edit_SetAltTextStr(&editor_data, 1, TxtNull, TRUE, TxtSoftBack); | |
848 AUI_edit_SetMode(&editor_data, ED_MODE_ALPHA, ED_CURSOR_UNDERLINE); | |
849 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, data->phoneNameBuffer, PHB_MAX_LEN); | |
850 data->phoneName_editor = AUI_edit_Start(data->win, &editor_data); | |
851 #else /* NEW_EDITOR */ | |
852 | |
853 SmsSend_loadEditDefault(&editor_data); | |
854 bookSetEditAttributes( CENTRE_EDITOR, COLOUR_EDITOR_XX, 0, edtCurBar1, 0, | |
855 (char *) data->phoneNameBuffer, NUMBER_LENGTH, &editor_data.editor_attr); | |
856 | |
857 editor_data.TextId = TxtBtipsPhoneName; | |
858 editor_data.editor_attr.text = (char *)data->phoneNameBuffer; | |
859 editor_data.editor_attr.size = PHB_MAX_LEN; | |
860 editor_data.LeftSoftKey = TxtSoftOK; | |
861 editor_data.RightSoftKey = TxtDelete; | |
862 editor_data.Identifier = *(USHORT*)parameter; | |
863 editor_data.Callback = (T_EDIT_CB)mmi_btips_bmg_phoneName_editor_edit_cb; | |
864 editor_data.mode = E_EDIT_ALPHA_MODE; | |
865 editor_data.destroyEditor = TRUE ; | |
866 data->phoneName_editor = editor_start(data->win,&editor_data); | |
867 /* start the Service Centre Number editor */ | |
868 #endif /* NEW_EDITOR */ | |
869 break; | |
870 } | |
871 case BTIPS_BMG_EDITOR_CANCEL: | |
872 | |
873 break; | |
874 default: | |
875 TRACE_EVENT("Err: Default"); | |
876 return; | |
877 } | |
878 } | |
879 | |
880 /******************************************************************************* | |
881 | |
882 $Function: mmi_btips_bmg_phoneName_editor_edit_cb | |
883 | |
884 $Description: Callback function for the center number editor | |
885 | |
886 $Returns: none | |
887 | |
888 $Arguments: win - current window | |
889 Identifier - unique id | |
890 reason - event cause | |
891 *******************************************************************************/ | |
892 | |
893 static void mmi_btips_bmg_phoneName_editor_edit_cb (T_MFW_HND win, USHORT Identifier, SHORT reason) | |
894 { | |
895 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
896 T_MMI_Btips_Bmg_PhoneName_Win_data * data = (T_MMI_Btips_Bmg_PhoneName_Win_data *)win_data->user; | |
897 | |
898 TRACE_FUNCTION ("mmi_btips_bmg_phoneName_editor_edit_cb()"); | |
899 | |
900 TRACE_EVENT_P1("PhoneName Editor: %s", data->phoneNameBuffer); | |
901 | |
902 switch (reason) | |
903 { | |
904 case INFO_KCD_LEFT: | |
905 TRACE_EVENT("mmi_btips_bmg_phoneName_editor_edit_cb,INFO_KCD_LEFT "); | |
906 | |
907 if(data->local_device) | |
908 { | |
909 if(!mfw_btips_bmgSetLocalDeviceName(data->phoneNameBuffer)) | |
910 mmi_btips_app_show_info(win,TxtBtipsRename,TxtFailed,ONE_SECS,NULL); | |
911 /* SPR#1428 - SH - New Editor changes */ | |
912 #ifdef NEW_EDITOR | |
913 AUI_edit_Destroy(data->phoneName_editor); | |
914 #else /* NEW_EDITOR */ | |
915 editor_destroy(data->phoneName_editor); | |
916 #endif /* NEW_EDITOR */ | |
917 } | |
918 else | |
919 { | |
920 T_MMI_Btips_Bmg_DevicesWin_data *parent_data= (T_MMI_Btips_Bmg_DevicesWin_data *)win_data->user ; | |
921 if(!mfw_btips_bmgSetRemoteDeviceName(&parent_data->deviceList[parent_data->currentListIndex-1].bdAddr, data->phoneNameBuffer)) | |
922 mmi_btips_app_show_info(win,TxtBtipsRename,TxtFailed,ONE_SECS,NULL); | |
923 #ifdef NEW_EDITOR | |
924 AUI_edit_Destroy(data->phoneName_editor); | |
925 #else /* NEW_EDITOR */ | |
926 editor_destroy(data->phoneName_editor); | |
927 #endif /* NEW_EDITOR */ | |
928 } | |
929 | |
930 mmi_btips_bmg_phoneName_editor_destroy(win); | |
931 break; | |
932 | |
933 case INFO_KCD_RIGHT: | |
934 case INFO_KCD_HUP: | |
935 #ifdef NEW_EDITOR | |
936 AUI_edit_Destroy(data->phoneName_editor); | |
937 #else /* NEW_EDITOR */ | |
938 editor_destroy(data->phoneName_editor); | |
939 #endif /* NEW_EDITOR */ | |
940 | |
941 mmi_btips_bmg_phoneName_editor_destroy(win); | |
942 data->phoneName_editor= 0; | |
943 break; | |
944 default: | |
945 | |
946 break; | |
947 } | |
948 } | |
949 /******************************************************************************* | |
950 | |
951 $Function: mmi_btips_bmg_phoneName_editor_destroy | |
952 | |
953 $Description: Destroy the windows for entering the text | |
954 | |
955 $Returns: none | |
956 | |
957 $Arguments: own_window - window. | |
958 | |
959 *******************************************************************************/ | |
960 | |
961 static void mmi_btips_bmg_phoneName_editor_destroy(MfwHnd own_window) | |
962 { | |
963 T_MFW_WIN * win_data; | |
964 T_MMI_Btips_Bmg_PhoneName_Win_data * data = NULL; | |
965 | |
966 TRACE_FUNCTION ("mmi_btips_bmg_phoneName_editor_destroy()"); | |
967 | |
968 if (own_window) | |
969 { | |
970 win_data = ((T_MFW_HDR *)own_window)->data; | |
971 if (win_data != NULL) | |
972 data = (T_MMI_Btips_Bmg_PhoneName_Win_data *)win_data->user; | |
973 | |
974 if (data) | |
975 { | |
976 | |
977 | |
978 // Delete WIN handler | |
979 win_delete (data->win); | |
980 | |
981 // Free Memory | |
982 mfwFree ((void *)data, sizeof (T_MMI_Btips_Bmg_PhoneName_Win_data)); | |
983 //win_data->user = NULL; | |
984 } | |
985 else | |
986 { | |
987 TRACE_EVENT ("mmi_btips_bmg_phoneName_editor_destroy() called twice"); | |
988 } | |
989 } | |
990 } | |
991 | |
992 | |
993 | |
994 | |
995 | |
996 /******************************************************************************* | |
997 | |
998 $Function: mmi_btips_bmg_pinCode_editor_create | |
999 | |
1000 $Description: Create a window for entering the text | |
1001 | |
1002 $Returns: window handle | |
1003 | |
1004 $Arguments: parent_window - parent window. | |
1005 | |
1006 *******************************************************************************/ | |
1007 | |
1008 T_MFW_HND mmi_btips_bmg_pinCode_editor_create(MfwHnd parent_window) | |
1009 { | |
1010 | |
1011 T_MMI_Btips_Bmg_PinCode_Win_data * data = (T_MMI_Btips_Bmg_PinCode_Win_data *)mfwAlloc (sizeof (T_MMI_Btips_Bmg_PinCode_Win_data)); | |
1012 T_MFW_WIN * win; | |
1013 TRACE_FUNCTION ("mmi_btips_bmg_pinCode_editor_create()"); | |
1014 TRACE_EVENT_P1 ("mmi_btips_bmg_pinCode_editor_create - %x", parent_window); | |
1015 // Create window handler | |
1016 data->win = win_create (parent_window, 0, E_WIN_VISIBLE, NULL); | |
1017 if (data->win EQ NULL) | |
1018 { | |
1019 return NULL; | |
1020 } | |
1021 | |
1022 // connect the dialog data to the MFW-window | |
1023 data->mmi_control.dialog = (T_DIALOG_FUNC)mmi_btips_bmg_pinCode_editor_exec_cb; | |
1024 data->mmi_control.data = data; | |
1025 win = ((T_MFW_HDR *)data->win)->data; | |
1026 win->user = (void *)data; | |
1027 data->parent = parent_window; | |
1028 | |
1029 winShow(data->win); | |
1030 return data->win; | |
1031 } | |
1032 | |
1033 | |
1034 /******************************************************************************* | |
1035 | |
1036 $Function: mmi_btips_bmg_pinCode_editor_exec_cb | |
1037 | |
1038 $Description: Callback handler for events sent by the CENTREEDIT editor | |
1039 | |
1040 $Returns: none | |
1041 | |
1042 $Arguments: win - current window | |
1043 event - event id | |
1044 parameter - optional data. | |
1045 *******************************************************************************/ | |
1046 | |
1047 static void mmi_btips_bmg_pinCode_editor_exec_cb(T_MFW_HND win, USHORT event, void *parameter) | |
1048 { | |
1049 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
1050 T_MMI_Btips_Bmg_PinCode_Win_data * data = (T_MMI_Btips_Bmg_PinCode_Win_data *)win_data->user; | |
1051 | |
1052 #ifdef NEW_EDITOR | |
1053 T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */ | |
1054 #else | |
1055 T_EDITOR_DATA editor_data; | |
1056 #endif | |
1057 | |
1058 TRACE_FUNCTION ("mmi_btips_bmg_pinCode_editor_exec_cb()"); | |
1059 memset(data->pinCodeBuffer,0,4); | |
1060 switch (event) | |
1061 { | |
1062 case BTIPS_BMG_LOCAL_EDITOR_INIT: | |
1063 /* SPR#1428 - SH - New Editor changes */ | |
1064 #ifdef NEW_EDITOR | |
1065 AUI_edit_SetDefault(&editor_data); | |
1066 AUI_edit_SetDisplay(&editor_data, CENTRE_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT); | |
1067 AUI_edit_SetEvents(&editor_data, *(USHORT*)parameter, TRUE, FOREVER, (T_AUI_EDIT_CB)mmi_btips_bmg_pinCode_editor_edit_cb); | |
1068 AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtBtipsEnterPassKey, NULL); | |
1069 AUI_edit_SetAltTextStr(&editor_data, 1, TxtNull, TRUE, TxtSoftBack); | |
1070 AUI_edit_SetMode(&editor_data, 0, ED_CURSOR_UNDERLINE); | |
1071 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, data->pinCodeBuffer,BTL_BMG_MAX_PIN_LENGTH );//PHB_MAX_LEN sundeep | |
1072 data->pinCode_editor = AUI_edit_Start(data->win, &editor_data); | |
1073 #else /* NEW_EDITOR */ | |
1074 | |
1075 SmsSend_loadEditDefault(&editor_data); | |
1076 bookSetEditAttributes( CENTRE_EDITOR, COLOUR_EDITOR_XX, 0, edtCurBar1, 0, | |
1077 (char *) data->pinCodeBuffer, NUMBER_LENGTH, &editor_data.editor_attr); | |
1078 | |
1079 | |
1080 editor_data.TextId = TxtBtipsEnterPassKey; | |
1081 editor_data.editor_attr.text = (char *)data->pinCodeBuffer; | |
1082 editor_data.editor_attr.size = PHB_MAX_LEN; | |
1083 editor_data.LeftSoftKey = TxtSoftOK; | |
1084 editor_data.RightSoftKey = TxtDelete; | |
1085 editor_data.Identifier = *(USHORT*)parameter; | |
1086 editor_data.Callback = (T_EDIT_CB)mmi_btips_bmg_pinCode_editor_edit_cb; | |
1087 editor_data.mode = E_EDIT_ALPHA_MODE; | |
1088 editor_data.destroyEditor = TRUE ; | |
1089 data->phoneName_editor = editor_start(data->win,&editor_data); | |
1090 /* start the Service Centre Number editor */ | |
1091 #endif /* NEW_EDITOR */ | |
1092 break; | |
1093 | |
1094 case BTIPS_BMG_EDITOR_CANCEL: | |
1095 | |
1096 break; | |
1097 default: | |
1098 TRACE_EVENT("Err: Default"); | |
1099 return; | |
1100 } | |
1101 } | |
1102 | |
1103 /******************************************************************************* | |
1104 | |
1105 $Function: mmi_btips_bmg_pinCode_editor_edit_cb | |
1106 | |
1107 $Description: Callback function for the center number editor | |
1108 | |
1109 $Returns: none | |
1110 | |
1111 $Arguments: win - current window | |
1112 Identifier - unique id | |
1113 reason - event cause | |
1114 *******************************************************************************/ | |
1115 | |
1116 static void mmi_btips_bmg_pinCode_editor_edit_cb (T_MFW_HND win, USHORT Identifier, SHORT reason) | |
1117 { | |
1118 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
1119 T_MMI_Btips_Bmg_PinCode_Win_data * data = (T_MMI_Btips_Bmg_PinCode_Win_data *)win_data->user; | |
1120 T_MFW_HND parent_win = data->parent; | |
1121 T_MFW_WIN * parent_win_data = ((T_MFW_HDR *) parent_win)->data; | |
1122 | |
1123 TRACE_FUNCTION_P1 ("mmi_btips_bmg_pinCode_editor_edit_cb: pincodeEditor = %s", data->pinCodeBuffer); | |
1124 | |
1125 switch (reason) | |
1126 { | |
1127 case INFO_KCD_LEFT: | |
1128 TRACE_EVENT("mmi_btips_bmg_pinCode_editor_edit_cb,INFO_KCD_LEFT "); | |
1129 | |
1130 if(strlen(data->pinCodeBuffer) > 16)// sundeep | |
1131 { | |
1132 //mmi_btips_app_show_info(win,TxtBtipsApp, TxtBtipsFailed,ONE_SECS, mmi_btips_refreshScreen);//sundeep | |
1133 mmi_btips_app_show_text(win,"Passkey Invalid", "Try Again", NULL); | |
1134 memset(data->pinCodeBuffer,0,16); | |
1135 SEND_EVENT (data->win, BTIPS_BMG_INQUIRY_RESULT_DEVICES_INIT,0, (void *)NULL); | |
1136 //SEND_EVENT (data->parent, BTIPS_BMG_PAIRED_DEVICES_INIT,0,0); | |
1137 | |
1138 } | |
1139 | |
1140 if(TRUE == g_btipsData.incomingPinRequestState) | |
1141 { | |
1142 mfw_btips_bmgSendPin((const BD_ADDR *) &(g_btipsData.bd_addr_incomingPinReq), data->pinCodeBuffer, strlen(data->pinCodeBuffer)); | |
1143 g_btipsData.incomingPinRequestState = FALSE; | |
1144 } | |
1145 else | |
1146 { | |
1147 T_MMI_Btips_Bmg_DevicesWin_data *parent_data = (T_MMI_Btips_Bmg_DevicesWin_data * )parent_win_data->user; | |
1148 parent_data->bondState = BOND_PIN_TAKEN; | |
1149 /*When the Bond is cancelled or it completes successfully, we need to display the | |
1150 Paired device list. The list gets actually created and displayed only when the WinResume | |
1151 event is received for the parent window*/ | |
1152 SEND_EVENT (parent_data->win, BTIPS_BMG_INQUIRY_RESULT_DEVICES_INIT,0, (void *)NULL); | |
1153 | |
1154 if(mmi_btips_bmgBond(data->parent, data->pinCodeBuffer)) | |
1155 SEND_EVENT(data->parent, BTIPS_BMG_BONDING_REQUEST_SENT, 0, 0); | |
1156 } | |
1157 /* SPR#1428 - SH - New Editor changes */ | |
1158 #ifdef NEW_EDITOR | |
1159 AUI_edit_Destroy(data->pinCode_editor); | |
1160 #else /* NEW_EDITOR */ | |
1161 editor_destroy(data->pinCode_editor); | |
1162 #endif /* NEW_EDITOR */ | |
1163 | |
1164 mmi_btips_bmg_pinCode_editor_destroy(win); | |
1165 break; | |
1166 | |
1167 case INFO_KCD_RIGHT: | |
1168 case INFO_KCD_HUP: | |
1169 | |
1170 if(TRUE == g_btipsData.incomingPinRequestState) | |
1171 { | |
1172 g_btipsData.incomingPinRequestState = FALSE; | |
1173 } | |
1174 else | |
1175 { | |
1176 T_MMI_Btips_Bmg_DevicesWin_data *parent_data = (T_MMI_Btips_Bmg_DevicesWin_data * )parent_win_data->user; | |
1177 parent_data->bondState = BOND_NOT_STARTED; | |
1178 | |
1179 /*We need to display the Paired device list. The list gets actually created and displayed only when the WinResume | |
1180 event is received for the parent window*/ | |
1181 SEND_EVENT (parent_data->win, BTIPS_BMG_PAIRED_DEVICES_INIT,0, (void *)NULL); | |
1182 } | |
1183 | |
1184 #ifdef NEW_EDITOR | |
1185 AUI_edit_Destroy(data->pinCode_editor); | |
1186 #else /* NEW_EDITOR */ | |
1187 editor_destroy(data->pinCode_editor); | |
1188 #endif /* NEW_EDITOR */ | |
1189 | |
1190 mmi_btips_bmg_pinCode_editor_destroy(win); | |
1191 data->pinCode_editor= 0; | |
1192 | |
1193 break; | |
1194 default: | |
1195 | |
1196 break; | |
1197 } | |
1198 } | |
1199 /******************************************************************************* | |
1200 | |
1201 $Function: mmi_btips_bmg_pinCode_editor_destroy | |
1202 | |
1203 $Description: Destroy the windows for entering the text | |
1204 | |
1205 $Returns: none | |
1206 | |
1207 $Arguments: own_window - window. | |
1208 | |
1209 *******************************************************************************/ | |
1210 | |
1211 static void mmi_btips_bmg_pinCode_editor_destroy(MfwHnd own_window) | |
1212 { | |
1213 T_MFW_WIN * win_data; | |
1214 T_MMI_Btips_Bmg_PinCode_Win_data * data = NULL; | |
1215 | |
1216 TRACE_FUNCTION ("mmi_btips_bmg_pinCode_editor_destroy()"); | |
1217 | |
1218 if (own_window) | |
1219 { | |
1220 win_data = ((T_MFW_HDR *)own_window)->data; | |
1221 if (win_data != NULL) | |
1222 data = (T_MMI_Btips_Bmg_PinCode_Win_data *)win_data->user; | |
1223 | |
1224 if (data) | |
1225 { | |
1226 | |
1227 | |
1228 // Delete WIN handler | |
1229 win_delete (data->win); | |
1230 | |
1231 // Free Memory | |
1232 mfwFree ((void *)data, sizeof (T_MMI_Btips_Bmg_PinCode_Win_data)); | |
1233 //win_data->user = NULL; | |
1234 } | |
1235 else | |
1236 { | |
1237 TRACE_EVENT ("mmi_btips_bmg_pinCode_editor_destroy() called twice"); | |
1238 } | |
1239 } | |
1240 } | |
1241 | |
1242 /******************************************************************************* | |
1243 BMG Editors END | |
1244 *******************************************************************************/ | |
1245 | |
1246 | |
1247 /******************************************************************************* | |
1248 | |
1249 $Function: mmi_BtipsDevices | |
1250 | |
1251 $Description: | |
1252 | |
1253 $Returns: | |
1254 | |
1255 $Arguments: | |
1256 | |
1257 *******************************************************************************/ | |
1258 int mmi_btips_bmgDevices(MfwMnu* m, MfwMnuItem* i) | |
1259 { | |
1260 T_MFW_HND parent_win = mfwParent(mfw_header()); | |
1261 if(mfw_btips_getRadioStatus() == TRUE)//sundeep | |
1262 mmi_btips_bmg_devices_win_create(parent_win, BTIPS_GENERIC_DEVICE_SEARCH, NULL); | |
1263 else | |
1264 mmi_btips_app_show_info(parent_win,TxtBtipsApp, TxtBtipsNotOn,ONE_SECS, mmi_btips_refreshScreen);//sundeep | |
1265 return MFW_EVENT_CONSUMED; | |
1266 } | |
1267 | |
1268 | |
1269 /******************************************************************************* | |
1270 | |
1271 $Function: mmi_btips_bmgSetVisibility | |
1272 | |
1273 $Description: | |
1274 | |
1275 $Returns: | |
1276 | |
1277 $Arguments: | |
1278 | |
1279 *******************************************************************************/ | |
1280 int mmi_btips_bmgSetVisibility(MfwMnu* m, MfwMnuItem* i) | |
1281 { | |
1282 T_MFW_HND parent_win = mfwParent(mfw_header()); | |
1283 bookMenuStart(parent_win, (MfwMnuAttr *)btipsBmgSetVisibilityMenuAttributes(),0); | |
1284 return MFW_EVENT_CONSUMED; | |
1285 | |
1286 } | |
1287 | |
1288 /******************************************************************************* | |
1289 | |
1290 $Function: mmi_btips_bmgConnectedDevices | |
1291 | |
1292 $Description: | |
1293 | |
1294 $Returns: | |
1295 | |
1296 $Arguments: | |
1297 | |
1298 *******************************************************************************/ | |
1299 int mmi_btips_bmgConnectedDevices(MfwMnu* m,MfwMnuItem* i) //CONNECTED | |
1300 { | |
1301 T_MFW_HND parent_win = mfwParent(mfw_header()); | |
1302 | |
1303 if(mfw_btips_bmg_getConnectedDevicesCount()!=0) | |
1304 { | |
1305 mmi_btips_bmg_connected_devices_win_create(parent_win, BTIPS_CONNECTED_DEVICES_SEARCH, NULL); | |
1306 } | |
1307 else | |
1308 { | |
1309 mmi_btips_app_show_info(parent_win, TxtNo, TxtBtipsDevices,ONE_SECS, mmi_btips_refreshScreen); | |
1310 } | |
1311 | |
1312 return MFW_EVENT_CONSUMED; | |
1313 | |
1314 } | |
1315 | |
1316 /******************************************************************************* | |
1317 | |
1318 $Function: mmi_BtipsPhoneName | |
1319 | |
1320 $Description: | |
1321 | |
1322 $Returns: | |
1323 | |
1324 $Arguments: | |
1325 | |
1326 *******************************************************************************/ | |
1327 int mmi_btips_bmgPhoneName(MfwMnu* m, MfwMnuItem* i) | |
1328 { | |
1329 /* | |
1330 Display current name | |
1331 Give LSK - Change, RSK - Back | |
1332 */ | |
1333 T_MFW_HND parent_win = mfwParent(mfw_header()); | |
1334 T_MFW_HND phoneName_editor_win; | |
1335 phoneName_editor_win = mmi_btips_bmg_phoneName_editor_create(parent_win); | |
1336 SEND_EVENT(phoneName_editor_win, BTIPS_BMG_LOCAL_EDITOR_INIT,0,0); | |
1337 return MFW_EVENT_CONSUMED; | |
1338 } | |
1339 | |
1340 /******************************************************************************* | |
1341 | |
1342 $Function: mmi_BtipsHidePhone | |
1343 | |
1344 $Description: | |
1345 | |
1346 $Returns: | |
1347 | |
1348 $Arguments: | |
1349 | |
1350 *******************************************************************************/ | |
1351 int mmi_btips_bmgHidePhone(MfwMnu* m, MfwMnuItem* i) | |
1352 { | |
1353 T_MFW_HND parent_win = mfwParent(mfw_header()); | |
1354 mfw_btips_bmgSetPhoneVisibility(FALSE); | |
1355 win_delete(parent_win); | |
1356 dspl_Enable(1); | |
1357 return MFW_EVENT_CONSUMED; | |
1358 } | |
1359 | |
1360 /******************************************************************************* | |
1361 | |
1362 $Function: mmi_btips_bmgSetConnectPermissionAllow | |
1363 | |
1364 $Description: | |
1365 | |
1366 $Returns: | |
1367 | |
1368 $Arguments: | |
1369 | |
1370 *******************************************************************************/ | |
1371 int mmi_btips_bmgSetConnectPermissionAllow(MfwMnu* m, MfwMnuItem* i) | |
1372 { | |
1373 T_MFW_HND parent_win = mfwParent(mfw_header()); | |
1374 | |
1375 TRACE_EVENT_P1("parent of mmi_btips_bmgSetConnectPermissionAllow %x",parent_win); | |
1376 if(mmi_btips_bmg_SetConnectPermission(parent_win,TRUE)) | |
1377 mmi_btips_app_show_info(0,TxtBtipsApp,TxtBtipsAlwaysAllow,ONE_SECS,NULL); | |
1378 else | |
1379 mmi_btips_app_show_info(0,TxtBtipsAlwaysAllow,TxtFailed,ONE_SECS,NULL); | |
1380 | |
1381 return MFW_EVENT_CONSUMED; | |
1382 } | |
1383 /******************************************************************************* | |
1384 | |
1385 $Function: mmi_btips_bmgSetConnectPermissionAsk | |
1386 | |
1387 $Description: | |
1388 | |
1389 $Returns: | |
1390 | |
1391 $Arguments: | |
1392 | |
1393 *******************************************************************************/ | |
1394 int mmi_btips_bmgSetConnectPermissionAsk(MfwMnu* m, MfwMnuItem* i) | |
1395 { | |
1396 T_MFW_HND parent_win = mfwParent(mfw_header()); | |
1397 // mfw_btips_bmgDeviceSetConnectPermissionAsk(); | |
1398 | |
1399 TRACE_EVENT_P1("parent of mmi_btips_bmgSetConnectPermissionAllow %x",parent_win); | |
1400 | |
1401 if(mmi_btips_bmg_SetConnectPermission(parent_win,FALSE)) | |
1402 mmi_btips_app_show_info(0,TxtBtipsApp,TxtBtipsAlwaysAsk,ONE_SECS,NULL); | |
1403 else | |
1404 mmi_btips_app_show_info(0,TxtBtipsAlwaysAsk,TxtFailed,ONE_SECS,NULL); | |
1405 return MFW_EVENT_CONSUMED; | |
1406 } | |
1407 /******************************************************************************* | |
1408 | |
1409 $Function: mmi_btips_bmgDeviceShowServices | |
1410 | |
1411 $Description: | |
1412 | |
1413 $Returns: | |
1414 | |
1415 $Arguments: | |
1416 | |
1417 *******************************************************************************/ | |
1418 BOOL mmi_btips_bmgDeviceShowServices(T_MFW_HND win , BOOL discoverServices) | |
1419 { | |
1420 SdpServicesMask sdpServicesMask =0; | |
1421 | |
1422 BtStatus btStatus; | |
1423 char bdAddrstring[256]; | |
1424 | |
1425 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
1426 tBookStandard * data = (tBookStandard *)win_data->user; | |
1427 | |
1428 T_MFW_WIN *parent_win_data = ((T_MFW_HDR *) data->parent_win)->data; | |
1429 T_MMI_Btips_Bmg_DevicesWin_data * parent_data = (T_MMI_Btips_Bmg_DevicesWin_data *)parent_win_data->user; | |
1430 T_MFW_HND parent_win = parent_data->win; | |
1431 | |
1432 TRACE_EVENT_P1("parent_win of mmi_btips_bmgDeviceShowServices %x",parent_win); | |
1433 | |
1434 if(discoverServices==TRUE) | |
1435 { | |
1436 sdpServicesMask = (SDP_SERVICE_DUN|SDP_SERVICE_FTP|SDP_SERVICE_A2DP|SDP_SERVICE_HFP|SDP_SERVICE_HSP|SDP_SERVICE_OPP); | |
1437 //sdpServicesMask= (SDP_SERVICE_SPP | SDP_SERVICE_DUN | SDP_SERVICE_OPP | SDP_SERVICE_FTP | SDP_SERVICE_HSP | SDP_SERVICE_A2DP | SDP_SERVICE_AVRCP | SDP_SERVICE_FAX | SDP_SERVICE_BPP | SDP_SERVICE_BIP | SDP_SERVICE_HFP | SDP_SERVICE_SAP | SDP_SERVICE_PBAP | SDP_SERVICE_HID);//sundeep | |
1438 bdaddr_ntoa(&parent_data->deviceList[parent_data->currentListIndex-1].bdAddr,bdAddrstring); | |
1439 TRACE_EVENT_P2("mmi_btips_bmgDeviceShowServices Discover %x, addr = %s",sdpServicesMask,bdAddrstring); | |
1440 btStatus = mfw_btips_bmg_DiscoverServices(&parent_data->deviceList[parent_data->currentListIndex-1].bdAddr,sdpServicesMask); | |
1441 if(btStatus !=MFW_BTIPS_SUCCESS ) | |
1442 { | |
1443 mmi_btips_app_show_info(0, TxtBtipsServices, TxtError, ONE_SECS,NULL); | |
1444 | |
1445 } | |
1446 | |
1447 } | |
1448 else if(discoverServices == FALSE) | |
1449 { | |
1450 sdpServicesMask = mfw_btips_bmgDeviceGetServices(&parent_data->deviceList[parent_data->currentListIndex-1].bdAddr); | |
1451 TRACE_EVENT_P1("sdpServicesMask of mmi_btips_bmgDeviceShowServices %x",sdpServicesMask); | |
1452 | |
1453 if(sdpServicesMask) | |
1454 { | |
1455 TRACE_EVENT_P1("sdpServicesMask of mmi_btips_bmgDeviceShowServices %x",sdpServicesMask); | |
1456 mmi_btips_bmg_services_editor_create(win,sdpServicesMask); | |
1457 return SERVICESMASK_NOT_EMPTY; | |
1458 } | |
1459 TRACE_FUNCTION("mmi_btips_bmgDeviceShowServices SERVICESMASK_EMPTY"); | |
1460 return SERVICESMASK_EMPTY; | |
1461 | |
1462 } | |
1463 return MFW_EVENT_CONSUMED; | |
1464 } | |
1465 /******************************************************************************* | |
1466 | |
1467 $Function: mmi_btips_bmgDeviceDelete | |
1468 | |
1469 $Description: | |
1470 | |
1471 $Returns: | |
1472 | |
1473 $Arguments: | |
1474 | |
1475 *******************************************************************************/ | |
1476 int mmi_btips_bmgDeviceDelete(MfwMnu* m, MfwMnuItem* i) | |
1477 { | |
1478 | |
1479 T_MFW_HND win = mfw_parent(mfw_header()); | |
1480 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
1481 tBookStandard * data = (tBookStandard *)win_data->user; | |
1482 | |
1483 T_MFW_WIN *parent_win_data = ((T_MFW_HDR *) data->parent_win)->data; | |
1484 T_MMI_Btips_Bmg_DevicesWin_data * parent_data = (T_MMI_Btips_Bmg_DevicesWin_data *)parent_win_data->user; | |
1485 T_MFW_HND parent_win = parent_data->win; | |
1486 | |
1487 TRACE_EVENT_P2("current list index = %d , Parent Win = %x",parent_data->currentListIndex,parent_win); | |
1488 TRACE_EVENT_P1("BdAddr = %s",parent_data->deviceList[parent_data->currentListIndex-1].bdAddr); | |
1489 if(mfw_btips_bmgDeviceDelete(&parent_data->deviceList[parent_data->currentListIndex-1].bdAddr)) | |
1490 mmi_btips_app_show_info(0,TxtRecord, TxtDeleted,ONE_SECS, NULL); | |
1491 else | |
1492 mmi_btips_app_show_info(0,TxtDelete,TxtFailed,ONE_SECS,NULL); | |
1493 return MFW_EVENT_CONSUMED; | |
1494 } | |
1495 /******************************************************************************* | |
1496 $Function: mmi_btips_bmgDeviceDisconnect | |
1497 | |
1498 $Description: | |
1499 | |
1500 $Returns: | |
1501 | |
1502 $Arguments: | |
1503 | |
1504 *******************************************************************************/ | |
1505 int mmi_btips_bmgDeviceDisconnect(MfwMnu* m, MfwMnuItem* i) | |
1506 { | |
1507 T_MFW_HND parent_win = mfwParent(mfw_header()); | |
1508 //mfw_btips_bmgDeviceDisconnect(); | |
1509 mmi_btips_app_show_info(0,TxtBtipsApp,TxtBtipsDisconnect,ONE_SECS,NULL); | |
1510 return MFW_EVENT_CONSUMED; | |
1511 } | |
1512 | |
1513 | |
1514 /******************************************************************************* | |
1515 | |
1516 $Function: mmi_btips_bmgDeviceSetRemotename | |
1517 | |
1518 $Description: Currently not being used | |
1519 | |
1520 $Returns: | |
1521 | |
1522 $Arguments: | |
1523 | |
1524 *******************************************************************************/ | |
1525 | |
1526 int mmi_btips_bmgDeviceSetRemotename(MfwMnu* m, MfwMnuItem* i) | |
1527 { | |
1528 T_MFW_HND parent_win = mfwParent(mfw_header()); | |
1529 T_MFW_HND phoneName_editor_win; | |
1530 //T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
1531 //T_MMI_Btips_Bmg_DevicesWin_data * data = (T_MMI_Btips_Bmg_DevicesWin_data *)win_data->user; | |
1532 | |
1533 | |
1534 | |
1535 TRACE_FUNCTION ("mmi_btips_bmgDeviceSetRemotename()"); | |
1536 //memset(data->phoneNameBuffer,0,BT_MAX_REM_DEV_NAME); | |
1537 /*Display the current value*/ | |
1538 //mfw_btips_bmgGetLocalDeviceName(data->phoneNameBuffer); | |
1539 phoneName_editor_win = mmi_btips_bmg_phoneName_editor_create(parent_win); | |
1540 | |
1541 SEND_EVENT(phoneName_editor_win, BTIPS_BMG_REMOTE_EDITOR_INIT,0,0); | |
1542 | |
1543 //mmi_btips_app_show_info(0,TxtBtipsApp,TxtBtipsRename,ONE_SECS,NULL); | |
1544 return MFW_EVENT_CONSUMED; | |
1545 } | |
1546 | |
1547 | |
1548 /******************************************************************************* | |
1549 | |
1550 $Function: mmi_BtipsShowPhone | |
1551 | |
1552 $Description: | |
1553 | |
1554 $Returns: | |
1555 | |
1556 $Arguments: | |
1557 | |
1558 *******************************************************************************/ | |
1559 int mmi_btips_bmgShowPhone(MfwMnu* m, MfwMnuItem* i) | |
1560 { | |
1561 T_MFW_HND parent_win = mfwParent(mfw_header()); | |
1562 mfw_btips_bmgSetPhoneVisibility(TRUE); | |
1563 win_delete(parent_win); | |
1564 dspl_Enable(1); | |
1565 return MFW_EVENT_CONSUMED; | |
1566 } | |
1567 | |
1568 USHORT mmi_btips_bmgIsVisible( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi ) | |
1569 { | |
1570 if(mfw_btips_bmgGetPhoneVisibility()) | |
1571 return TRUE; | |
1572 | |
1573 return FALSE; | |
1574 | |
1575 } | |
1576 | |
1577 USHORT mmi_btips_bmgIsInvisible( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi ) | |
1578 { | |
1579 if(mfw_btips_bmgGetPhoneVisibility()) | |
1580 return FALSE; | |
1581 | |
1582 return TRUE; | |
1583 | |
1584 } | |
1585 | |
1586 /******************************************************************************* | |
1587 | |
1588 $Function: mmi_btips_bmg_pin_req | |
1589 | |
1590 $Description: | |
1591 | |
1592 $Returns: | |
1593 | |
1594 $Arguments: | |
1595 | |
1596 *******************************************************************************/ | |
1597 int mmi_btips_bmg_pin_req(const BD_ADDR *bdAddr) | |
1598 { | |
1599 U8 pin[] = "0000"; | |
1600 U8 len = 4; | |
1601 /* | |
1602 o. Store the BD_ADDR in the context of the Window created to display the editor | |
1603 1. Create an editor | |
1604 2. Try to get the name of the peer device requesting pairing | |
1605 3. Take input from the user for the 4-digit Pass-Key | |
1606 */ | |
1607 mfw_btips_bmgSendPin(bdAddr, pin, len); | |
1608 mmi_btips_app_show_info(0,TxtBtipsApp,TxtBtipsBond,ONE_SECS,NULL); | |
1609 | |
1610 } | |
1611 | |
1612 | |
1613 /******************************************************************************* | |
1614 | |
1615 $Function: mmi_btips_bmgBond | |
1616 | |
1617 $Description: | |
1618 | |
1619 $Returns: | |
1620 | |
1621 $Arguments: | |
1622 | |
1623 *******************************************************************************/ | |
1624 int mmi_btips_bmgBond(T_MFW_HND win, U8 pin[]) | |
1625 { | |
1626 | |
1627 U8 len = strlen(pin); | |
1628 T_MFW_WIN * win_data; | |
1629 T_MMI_Btips_Bmg_DevicesWin_data *data; | |
1630 | |
1631 win_data = ((T_MFW_HDR *) win)->data; | |
1632 data = (T_MMI_Btips_Bmg_DevicesWin_data *)win_data->user; | |
1633 | |
1634 TRACE_FUNCTION ("mmi_btips_bmgBond()"); | |
1635 return mfw_btips_bmgBond(&data->deviceList[data->currentListIndex-1].bdAddr, pin, len); | |
1636 } | |
1637 | |
1638 /******************************************************************************* | |
1639 | |
1640 $Function: mmi_btips_bmg_ShowPairedDeviceList | |
1641 | |
1642 $Description: Create a menu list of all paired devices; MMI => MFW => BTL-BMG | |
1643 | |
1644 $Returns: | |
1645 | |
1646 $Arguments: | |
1647 | |
1648 *******************************************************************************/ | |
1649 T_MFW_HND mmi_btips_bmg_ShowPairedDeviceList(T_MFW_HND win) | |
1650 { | |
1651 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
1652 T_MMI_Btips_Bmg_DevicesWin_data * data = (T_MMI_Btips_Bmg_DevicesWin_data *)win_data->user; | |
1653 USHORT list_count=0; | |
1654 //char bdAddr[BDADDR_NTOA_SIZE]; | |
1655 | |
1656 TRACE_FUNCTION ("mmi_btips_bmg_ShowPairedDeviceList()"); | |
1657 data->menu_list_data = (ListMenuData *)mfwAlloc(sizeof(ListMenuData)); | |
1658 if(data->menu_list_data == NULL ) | |
1659 { | |
1660 TRACE_ERROR("Memory failure."); | |
1661 return; | |
1662 } | |
1663 data->inquiryState = INQUIRY_NOT_STARTED; | |
1664 | |
1665 /*Find out how many paired devices are present and allocate for the menu-list-data as | |
1666 noPairedDevices + ONE for the top most entry ("Find new device")*/ | |
1667 //MFW has populated the (data->deviceList, &data->noInquiredDevices); | |
1668 | |
1669 mfw_btips_bmg_getPairedDevices(data->deviceList, &data->noPairedDevices); | |
1670 data->listCount = data->noPairedDevices + 1; | |
1671 | |
1672 data->menu_list_data->List = (T_MFW_MNU_ITEM *)mfwAlloc( (data->listCount) * sizeof(T_MFW_MNU_ITEM) ); | |
1673 if(data->menu_list_data->List == NULL) | |
1674 { | |
1675 TRACE_ERROR("BTIPS BMG Device List Memory failure."); | |
1676 return; | |
1677 } | |
1678 /*First entry : if searching is complete - "Find More" OR it will display "searching"*/ | |
1679 mnuInitDataItem(&data->menu_list_data->List[list_count]); | |
1680 data->menu_list_data->CursorPosition = 1; | |
1681 | |
1682 data->menu_list_data->List[list_count].str = FindNewDeviceString; | |
1683 if(data->noPairedDevices) | |
1684 { | |
1685 data->menu_list_data->CursorPosition = 2; | |
1686 } | |
1687 | |
1688 data->menu_list_data->List[list_count].flagFunc = item_flag_none; | |
1689 | |
1690 | |
1691 /*Second entry onwards : The newly found Device List*/ | |
1692 for (list_count=1; list_count<data->noPairedDevices+1; list_count++) | |
1693 { | |
1694 //bdaddr_ntoa(&data->deviceList[list_count-1].bdAddr, bdAddr); | |
1695 mnuInitDataItem(&data->menu_list_data->List[list_count]); | |
1696 data->menu_list_data->List[list_count].str = (char *)data->deviceList[list_count-1].name; | |
1697 data->menu_list_data->List[list_count].flagFunc = item_flag_none; | |
1698 } | |
1699 | |
1700 data->menu_list_data->LeftSoftKey = TxtSelect; | |
1701 data->menu_list_data->RightSoftKey = TxtSoftBack; | |
1702 data->menu_list_data->ListLength = data->listCount; //(data->noPairedDevices + 1) | |
1703 data->menu_list_data->ListPosition = 1; | |
1704 data->menu_list_data->SnapshotSize =data->listCount; //(data->noPairedDevices + 1) | |
1705 data->menu_list_data->Font = 1; | |
1706 data->menu_list_data->KeyEvents = KEY_ALL; | |
1707 data->menu_list_data->Reason = 0; | |
1708 data->menu_list_data->Strings = TRUE; | |
1709 data->menu_list_data->Attr = (MfwMnuAttr*)&BtipsDeviceList_Attrib; | |
1710 data->menu_list_data->autoDestroy = TRUE; | |
1711 data->currentListIndex = data->menu_list_data->CursorPosition; | |
1712 | |
1713 //Display the List window that was created above | |
1714 listDisplayListMenu(win, data->menu_list_data, (ListCbFunc)mmi_btips_bmg_device_list_cb, 0); | |
1715 TRACE_EVENT_P2("Num of Paired Devices %d, CurrIndex %d",data->noPairedDevices, data->currentListIndex); | |
1716 displaySoftKeys(data->menu_list_data->LeftSoftKey,data->menu_list_data->RightSoftKey); | |
1717 if(data->menu_list_data->ListLength > 1) | |
1718 displayMenuKeys(MENU_KEY_UP_DOWN_CENTER); | |
1719 data->list_win = data->menu_list_data->win; | |
1720 return data->menu_list_data->win; | |
1721 } | |
1722 | |
1723 /******************************************************************************* | |
1724 | |
1725 $Function: mmi_btips_bmg_ShowConnectedDevicesList | |
1726 | |
1727 $Description: Create a menu list of all paired devices; MMI => MFW => BTL-BMG | |
1728 | |
1729 $Returns: | |
1730 | |
1731 $Arguments: | |
1732 | |
1733 *******************************************************************************/ | |
1734 T_MFW_HND mmi_btips_bmg_ShowConnectedDevicesList(T_MFW_HND win) //CONNECTED | |
1735 { | |
1736 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
1737 T_MMI_Btips_Bmg_DevicesWin_data * data = (T_MMI_Btips_Bmg_DevicesWin_data *)win_data->user; | |
1738 USHORT list_count=0; | |
1739 //char bdAddr[BDADDR_NTOA_SIZE]; | |
1740 | |
1741 TRACE_FUNCTION ("mmi_btips_bmg_ShowConnectedDevicesList()"); | |
1742 data->menu_list_connected_data = (ListMenuData *)mfwAlloc(sizeof(ListMenuData)); | |
1743 if(data->menu_list_connected_data == NULL ) | |
1744 { | |
1745 TRACE_ERROR("Memory failure."); | |
1746 return NULL; | |
1747 } | |
1748 | |
1749 /*Find out how many Connected devices are present and allocate for the menu-list-data as | |
1750 noConnectedDevices */ | |
1751 | |
1752 mfw_btips_bmg_getConnectedDevices(data->connected_deviceList, &data->noConnectedDevices); | |
1753 data->listCountConnectedDevices = data->noConnectedDevices; | |
1754 TRACE_EVENT_P1("Total Connected Devices in List = %d", data->noConnectedDevices); | |
1755 | |
1756 if(0 == data->noConnectedDevices) | |
1757 { | |
1758 return NULL; | |
1759 } | |
1760 | |
1761 data->menu_list_connected_data->List = (T_MFW_MNU_ITEM *)mfwAlloc( (data->listCountConnectedDevices) * sizeof(T_MFW_MNU_ITEM) ); | |
1762 if(data->menu_list_connected_data->List == NULL) | |
1763 { | |
1764 TRACE_ERROR("BTIPS BMG Connected Device List Memory failure."); | |
1765 return data->menu_list_connected_data->win; | |
1766 } | |
1767 | |
1768 data->menu_list_connected_data->CursorPosition = 1; | |
1769 for (list_count=0; list_count<data->noConnectedDevices; list_count++) | |
1770 { | |
1771 mnuInitDataItem(&data->menu_list_connected_data->List[list_count]); | |
1772 data->menu_list_connected_data->List[list_count].str = (char *)data->connected_deviceList[list_count].name; | |
1773 data->menu_list_connected_data->List[list_count].flagFunc = item_flag_none; | |
1774 } | |
1775 | |
1776 data->menu_list_connected_data->LeftSoftKey = TxtBtipsDisconnect; | |
1777 data->menu_list_connected_data->RightSoftKey = TxtSoftBack; | |
1778 data->menu_list_connected_data->ListLength = data->listCountConnectedDevices; | |
1779 data->menu_list_connected_data->ListPosition = 1; | |
1780 data->menu_list_connected_data->SnapshotSize =data->listCountConnectedDevices; | |
1781 data->menu_list_connected_data->Font = 1; | |
1782 data->menu_list_connected_data->KeyEvents = KEY_ALL; | |
1783 data->menu_list_connected_data->Reason = 0; | |
1784 data->menu_list_connected_data->Strings = TRUE; | |
1785 data->menu_list_connected_data->Attr = (MfwMnuAttr*)&BtipsDeviceList_Attrib; | |
1786 data->menu_list_connected_data->autoDestroy = TRUE; | |
1787 data->currentListIndex = data->menu_list_connected_data->CursorPosition; | |
1788 | |
1789 //Display the List window that was created above | |
1790 listDisplayListMenu(win, data->menu_list_connected_data, (ListCbFunc)mmi_btips_bmg_connected_device_list_cb, 0); | |
1791 TRACE_EVENT_P2("Num of Connected Devices %d, CurrIndex %d",data->noConnectedDevices, data->currentListIndex); | |
1792 displaySoftKeys(data->menu_list_connected_data->LeftSoftKey,data->menu_list_connected_data->RightSoftKey); | |
1793 if(data->menu_list_connected_data->ListLength > 1) | |
1794 displayMenuKeys(MENU_KEY_UP_DOWN_CENTER); | |
1795 data->list_connected_win = data->menu_list_connected_data->win; | |
1796 return data->menu_list_connected_data->win; | |
1797 } | |
1798 | |
1799 /******************************************************************************* | |
1800 | |
1801 $Function: mmi_btips_bmg_ShowInquiredDeviceList | |
1802 | |
1803 $Description: Create a menu list of all paired devices; BTL-BMG => MFW (Context Switch) | |
1804 MFW => MMI (notification) | |
1805 MMI (gets data collected device list again from mfw) | |
1806 | |
1807 $Returns: | |
1808 | |
1809 $Arguments: | |
1810 | |
1811 *******************************************************************************/ | |
1812 T_MFW_HND mmi_btips_bmg_ShowInquiredDeviceList(T_MFW_HND win) | |
1813 { | |
1814 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
1815 T_MMI_Btips_Bmg_DevicesWin_data * data = (T_MMI_Btips_Bmg_DevicesWin_data *)win_data->user; | |
1816 USHORT list_count=0; | |
1817 //char bdAddr[BDADDR_NTOA_SIZE]; | |
1818 | |
1819 TRACE_FUNCTION ("mmi_btips_bmg_ShowInquiredDeviceList()"); | |
1820 data->menu_list_data = (ListMenuData *)mfwAlloc(sizeof(ListMenuData)); | |
1821 if(data->menu_list_data == NULL ) | |
1822 { | |
1823 TRACE_ERROR("Memory failure."); | |
1824 return; | |
1825 } | |
1826 data->listCount = data->noInquiredDevices + 1; | |
1827 | |
1828 /*Find out how many paired devices are present and allocate for the menu-list-data as | |
1829 noPairedDevices + ONE for the top most entry ("Find new device") | |
1830 MFW has populated the (data->deviceList, &data->noInquiredDevices)*/; | |
1831 data->menu_list_data->List = (T_MFW_MNU_ITEM *)mfwAlloc( (data->listCount) * sizeof(T_MFW_MNU_ITEM) ); | |
1832 if(data->menu_list_data->List == NULL) | |
1833 { | |
1834 TRACE_ERROR("BTIPS BMG Device List Memory failure."); | |
1835 return; | |
1836 } | |
1837 | |
1838 data->menu_list_data->LeftSoftKey = TxtSelect; | |
1839 data->menu_list_data->RightSoftKey= TxtCancel; | |
1840 data->menu_list_data->ListLength = data->listCount; | |
1841 data->menu_list_data->ListPosition = 1; | |
1842 data->menu_list_data->CursorPosition = 1; | |
1843 data->menu_list_data->SnapshotSize =data->listCount; | |
1844 data->menu_list_data->Font = 1; | |
1845 data->menu_list_data->KeyEvents = KEY_ALL; | |
1846 data->menu_list_data->Reason = 0; | |
1847 data->menu_list_data->Strings = TRUE; | |
1848 data->menu_list_data->Attr = (MfwMnuAttr*)&BtipsDeviceList_Attrib; | |
1849 data->menu_list_data->autoDestroy = TRUE; | |
1850 data->menu_list_data->CursorPosition = 1; | |
1851 | |
1852 /*First entry : if searching is complete - "Find More" OR it will display "searching"*/ | |
1853 mnuInitDataItem(&data->menu_list_data->List[list_count]); | |
1854 switch(data->inquiryState) | |
1855 { | |
1856 case INQUIRY_NOT_STARTED: | |
1857 data->menu_list_data->List[list_count].str = FindNewDeviceString; | |
1858 break; | |
1859 case INQUIRY_STARTED: | |
1860 data->menu_list_data->List[list_count].str = SearchingDeviceString; | |
1861 if(data->noInquiredDevices) | |
1862 { | |
1863 data->menu_list_data->LeftSoftKey = TxtBtipsBond; | |
1864 } | |
1865 else | |
1866 { | |
1867 data->menu_list_data->LeftSoftKey = '\0'; | |
1868 } | |
1869 break; | |
1870 case INQUIRY_CANCELLATION_STARTED: | |
1871 case INQUIRY_CANCELLATION_COMPLETE: | |
1872 data->menu_list_data->List[list_count].str = FindNewDeviceString; | |
1873 if(data->noInquiredDevices) | |
1874 { | |
1875 data->menu_list_data->LeftSoftKey = TxtBtipsBond; | |
1876 } | |
1877 else | |
1878 { | |
1879 data->menu_list_data->LeftSoftKey = '\0'; | |
1880 } | |
1881 break; | |
1882 case INQUIRY_COMPLETE: | |
1883 data->menu_list_data->List[list_count].str = FindNewDeviceString; | |
1884 data->menu_list_data->RightSoftKey = TxtSoftBack; | |
1885 if(data->noInquiredDevices) | |
1886 { | |
1887 data->menu_list_data->ListPosition = 2; | |
1888 data->menu_list_data->LeftSoftKey = TxtBtipsBond; | |
1889 } | |
1890 break; | |
1891 } | |
1892 | |
1893 data->menu_list_data->List[list_count].flagFunc = item_flag_none; | |
1894 | |
1895 /*Second entry onwards : The newly found Device List*/ | |
1896 for (list_count=1; list_count<data->noInquiredDevices+1; list_count++) | |
1897 { | |
1898 //bdaddr_ntoa(&data->deviceList[list_count-1].bdAddr, bdAddr); | |
1899 mnuInitDataItem(&data->menu_list_data->List[list_count]); | |
1900 data->menu_list_data->List[list_count].str = (char *)data->deviceList[list_count-1].name; | |
1901 data->menu_list_data->List[list_count].flagFunc = item_flag_none; | |
1902 } | |
1903 | |
1904 data->currentListIndex = data->menu_list_data->CursorPosition; | |
1905 | |
1906 //Display the List window that was created above | |
1907 listDisplayListMenu(win, data->menu_list_data, (ListCbFunc)mmi_btips_bmg_device_list_cb, 0); | |
1908 TRACE_EVENT_P2("Num of Inquired Devices %d, CurrIndex %d",data->noInquiredDevices, data->currentListIndex); | |
1909 | |
1910 displaySoftKeys(data->menu_list_data->LeftSoftKey,data->menu_list_data->RightSoftKey); | |
1911 if(data->menu_list_data->ListLength > 1) | |
1912 displayMenuKeys(MENU_KEY_UP_DOWN_CENTER); | |
1913 data->list_win = data->menu_list_data->win; | |
1914 return data->menu_list_data->win; | |
1915 } | |
1916 | |
1917 | |
1918 static void mmi_btips_bmg_device_list_cb(T_MFW_HND * parent, ListMenuData * ListData) | |
1919 { | |
1920 T_MFW_WIN * win_data = ((T_MFW_HDR *) parent)->data; | |
1921 T_MMI_Btips_Bmg_DevicesWin_data * data = (T_MMI_Btips_Bmg_DevicesWin_data *)win_data->user; | |
1922 | |
1923 TRACE_FUNCTION("mmi_btips_bmg_device_list_cb"); | |
1924 TRACE_EVENT_P2("Reason %d, Current State = %d",ListData->Reason, data->inquiryState); | |
1925 switch(ListData->Reason) | |
1926 { | |
1927 case LISTS_REASON_SELECT: | |
1928 data->currentListIndex = ListData->CursorPosition; | |
1929 if(ListData->selectKey==TRUE) | |
1930 { // Whats this value for | |
1931 } | |
1932 TRACE_EVENT_P1("ListData->selectKey = %d", ListData->selectKey); | |
1933 if(0 == data->currentListIndex) | |
1934 { | |
1935 /*User has selected "Find new device" or he just clicked on the display "searching" */ | |
1936 TRACE_EVENT_P1("Find New Device: Current State = %d", data->inquiryState); | |
1937 if((INQUIRY_NOT_STARTED == data->inquiryState) || (INQUIRY_COMPLETE== data->inquiryState)) | |
1938 { | |
1939 SEND_EVENT (parent, BTIPS_BMG_INQUIRY_RESULT_DEVICES_INIT, 0, (void *)NULL); | |
1940 data->noInquiredDevices = 0; | |
1941 data->inquiryState = INQUIRY_STARTED; | |
1942 mfw_btips_bmgSearch(data->searchType); | |
1943 } | |
1944 } | |
1945 else | |
1946 { | |
1947 if(INQUIRY_STARTED == data->inquiryState) | |
1948 { | |
1949 /*If the user has selected a particualr device thats currently discovered | |
1950 he now wishes to Bond/Connect to it. So Stop the inquiry now */ | |
1951 data->inquiryState = INQUIRY_CANCELLATION_STARTED; | |
1952 mfw_btips_bmgCancelSearch(); | |
1953 /*We are not getting the search cancelled event, hence doing it this way*/ | |
1954 data->inquiryState = INQUIRY_COMPLETE; | |
1955 } | |
1956 | |
1957 switch(data->inquiryState) | |
1958 { | |
1959 case INQUIRY_NOT_STARTED: | |
1960 if(BTIPS_GENERIC_DEVICE_SEARCH == data->searchType) | |
1961 { | |
1962 /*There is no Inquiry now and the user is viewing a list of | |
1963 previously paired devices. Now he has selected the options to | |
1964 be exercised on paired devices: Services, Delete, Rename, etc..*/ | |
1965 /* Create the options menu*/ | |
1966 bookMenuStart(parent, (MfwMnuAttr *)btipsBmgPairedDeviceMenuAttributes(),0); | |
1967 } | |
1968 else | |
1969 { | |
1970 data->searchCB(data->deviceList[data->currentListIndex-1].bdAddr); | |
1971 } | |
1972 break; | |
1973 case INQUIRY_CANCELLATION_STARTED: | |
1974 if(data->noInquiredDevices >= 1) | |
1975 { | |
1976 /*Mark that Bonding is requested on the currently selected device. | |
1977 Bonding will statr only when the inquiry cancellation event comes*/ | |
1978 data->listID = SHOW_NO_LIST; | |
1979 data->bondState = BOND_USER_REQUESTED; | |
1980 } | |
1981 break; | |
1982 case INQUIRY_COMPLETE: | |
1983 /*Trigger Bonding on the currently selected device.*/ | |
1984 data->listID = SHOW_NO_LIST; | |
1985 data->bondState = BOND_USER_REQUESTED; | |
1986 SEND_EVENT (parent, BTIPS_BMG_BONDING_REQUEST_INIT, 0, (void *)NULL); | |
1987 break; | |
1988 } | |
1989 } | |
1990 break; | |
1991 | |
1992 case LISTS_REASON_BACK: | |
1993 TRACE_EVENT("Going back" ); | |
1994 data->listID = SHOW_NONE_EXIT; | |
1995 if(INQUIRY_STARTED == data->inquiryState) | |
1996 { | |
1997 data->inquiryState = INQUIRY_CANCELLATION_STARTED; | |
1998 mfw_btips_bmgCancelSearch(); | |
1999 SEND_EVENT (parent, BTIPS_BMG_PAIRED_DEVICES_INIT, 0, (void *)NULL); | |
2000 } | |
2001 else | |
2002 SEND_EVENT (data->win, BTIPS_BMG_DEVICES_EXIT_WIN, 0, (void *)NULL); | |
2003 break; | |
2004 | |
2005 case LISTS_REASON_DRAWCOMPLETE: | |
2006 TRACE_EVENT("LISTS_REASON_DRAWCOMPLETE " ); | |
2007 break; | |
2008 } | |
2009 } | |
2010 | |
2011 //CONNECTED | |
2012 static void mmi_btips_bmg_connected_device_list_cb(T_MFW_HND * parent, ListMenuData* ListConnectedData) | |
2013 { | |
2014 T_MFW_WIN * win_data = ((T_MFW_HDR *) parent)->data; | |
2015 T_MMI_Btips_Bmg_DevicesWin_data * data = (T_MMI_Btips_Bmg_DevicesWin_data *)win_data->user; | |
2016 | |
2017 TRACE_FUNCTION("mmi_btips_bmg_connected_device_list_cb"); | |
2018 TRACE_EVENT_P2("Reason %d, Current Index = %d",ListConnectedData->Reason, ListConnectedData->CursorPosition); | |
2019 TRACE_EVENT_P3("List CB ++ ListWin = %x, %x, ListCount = %d",data->menu_list_connected_data->win, data->list_connected_win, data->listCountConnectedDevices); | |
2020 switch(ListConnectedData->Reason) | |
2021 { | |
2022 case LISTS_REASON_SELECT: | |
2023 TRACE_EVENT("LISTS_REASON_SELECT - Connected Device" ); | |
2024 data->currentListIndex = ListConnectedData->CursorPosition; | |
2025 data->noConnectedDevices--; | |
2026 if(data->connected_deviceList[data->currentListIndex].ServiceId == BTIPS_SDP_SERVICE_FTPS) | |
2027 { | |
2028 mfw_btips_ftpsDisconnect(); | |
2029 } | |
2030 if(data->connected_deviceList[data->currentListIndex].ServiceId == BTIPS_SDP_SERVICE_OPPC) | |
2031 { | |
2032 mfw_btips_oppc_Disconnect(); | |
2033 } | |
2034 if(data->connected_deviceList[data->currentListIndex].ServiceId == BTIPS_SDP_SERVICE_OPPS) | |
2035 { | |
2036 mfw_btips_opps_Disconnect(); | |
2037 } | |
2038 if(data->connected_deviceList[data->currentListIndex].ServiceId == BTIPS_SDP_SERVICE_VG) | |
2039 { | |
2040 mfw_btips_vgDisconnect(data->connected_deviceList[data->currentListIndex].bdAddr); | |
2041 | |
2042 } | |
2043 if(data->connected_deviceList[data->currentListIndex].ServiceId == BTIPS_SDP_SERVICE_A2DP) | |
2044 { | |
2045 mfw_btips_a2dpDisconnect(data->connected_deviceList[data->currentListIndex].bdAddr); | |
2046 | |
2047 } | |
2048 | |
2049 if(0 == data->noConnectedDevices) | |
2050 { | |
2051 mmi_btips_app_show_info(data->win, TxtNo, TxtBtipsDevices,ONE_SECS, mmi_btips_ResumeBTMainMenu); | |
2052 SEND_EVENT (data->win, BTIPS_BMG_CONNECTED_DEVICES_EXIT_WIN, 0, (void *)NULL); | |
2053 } | |
2054 break; | |
2055 | |
2056 case LISTS_REASON_BACK: | |
2057 TRACE_EVENT("Going back" ); | |
2058 SEND_EVENT (data->win, BTIPS_BMG_CONNECTED_DEVICES_EXIT_WIN, 0, (void *)NULL); | |
2059 break; | |
2060 | |
2061 case LISTS_REASON_DRAWCOMPLETE: | |
2062 TRACE_EVENT("LISTS_REASON_DRAWCOMPLETE " ); | |
2063 break; | |
2064 | |
2065 } | |
2066 } | |
2067 | |
2068 | |
2069 | |
2070 static int mmi_btips_bmg_SetConnectPermission(T_MFW_HND win, BOOL permission) | |
2071 { | |
2072 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
2073 tBookStandard * data = (tBookStandard *)win_data->user; | |
2074 | |
2075 T_MFW_WIN *parent_win_data = ((T_MFW_HDR *) data->parent_win)->data; | |
2076 T_MMI_Btips_Bmg_DevicesWin_data * parent_data = (T_MMI_Btips_Bmg_DevicesWin_data *)parent_win_data->user; | |
2077 T_MFW_HND parent_win = parent_data->win; | |
2078 | |
2079 TRACE_EVENT_P1("parent_win_data value of mmi_btips_bmg_SetConnectPermission %x",parent_win_data); | |
2080 TRACE_EVENT_P1("parent_win of mmi_btips_bmg_SetConnectPermission %x",parent_win); | |
2081 TRACE_FUNCTION("mmi_btips_bmg_SetConnectPermission() "); | |
2082 | |
2083 if(permission) | |
2084 { | |
2085 return mfw_btips_bmgDeviceSetConnectPermissionAllow(&parent_data->deviceList[parent_data->currentListIndex-1].bdAddr, permission); | |
2086 } | |
2087 | |
2088 else | |
2089 { | |
2090 return mfw_btips_bmgDeviceSetConnectPermissionAsk(&parent_data->deviceList[parent_data->currentListIndex-1].bdAddr, permission); | |
2091 } | |
2092 | |
2093 } | |
2094 | |
2095 /******************************************************************************* | |
2096 $Function: mmi_btips_bmg_services_editor_create | |
2097 | |
2098 $Description: Creates an editor for displaying the services supported by a device | |
2099 | |
2100 $Returns: Execution status | |
2101 | |
2102 $Arguments: parent_win -Parent window | |
2103 *******************************************************************************/ | |
2104 T_MFW_HND mmi_btips_bmg_services_editor_create(T_MFW_HND parent_win, SdpServicesMask sdpServicesMask) | |
2105 { | |
2106 T_MFW_HND win; | |
2107 T_AUI_EDITOR_DATA editor_data; | |
2108 T_AUI_EDITOR_INFO *edtdata; | |
2109 T_MFW_WIN *win_data; | |
2110 | |
2111 TRACE_FUNCTION ("mmi_btips_bmg_services_editor_create"); | |
2112 services_data = (T_MMI_BTIPS_SERVICES_STRUCT *)mfwAlloc(sizeof(T_MMI_BTIPS_SERVICES_STRUCT)); | |
2113 services_data->edt_buf = (char *)mfwAlloc(BTIPS_MAX_SERVICES_BUFFER); | |
2114 | |
2115 | |
2116 memset(&editor_data,'\0',sizeof(editor_data)); | |
2117 | |
2118 //Initialise the editor | |
2119 | |
2120 AUI_edit_SetDefault(&editor_data); | |
2121 | |
2122 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII,(UBYTE *) services_data->edt_buf, BTIPS_MAX_SERVICES_BUFFER); | |
2123 | |
2124 AUI_edit_SetMode(&editor_data,ED_MODE_ALPHA,0); | |
2125 | |
2126 AUI_edit_SetTextStr(&editor_data, TxtNull,TxtSoftOK, TxtBtipsServices,NULL); | |
2127 | |
2128 AUI_edit_SetAltTextStr(&editor_data, 1, TxtNull, TRUE, TxtNull); | |
2129 | |
2130 AUI_edit_SetEvents(&editor_data, 0, TRUE, FOREVER, (T_AUI_EDIT_CB)mmi_btips_bmg_services_editor_exec_cb); | |
2131 | |
2132 win = AUI_edit_Start(parent_win, &editor_data); | |
2133 | |
2134 | |
2135 TRACE_EVENT_P2(" sdpServicesMask = %d , SDP_SERVICE_OPP =%d",sdpServicesMask,sdpServicesMask& SDP_SERVICE_OPP); | |
2136 if(sdpServicesMask& SDP_SERVICE_OPP ) | |
2137 { | |
2138 AUI_edit_InsertString(win , (UBYTE *) "Object Push",ATB_DCS_ASCII); | |
2139 | |
2140 AUI_edit_InsertChar(win , ctrlEnter); | |
2141 | |
2142 } | |
2143 | |
2144 TRACE_EVENT_P2(" sdpServicesMask = %d , SDP_SERVICE_HFP =%d",sdpServicesMask,sdpServicesMask& SDP_SERVICE_HFP); | |
2145 if(sdpServicesMask& SDP_SERVICE_HFP) | |
2146 { | |
2147 AUI_edit_InsertString(win , (UBYTE *) "Handsfree",ATB_DCS_ASCII); | |
2148 | |
2149 AUI_edit_InsertChar(win , ctrlEnter); | |
2150 } | |
2151 TRACE_EVENT_P2(" sdpServicesMask = %d , SDP_SERVICE_HSP =%d",sdpServicesMask,sdpServicesMask& SDP_SERVICE_HSP ); | |
2152 if(sdpServicesMask& SDP_SERVICE_HSP ) | |
2153 { | |
2154 AUI_edit_InsertString(win , (UBYTE *) "HeadSet",ATB_DCS_ASCII); | |
2155 | |
2156 AUI_edit_InsertChar(win , ctrlEnter); | |
2157 | |
2158 } | |
2159 TRACE_EVENT_P2(" sdpServicesMask = %d , SDP_SERVICE_FTP =%d",sdpServicesMask,sdpServicesMask& SDP_SERVICE_FTP ); | |
2160 if(sdpServicesMask& SDP_SERVICE_FTP ) | |
2161 { | |
2162 AUI_edit_InsertString(win , (UBYTE *) "File Transfer",ATB_DCS_ASCII); | |
2163 AUI_edit_InsertChar(win , ctrlEnter); | |
2164 } | |
2165 TRACE_EVENT_P2(" sdpServicesMask = %d , SDP_SERVICE_DUN =%d",sdpServicesMask,sdpServicesMask& SDP_SERVICE_DUN); | |
2166 if(sdpServicesMask& SDP_SERVICE_DUN ) | |
2167 { | |
2168 AUI_edit_InsertString(win , (UBYTE *) "Dial Up Networking",ATB_DCS_ASCII); | |
2169 | |
2170 AUI_edit_InsertChar(win , ctrlEnter); | |
2171 } | |
2172 TRACE_EVENT_P2(" sdpServicesMask = %d , SDP_SERVICE_A2DP =%d",sdpServicesMask,sdpServicesMask& SDP_SERVICE_A2DP); | |
2173 if(sdpServicesMask& SDP_SERVICE_A2DP) | |
2174 { | |
2175 AUI_edit_InsertString(win , (UBYTE *) "A2DP",ATB_DCS_ASCII); | |
2176 | |
2177 AUI_edit_InsertChar(win , ctrlEnter); | |
2178 } | |
2179 if(sdpServicesMask ==0) | |
2180 { | |
2181 | |
2182 AUI_edit_InsertString(win , (UBYTE *) "No Services",ATB_DCS_ASCII); | |
2183 } | |
2184 TRACE_EVENT_P1("editor_data->editor_attr.mode before %x",editor_data.editor_attr.mode); | |
2185 | |
2186 win_data = ((T_MFW_HDR *)win)->data; | |
2187 edtdata = (T_AUI_EDITOR_INFO *)win_data->user; | |
2188 edtdata->editor->attr->mode = ED_MODE_READONLY; | |
2189 | |
2190 TRACE_EVENT_P1("editor_data->editor_attr.mode after %x",editor_data.editor_attr.mode); | |
2191 win_show(win); | |
2192 return win; | |
2193 | |
2194 } | |
2195 | |
2196 | |
2197 | |
2198 /******************************************************************************* | |
2199 $Function: mmi_btips_bmg_services_editor_exec_cb | |
2200 | |
2201 $Description: Event handler for the editor | |
2202 | |
2203 $Returns: None | |
2204 | |
2205 $Arguments: win -current window | |
2206 identifier -window id | |
2207 reason -Event cause. | |
2208 *******************************************************************************/ | |
2209 static void mmi_btips_bmg_services_editor_exec_cb(T_MFW_HND win, USHORT identifier, SHORT reason) | |
2210 { | |
2211 TRACE_FUNCTION ("mmi_btips_bmg_services_editor_exec_cb()"); | |
2212 switch (reason) | |
2213 { | |
2214 case INFO_KCD_LEFT: | |
2215 case INFO_KCD_HUP: | |
2216 case INFO_KCD_RIGHT: | |
2217 mmi_btips_bmg_services_editor_destroy( ); | |
2218 break; | |
2219 default: | |
2220 /* otherwise no action to be performed | |
2221 */ | |
2222 break; | |
2223 | |
2224 } | |
2225 } | |
2226 | |
2227 /******************************************************************************* | |
2228 $Function: mmi_btips_bmg_services_editor_destroy | |
2229 | |
2230 $Description: Frees the allocated memory | |
2231 | |
2232 $Returns: None | |
2233 | |
2234 $Arguments: None | |
2235 *******************************************************************************/ | |
2236 void mmi_btips_bmg_services_editor_destroy(void) | |
2237 { | |
2238 TRACE_FUNCTION ("mmi_btips_bmg_services_editor_destroy"); | |
2239 mfwFree((U8 *)services_data->edt_buf, BTIPS_MAX_SERVICES_BUFFER); | |
2240 mfwFree((U8 *)services_data, sizeof(T_MMI_BTIPS_SERVICES_STRUCT)); | |
2241 } | |
2242 | |
2243 | |
2244 T_MFW_HND mmi_btips_bmg_ask_cancelBond(T_MFW_HND parent, char * str1, char * str2, T_VOID_FUNC callback) | |
2245 { | |
2246 T_DISPLAY_DATA display_info; | |
2247 | |
2248 TRACE_FUNCTION("mmi_btips_bmg_cancelBonding_ask"); | |
2249 dlg_initDisplayData_TextStr( &display_info, TxtNull, TxtCancel, str1, str2, COLOUR_STATUS); | |
2250 dlg_initDisplayData_events( &display_info, callback, FOREVER, KEY_LEFT|KEY_RIGHT | KEY_CLEAR | KEY_HUP); | |
2251 return info_dialog(parent,&display_info); | |
2252 } | |
2253 | |
2254 void mmi_btips_bmg_bonding_cancelled_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason) | |
2255 { | |
2256 | |
2257 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
2258 T_dialog_info * data = (T_dialog_info *)win_data->user; | |
2259 | |
2260 T_MFW_WIN *parent_win_data = ((T_MFW_HDR *) data->parent_win)->data; | |
2261 T_MMI_Btips_Bmg_DevicesWin_data * parent_data = (T_MMI_Btips_Bmg_DevicesWin_data *)parent_win_data->user; | |
2262 T_MFW_HND parent_win = parent_data->win; | |
2263 int oldBondState; | |
2264 | |
2265 TRACE_FUNCTION_P1("mmi_btips_bmg_bonding_cancelled_cb %d", reason); | |
2266 | |
2267 switch (reason) | |
2268 { | |
2269 case INFO_KCD_LEFT: | |
2270 TRACE_ERROR("No LSK for Bond Cancellation"); | |
2271 break; | |
2272 case INFO_KCD_HUP: | |
2273 case INFO_KCD_RIGHT: | |
2274 /*Cancel the ongoing bond operation*/ | |
2275 oldBondState = parent_data->bondState; | |
2276 parent_data->bondState == BOND_CANCELLED; | |
2277 TRACE_EVENT_P2("Bond State changed from %d to %d", oldBondState, parent_data->bondState); | |
2278 mfw_btips_bmgCancelBond(&parent_data->deviceList[parent_data->currentListIndex-1].bdAddr); | |
2279 break; | |
2280 case INFO_KCD_CLEAR: | |
2281 break; | |
2282 default: | |
2283 break; | |
2284 } | |
2285 } | |
2286 | |
2287 void mmi_btips_ResumeBTMainMenu(T_MFW_HND win, UBYTE identifier, UBYTE reason) | |
2288 { | |
2289 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
2290 T_dialog_info * data = (T_dialog_info *)win_data->user; | |
2291 | |
2292 TRACE_FUNCTION_P1("mmi_btips_ResumeBTMainMenu %d", reason); | |
2293 | |
2294 switch (reason) | |
2295 { | |
2296 case INFO_KCD_LEFT: | |
2297 TRACE_ERROR("No LSK - mmi_btips_refreshScreen"); | |
2298 break; | |
2299 case INFO_KCD_HUP: | |
2300 case INFO_KCD_RIGHT: | |
2301 TRACE_ERROR("No RSK - mmi_btips_refreshScreen"); | |
2302 break; | |
2303 case INFO_KCD_CLEAR: | |
2304 break; | |
2305 default: | |
2306 break; | |
2307 } | |
2308 | |
2309 dspl_Enable(1); | |
2310 } | |
2311 | |
2312 | |
2313 void mmi_btips_refreshScreen(T_MFW_HND win, UBYTE identifier, UBYTE reason) | |
2314 { | |
2315 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
2316 T_dialog_info * data = (T_dialog_info *)win_data->user; | |
2317 | |
2318 TRACE_FUNCTION_P1("mmi_btips_refreshScreen %d", reason); | |
2319 | |
2320 switch (reason) | |
2321 { | |
2322 case INFO_KCD_LEFT: | |
2323 TRACE_ERROR("No LSK - mmi_btips_refreshScreen"); | |
2324 break; | |
2325 case INFO_KCD_HUP: | |
2326 case INFO_KCD_RIGHT: | |
2327 TRACE_ERROR("No RSK - mmi_btips_refreshScreen"); | |
2328 break; | |
2329 case INFO_KCD_CLEAR: | |
2330 break; | |
2331 default: | |
2332 break; | |
2333 } | |
2334 dspl_Enable(1); | |
2335 } | |
2336 | |
2337 | |
2338 #endif |