comparison src/ui/bmi/mmiSimToolkit.c @ 169:adae850f9857

mmiSimToolkit.c: formatting fixes
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 17 Jan 2021 23:43:19 +0000
parents c0052fe355d3
children
comparison
equal deleted inserted replaced
168:464d69ef83e2 169:adae850f9857
9 9
10 ******************************************************************************** 10 ********************************************************************************
11 11
12 $Project name: Basic MMI 12 $Project name: Basic MMI
13 $Project code: BMI (6349) 13 $Project code: BMI (6349)
14 $Module: MMI 14 $Module: MMI
15 $File: MmiSimToolkit.c 15 $File: MmiSimToolkit.c
16 $Revision: 1.0 16 $Revision: 1.0
17 17
18 $Author: Condat(UK) 18 $Author: Condat(UK)
19 $Date: 22/02/01 19 $Date: 22/02/01
20 20
21 ******************************************************************************** 21 ********************************************************************************
22 22
23 Description: 23 Description:
24
25 24
26 25
27 ******************************************************************************** 26 ********************************************************************************
28 27
29 $History: MmiSimToolkit.c 28 $History: MmiSimToolkit.c
273 T_MFW_HND info_win; /* window used for simple info screens */ 272 T_MFW_HND info_win; /* window used for simple info screens */
274 T_MFW_HND sat_call_setup_win; /* window associated with the call setup command */ 273 T_MFW_HND sat_call_setup_win; /* window associated with the call setup command */
275 T_SAT_call_setup_parameter * call_setup_parameter; /* parameter psace of call setup to be passed to call() */ 274 T_SAT_call_setup_parameter * call_setup_parameter; /* parameter psace of call setup to be passed to call() */
276 T_SAT_EVENTS active_sat_session; /* event which caused the currently active session */ 275 T_SAT_EVENTS active_sat_session; /* event which caused the currently active session */
277 #ifdef NEW_EDITOR 276 #ifdef NEW_EDITOR
278 T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */ 277 T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */
279 #else 278 #else
280 T_EDITOR_DATA editor_data; 279 T_EDITOR_DATA editor_data;
281 #endif 280 #endif
282 /* Nov 17, 2006 REF:DR:OMAPS00104580 x0039928 281 /* Nov 17, 2006 REF:DR:OMAPS00104580 x0039928
283 -Deleted Redial flag enabling/disabling code*/ 282 -Deleted Redial flag enabling/disabling code*/
323 $Arguments: 322 $Arguments:
324 323
325 *******************************************************************************/ 324 *******************************************************************************/
326 USHORT sim_toolkit_check (struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi) 325 USHORT sim_toolkit_check (struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi)
327 { 326 {
328
329 T_sim_toolkit * data = g_sim_toolkit_data; 327 T_sim_toolkit * data = g_sim_toolkit_data;
330 328
331 TRACE_FUNCTION("sim_toolkit_check"); 329 TRACE_FUNCTION("sim_toolkit_check");
332 330
333 if (data->sat_available_on_SIM EQ TRUE) 331 if (data->sat_available_on_SIM EQ TRUE)
337 } 335 }
338 else 336 else
339 { 337 {
340 return 1; 338 return 1;
341 } 339 }
342 340 }
343 }
344
345
346 341
347 342
348 /******************************************************************************* 343 /*******************************************************************************
349 344
350 $Function: simToolkitInit 345 $Function: simToolkitInit
351 346
352 $Description: This is the start-up time initialisation routine. 347 $Description: This is the start-up time initialisation routine.
353 For compatibility reasons the functions is still there. 348 For compatibility reasons the functions is still there.
354 349
355
356 $Returns: none. 350 $Returns: none.
357 351
358 $Arguments: 352 $Arguments:
359 353
360 *******************************************************************************/ 354 *******************************************************************************/
361 void simToolkitInit (T_MFW_HND parent_window) 355 void simToolkitInit (T_MFW_HND parent_window)
362 { 356 {
363 TRACE_FUNCTION("simToolkitInit"); 357 TRACE_FUNCTION("simToolkitInit");
364 358
365 g_sim_toolkit_data = (T_sim_toolkit *)ALLOC_MEMORY (sizeof (T_sim_toolkit)); 359 g_sim_toolkit_data = (T_sim_toolkit *)ALLOC_MEMORY (sizeof (T_sim_toolkit));
366 360
367 winAutoFocus (TRUE); 361 winAutoFocus (TRUE);
368 sat_set_setup_menu_win(NULL); 362 sat_set_setup_menu_win(NULL);
380 $Arguments: 374 $Arguments:
381 375
382 *******************************************************************************/ 376 *******************************************************************************/
383 void simToolkitExit(void) 377 void simToolkitExit(void)
384 { 378 {
385 TRACE_FUNCTION("simTookitExit"); 379 TRACE_FUNCTION("simTookitExit");
386 sim_toolkit_destroy (g_sim_toolkit_data->win); 380 sim_toolkit_destroy (g_sim_toolkit_data->win);
387 // FREE_MEMORY ((U8 *)g_sim_toolkit_data, sizeof (T_sim_toolkit)); 381 // FREE_MEMORY ((U8 *)g_sim_toolkit_data, sizeof (T_sim_toolkit));
388 if (sat_mainmenu_label != NULL) 382 if (sat_mainmenu_label != NULL)
389 { 383 {
390 sat_destroy_TEXT_ASCIIZ (sat_mainmenu_label); 384 sat_destroy_TEXT_ASCIIZ (sat_mainmenu_label);
391 sat_mainmenu_label = NULL; 385 sat_mainmenu_label = NULL;
392 } 386 }
393 } 387 }
394 388
395 389
396 /******************************************************************** 390 /********************************************************************
397 * 391 *
490 484
491 $Description: Creation of an instance for the SIM Toolkit dialog. 485 $Description: Creation of an instance for the SIM Toolkit dialog.
492 Type of dialog : SINGLE_STATIC 486 Type of dialog : SINGLE_STATIC
493 Top Window must be available at any time, only one instance. 487 Top Window must be available at any time, only one instance.
494 488
495
496 $Returns: none. 489 $Returns: none.
497 490
498 $Arguments: 491 $Arguments:
499 492
500 *******************************************************************************/ 493 *******************************************************************************/
526 data->sat_handle = sat_create ( 519 data->sat_handle = sat_create (
527 data->win, // parent window 520 data->win, // parent window
528 /* possible SAT events */ 521 /* possible SAT events */
529 MfwSatSessionEnd | /* end of session */ 522 MfwSatSessionEnd | /* end of session */
530 MfwSatRefresh | /* refresh SIM fields */ 523 MfwSatRefresh | /* refresh SIM fields */
531 MfwSatDataRefreshed | /*data Refreshed */ 524 MfwSatDataRefreshed | /*data Refreshed */
532 MfwSatTextOut| /* display string */ 525 MfwSatTextOut| /* display string */
533 MfwSatGetKey| /* get user keystroke */ 526 MfwSatGetKey| /* get user keystroke */
534 MfwSatGetString| /* get user input */ 527 MfwSatGetString| /* get user input */
535 MfwSatPlayTone| /* play audio tone */ 528 MfwSatPlayTone| /* play audio tone */
536 MfwSatSetupMenu| /* setup toolkit menu */ 529 MfwSatSetupMenu| /* setup toolkit menu */
537 MfwSatSelectItem| /* select menu item */ 530 MfwSatSelectItem| /* select menu item */
538 MfwSatSendSMS| /* send short message */ 531 MfwSatSendSMS| /* send short message */
539 MfwSatSendSS| /* send service command */ 532 MfwSatSendSS| /* send service command */
540 MfwSatSendUSSD| /* send USSD command */ 533 MfwSatSendUSSD| /* send USSD command */
541 MfwSatSendDTMF| /* send dtmf command */ 534 MfwSatSendDTMF| /* send dtmf command */
542 MfwSatCall| /* setup a call */ 535 MfwSatCall| /* setup a call */
543 MfwSatSetEvents| /* setup event lists */ 536 MfwSatSetEvents| /* setup event lists */
544 MfwSatIdleText| /* set idle text */ 537 MfwSatIdleText| /* set idle text */
545 MfwSatCcRes| /* call control result */ 538 MfwSatCcRes| /* call control result */
546 MfwSatCcAlert /* call control alerting */ 539 MfwSatCcAlert /* call control alerting */
547 #if defined(FF_WAP) 540 #if defined(FF_WAP)
548 |MfwSatLaunchBrowser 541 |MfwSatLaunchBrowser
549 #else 542 #else
550 #endif 543 #endif
551 |MfwSatOpenChannel| 544 |MfwSatOpenChannel|
552 MfwSatCloseChannel| 545 MfwSatCloseChannel|
553 MfwSatSendData| 546 MfwSatSendData|
554 MfwSatReceiveData| 547 MfwSatReceiveData|
555 MfwSatErrBusy /* SAT error handling */ 548 MfwSatErrBusy /* SAT error handling */
556 #ifdef FF_MMI_R99_SAT_LANG 549 #ifdef FF_MMI_R99_SAT_LANG
557 |MfwSatLangNotify | /*OMAPS00070661 (SAT-lang notify and local info(lang setting)) a0393213(R.Prabakar)*/ 550 |MfwSatLangNotify | /*OMAPS00070661 (SAT-lang notify and local info(lang setting)) a0393213(R.Prabakar)*/
558 MfwSatLocalInfo 551 MfwSatLocalInfo
559 #endif 552 #endif
560 , 553 ,
561 (T_MFW_CB)sim_toolkit_sat_cb, // event callback 554 (T_MFW_CB)sim_toolkit_sat_cb, // event callback
562 data->sat_command); // control block for MFW 555 data->sat_command); // control block for MFW
563 556
564 /* 557 /*
655 T_MFW_HND sat_win; 648 T_MFW_HND sat_win;
656 T_SAT_RES sat_res; 649 T_SAT_RES sat_res;
657 650
658 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 651 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
659 #ifdef FF_MMI_SAT_ICON 652 #ifdef FF_MMI_SAT_ICON
660 USHORT icon_length; 653 USHORT icon_length;
661 #endif 654 #endif
662 #ifdef FF_MMI_R99_SAT_LANG 655 #ifdef FF_MMI_R99_SAT_LANG
663 T_DISPLAY_DATA display_info; 656 T_DISPLAY_DATA display_info;
664 #endif 657 #endif
665 658
666 TRACE_FUNCTION ("sim_toolkit_exec()"); 659 TRACE_FUNCTION ("sim_toolkit_exec()");
667 660
668 if (event NEQ SAT_SESSION_END) 661 if (event NEQ SAT_SESSION_END)
2094 $Arguments: 2087 $Arguments:
2095 2088
2096 *******************************************************************************/ 2089 *******************************************************************************/
2097 static void sat_setup_menu_proc(T_SAT_CMD * sat_command) 2090 static void sat_setup_menu_proc(T_SAT_CMD * sat_command)
2098 { 2091 {
2099 TRACE_FUNCTION("sat_setup_menu_proc"); 2092 TRACE_FUNCTION("sat_setup_menu_proc");
2100 2093
2101 if (sat_command->c.menu.items[0].len EQ 0) 2094 if (sat_command->c.menu.items[0].len EQ 0)
2102 { 2095 {
2103 /* 2096 /*
2104 * "Item data object for item 1" is a null data object: 2097 * "Item data object for item 1" is a null data object:
2105 * hide the SIM toolkit menu item in the main menu 2098 * hide the SIM toolkit menu item in the main menu
2106 */ 2099 */
2107 menuDisableSimMenu(); 2100 menuDisableSimMenu();
2108 g_sim_toolkit_data->sat_available_on_SIM = FALSE; 2101 g_sim_toolkit_data->sat_available_on_SIM = FALSE;
2109 //release the labe of the mainmenu 2102 //release the labe of the mainmenu
2110 //GW-SPR#1035 Free memory using sat_destroy_TEXT_ASCIIZ (as it is allocated using corresponding procedure) 2103 //GW-SPR#1035 Free memory using sat_destroy_TEXT_ASCIIZ (as it is allocated using corresponding procedure)
2111 if (sat_mainmenu_label NEQ NULL) 2104 if (sat_mainmenu_label NEQ NULL)
2112 { 2105 {
2113 sat_destroy_TEXT_ASCIIZ (sat_mainmenu_label); 2106 sat_destroy_TEXT_ASCIIZ (sat_mainmenu_label);
2114 sat_mainmenu_label = NULL; 2107 sat_mainmenu_label = NULL;
2115 } 2108 }
2116 2109
2117 if (sat_get_setup_menu_win() NEQ NULL) 2110 if (sat_get_setup_menu_win() NEQ NULL)
2118 { 2111 {
2119 /* there's an active SETUP MENU */ 2112 /* there's an active SETUP MENU */
2120 SEND_EVENT (sat_get_setup_menu_win(), SAT_EXIT, 0, NULL); /* SETUP_MENU shall selfdestroy */ 2113 SEND_EVENT (sat_get_setup_menu_win(), SAT_EXIT, 0, NULL); /* SETUP_MENU shall selfdestroy */
2187 2180
2188 $Function: sat_win_cb 2181 $Function: sat_win_cb
2189 2182
2190 $Description: Default sat window event handler. Avoid intermediate visibility of lower menus 2183 $Description: Default sat window event handler. Avoid intermediate visibility of lower menus
2191 2184
2192
2193 $Returns: none. 2185 $Returns: none.
2194 2186
2195 $Arguments: 2187 $Arguments:
2196 2188
2197 *******************************************************************************/ 2189 *******************************************************************************/
2198 int sat_win_cb (T_MFW_EVENT event, T_MFW_WIN * win) 2190 int sat_win_cb (T_MFW_EVENT event, T_MFW_WIN * win)
2199 { 2191 {
2200 TRACE_FUNCTION("sat_win_cb"); 2192 TRACE_FUNCTION("sat_win_cb");
2201 2193
2202 if (win EQ NULL) 2194 if (win EQ NULL)
2203 return MFW_EVENT_CONSUMED; 2195 return MFW_EVENT_CONSUMED;
2204 2196
2205 switch (event) 2197 switch (event)
2206 { 2198 {
2207 case E_WIN_VISIBLE: /* window changed visibility */ 2199 case E_WIN_VISIBLE: /* window changed visibility */
2208 if (win->flags & E_WIN_VISIBLE) 2200 if (win->flags & E_WIN_VISIBLE)
2222 2214
2223 $Function: sat_kbd_cb 2215 $Function: sat_kbd_cb
2224 2216
2225 $Description: Default sat window keyboard handler 2217 $Description: Default sat window keyboard handler
2226 2218
2227
2228 $Returns: none. 2219 $Returns: none.
2229 2220
2230 $Arguments: 2221 $Arguments:
2231 2222
2232 *******************************************************************************/ 2223 *******************************************************************************/
2241 if ( key == NULL ) 2232 if ( key == NULL )
2242 return MFW_EVENT_CONSUMED; 2233 return MFW_EVENT_CONSUMED;
2243 2234
2244 /* deal with the incoming key code 2235 /* deal with the incoming key code
2245 */ 2236 */
2246 switch( key->code ) 2237 switch( key->code )
2247 { 2238 {
2248 2239 /* Destroy the window on either right softkey or hangup keypresses */
2249 /* Destroy the window on either right softkey or hangup keypresses */
2250 case KCD_HUP: 2240 case KCD_HUP:
2251 case KCD_RIGHT: 2241 case KCD_RIGHT:
2252 { 2242 {
2253 SEND_EVENT(win, SAT_DESTROY_WINDOW, 0, 0); 2243 SEND_EVENT(win, SAT_DESTROY_WINDOW, 0, 0);
2254 break; 2244 break;
2255 } 2245 }
2256 } 2246 }
2257 2247
2258 return MFW_EVENT_CONSUMED; 2248 return MFW_EVENT_CONSUMED;
2259 } 2249 }
2260 2250
2261 2251
2262 /******************************************************************************* 2252 /*******************************************************************************
2263 2253
2279 TRACE_FUNCTION("sat_info_cb"); 2269 TRACE_FUNCTION("sat_info_cb");
2280 2270
2281 if (win EQ NULL) 2271 if (win EQ NULL)
2282 return; 2272 return;
2283 2273
2284 /* 2274 /*
2285 * Who has initiated the information screen 2275 * Who has initiated the information screen
2286 */ 2276 */
2287 switch (identifier) 2277 switch (identifier)
2288 { 2278 {
2289 //x0035544 added fix done by x0021334 for CQ-33597 21-11-2005 2279 //x0035544 added fix done by x0021334 for CQ-33597 21-11-2005
2290 case SAT_SEND_DTMF: // x0021334 : To test SAT session end - CQ33597 2280 case SAT_SEND_DTMF: // x0021334 : To test SAT session end - CQ33597
2291 { 2281 {
2292 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 2282 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
2293 #ifdef FF_MMI_SAT_ICON 2283 #ifdef FF_MMI_SAT_ICON
2294 if (info_data->editor_data.editor_attr.TitleIcon.data != NULL) 2284 if (info_data->editor_data.editor_attr.TitleIcon.data != NULL)
2295 { 2285 {
2296 FREE_MEMORY((U8 *)info_data->editor_data.editor_attr.TitleIcon.data, info_data->editor_data.editor_attr.TitleIcon.width * 2286 FREE_MEMORY((U8 *)info_data->editor_data.editor_attr.TitleIcon.data, info_data->editor_data.editor_attr.TitleIcon.width *
2300 #endif 2290 #endif
2301 2291
2302 switch(reason) 2292 switch(reason)
2303 { 2293 {
2304 case INFO_KCD_RIGHT: 2294 case INFO_KCD_RIGHT:
2305 case INFO_KCD_HUP: 2295 case INFO_KCD_HUP:
2306 // Call mfw function to end the session 2296 // Call mfw function to end the session
2307 Mfw_SAT_DTMF_EndSession(); 2297 Mfw_SAT_DTMF_EndSession();
2308 #ifdef NEW_EDITOR 2298 #ifdef NEW_EDITOR
2309 AUI_edit_Destroy(info_data->info_win); 2299 AUI_edit_Destroy(info_data->info_win);
2310 #else /* NEW_EDITOR */ 2300 #else /* NEW_EDITOR */
2360 $Arguments: 2350 $Arguments:
2361 2351
2362 *******************************************************************************/ 2352 *******************************************************************************/
2363 void sat_set_setup_menu_win(T_MFW_HND win) 2353 void sat_set_setup_menu_win(T_MFW_HND win)
2364 { 2354 {
2365 TRACE_FUNCTION("sat_set_setup_menu_win"); 2355 TRACE_FUNCTION("sat_set_setup_menu_win");
2366
2367 g_sim_toolkit_data->sat_setup_menu_win = win; 2356 g_sim_toolkit_data->sat_setup_menu_win = win;
2368 } 2357 }
2369 2358
2370 2359
2371 /******************************************************************************* 2360 /*******************************************************************************
2379 $Arguments: 2368 $Arguments:
2380 2369
2381 *******************************************************************************/ 2370 *******************************************************************************/
2382 T_MFW_HND sat_get_setup_menu_win(void) 2371 T_MFW_HND sat_get_setup_menu_win(void)
2383 { 2372 {
2384 TRACE_EVENT("sat_get_setup_menu_win"); 2373 TRACE_EVENT("sat_get_setup_menu_win");
2385 return g_sim_toolkit_data->sat_setup_menu_win; 2374 return g_sim_toolkit_data->sat_setup_menu_win;
2386 } 2375 }
2387 2376
2388 2377
2389 /******************************************************************************* 2378 /*******************************************************************************
2397 $Arguments: 2386 $Arguments:
2398 2387
2399 *******************************************************************************/ 2388 *******************************************************************************/
2400 void sat_set_setup_menu_listmnu_win(T_MFW_HND win) 2389 void sat_set_setup_menu_listmnu_win(T_MFW_HND win)
2401 { 2390 {
2402 TRACE_FUNCTION("sat_set_setup_menu_listmnu_win"); 2391 TRACE_FUNCTION("sat_set_setup_menu_listmnu_win");
2403
2404 g_sim_toolkit_data->sat_setup_menu_listmnu_win= win; 2392 g_sim_toolkit_data->sat_setup_menu_listmnu_win= win;
2405 } 2393 }
2406 2394
2407 2395
2408 /******************************************************************************* 2396 /*******************************************************************************
2416 $Arguments: 2404 $Arguments:
2417 2405
2418 *******************************************************************************/ 2406 *******************************************************************************/
2419 T_MFW_HND sat_get_setup_menu_listmnu_win(void) 2407 T_MFW_HND sat_get_setup_menu_listmnu_win(void)
2420 { 2408 {
2421 TRACE_EVENT("sat_get_setup_menu_listmnu_win"); 2409 TRACE_EVENT("sat_get_setup_menu_listmnu_win");
2422 return g_sim_toolkit_data->sat_setup_menu_listmnu_win; 2410 return g_sim_toolkit_data->sat_setup_menu_listmnu_win;
2423 } 2411 }
2424 2412
2425 2413
2426 /******************************************************************************* 2414 /*******************************************************************************
2434 $Arguments: 2422 $Arguments:
2435 2423
2436 *******************************************************************************/ 2424 *******************************************************************************/
2437 void sat_set_call_setup_win(T_MFW_HND win) 2425 void sat_set_call_setup_win(T_MFW_HND win)
2438 { 2426 {
2439 TRACE_FUNCTION("sat_set_call_setup_win"); 2427 TRACE_FUNCTION("sat_set_call_setup_win");
2440 g_sim_toolkit_data->sat_call_setup_win = win; 2428 g_sim_toolkit_data->sat_call_setup_win = win;
2441 } 2429 }
2442 2430
2443 2431
2444 /******************************************************************************* 2432 /*******************************************************************************
2453 2441
2454 *******************************************************************************/ 2442 *******************************************************************************/
2455 /* Marcus: Issue 1057: 21/01/2003: Made public */ 2443 /* Marcus: Issue 1057: 21/01/2003: Made public */
2456 T_MFW_HND sat_get_call_setup_win(void) 2444 T_MFW_HND sat_get_call_setup_win(void)
2457 { 2445 {
2458 TRACE_FUNCTION("sat_get_call_setup_win"); 2446 TRACE_FUNCTION("sat_get_call_setup_win");
2459 return g_sim_toolkit_data->sat_call_setup_win; 2447 return g_sim_toolkit_data->sat_call_setup_win;
2460 } 2448 }
2461 2449
2462 /******************************************************************************* 2450 /*******************************************************************************
2463 2451
2506 }; 2494 };
2507 2495
2508 void sat_ascii_to_gsm (char * gsm_string, char * ascii_string, U16 length) 2496 void sat_ascii_to_gsm (char * gsm_string, char * ascii_string, U16 length)
2509 { 2497 {
2510 U16 i; 2498 U16 i;
2511 TRACE_FUNCTION("sat_ascii_to_gsm"); 2499 TRACE_FUNCTION("sat_ascii_to_gsm");
2512 2500
2513 for (i = 0; i < length; i++) 2501 for (i = 0; i < length; i++)
2514 gsm_string[i] = g_ascii_gsm_table[ascii_string[i]]; 2502 gsm_string[i] = g_ascii_gsm_table[ascii_string[i]];
2515 } 2503 }
2516 2504
2526 2514
2527 *******************************************************************************/ 2515 *******************************************************************************/
2528 void sat_ascii_to_ucode (wchar_t * UCS2_chars, char * ascii_string, U16 length) 2516 void sat_ascii_to_ucode (wchar_t * UCS2_chars, char * ascii_string, U16 length)
2529 { 2517 {
2530 U16 i; 2518 U16 i;
2531 TRACE_FUNCTION("sat_ascii_to_ucode"); 2519 TRACE_FUNCTION("sat_ascii_to_ucode");
2532 for (i = 0; i < length; i++) 2520 for (i = 0; i < length; i++)
2533 UCS2_chars[i] = (wchar_t)(int)(ascii_string[i]);/*a0393213 extra casting done to avoid lint warning*/ 2521 UCS2_chars[i] = (wchar_t)(int)(ascii_string[i]);/*a0393213 extra casting done to avoid lint warning*/
2534 } 2522 }
2535 2523
2536 /******************************************************************************* 2524 /*******************************************************************************
2545 2533
2546 *******************************************************************************/ 2534 *******************************************************************************/
2547 void sat_ucode_to_ascii (char * ascii_string, wchar_t * UCS2_chars, U16 length) 2535 void sat_ucode_to_ascii (char * ascii_string, wchar_t * UCS2_chars, U16 length)
2548 { 2536 {
2549 U16 i; 2537 U16 i;
2550 TRACE_FUNCTION("sat_ucode_to_asci"); 2538 TRACE_FUNCTION("sat_ucode_to_asci");
2551 2539
2552 for (i = 0; i < length; i++) 2540 for (i = 0; i < length; i++)
2553 ascii_string[i] = (char)UCS2_chars[i]; 2541 ascii_string[i] = (char)UCS2_chars[i];
2554 ascii_string[i] = '\0'; 2542 ascii_string[i] = '\0';
2555 } 2543 }
2662 $Description: This function decodes a GSM 7-bit string into ASCII equivalent 2650 $Description: This function decodes a GSM 7-bit string into ASCII equivalent
2663 2651
2664 $Returns: length of decoded string 2652 $Returns: length of decoded string
2665 2653
2666 $Arguments: encoded - GSM string pointer 2654 $Arguments: encoded - GSM string pointer
2667 plain - Buffer to hold the decoded ASCII string 2655 plain - Buffer to hold the decoded ASCII string
2668 Length - Length of the encoded GSM string 2656 Length - Length of the encoded GSM string
2669 2657
2670 2658
2671 *******************************************************************************/ 2659 *******************************************************************************/
2672 unsigned char DecodeGSM7ToASCII(U8 * encoded, U8 * plain, U8 Length) 2660 unsigned char DecodeGSM7ToASCII(U8 * encoded, U8 * plain, U8 Length)
2673 { 2661 {
2708 2696
2709 $Returns: none. 2697 $Returns: none.
2710 2698
2711 $Arguments: 2699 $Arguments:
2712 2700
2713 MC, Note: text returned by this function has no Unicode tag at beginning 2701 MC, Note: text returned by this function has no Unicode tag at beginning
2714 $Returns: none. 2702 $Returns: none.
2715 2703
2716 $Arguments: 2704 $Arguments:
2717 2705
2718 *******************************************************************************/ 2706 *******************************************************************************/
2719 /*MC, SPR 940/2 uncommented function back in, and then rewrote it :)*/ 2707 /*MC, SPR 940/2 uncommented function back in, and then rewrote it :)*/
2720 void sat_TEXT_to_UCODE (char* destination, int size, T_SAT_TXT * txt) 2708 void sat_TEXT_to_UCODE (char* destination, int size, T_SAT_TXT * txt)
2721 { 2709 {
2722
2723 UBYTE * temp_buffer; 2710 UBYTE * temp_buffer;
2724 2711
2725 char debug[50]; 2712 char debug[50];
2726 2713
2727 2714 TRACE_EVENT("sat_TEXT_to_UCODE()");
2728 TRACE_EVENT("sat_TEXT_to_UCODE()");
2729 2715
2730 switch (txt->code) /*DCS of Text*/ 2716 switch (txt->code) /*DCS of Text*/
2731 { 2717 {
2732 case MFW_DCS_7bits: 2718 case MFW_DCS_7bits:
2733 temp_buffer = (UBYTE *)ALLOC_MEMORY(((txt->len*8)/7)+1); 2719 temp_buffer = (UBYTE *)ALLOC_MEMORY(((txt->len*8)/7)+1);
2734 /*convert from 7 to 8 bit*/ 2720 /*convert from 7 to 8 bit*/
2735 utl_cvt7To8 ((UBYTE *)txt + txt->text, txt->len, temp_buffer, 0); 2721 utl_cvt7To8 ((UBYTE *)txt + txt->text, txt->len, temp_buffer, 0);
2736 2722
2737 /*MC, convert from 8 bit to UCS2*/ 2723 /*MC, convert from 8 bit to UCS2*/
2738 /*SPR2175, use new function for conversion*/ 2724 /*SPR2175, use new function for conversion*/
2739 ATB_convert_String((char*)temp_buffer, MFW_DCS_8bits, (((txt->len*8)/7)+1), (char*)destination, MFW_DCS_UCS2, /*txt->len*2*/size, FALSE); 2725 ATB_convert_String((char*)temp_buffer, MFW_DCS_8bits, (((txt->len*8)/7)+1), (char*)destination, MFW_DCS_UCS2, /*txt->len*2*/size, FALSE);
2740 FREE_MEMORY ((U8 *)temp_buffer, ((txt->len*8)/7)+1); 2726 FREE_MEMORY ((U8 *)temp_buffer, ((txt->len*8)/7)+1);
2741 break; 2727 break;
2742 case MFW_DCS_8bits:/*DCS tends to come out as 8 bit whatever it is*/ 2728 case MFW_DCS_8bits:/*DCS tends to come out as 8 bit whatever it is*/
2743 if (*((UBYTE*)txt+txt->text) !=0x80)/*MC, if ASCII, convert to Unicode*/ 2729 if (*((UBYTE*)txt+txt->text) !=0x80)/*MC, if ASCII, convert to Unicode*/
2744 { 2730 {
2745 #ifdef SAT_TEXT_TRACING 2731 #ifdef SAT_TEXT_TRACING
2746 //string_GSM_to_UCS2((UBYTE)txt->len, (UBYTE *)txt + txt->text, (USHORT)(txt->len), destination); 2732 //string_GSM_to_UCS2((UBYTE)txt->len, (UBYTE *)txt + txt->text, (USHORT)(txt->len), destination);
2747 sprintf(debug, "Length of MENU HEADER:%d", txt->len); 2733 sprintf(debug, "Length of MENU HEADER:%d", txt->len);
2748 TRACE_EVENT(debug); 2734 TRACE_EVENT(debug);
2749 #endif 2735 #endif
2750 /*MC, convert from 8 bit to UCS2*/ 2736 /*MC, convert from 8 bit to UCS2*/
2751 /*SPR2175, use new function for conversion*/ 2737 /*SPR2175, use new function for conversion*/
2752 ATB_convert_String((char *)txt +txt->text, MFW_DCS_8bits, txt->len, (char*)destination, MFW_DCS_UCS2, /*txt->len*2*/size, FALSE); 2738 ATB_convert_String((char *)txt +txt->text, MFW_DCS_8bits, txt->len, (char*)destination, MFW_DCS_UCS2, /*txt->len*2*/size, FALSE);
2753 } 2739 }
2754 else 2740 else
2755 { 2741 {
2756 /*MC, unicode string, convert to our display format*/ 2742 /*MC, unicode string, convert to our display format*/
2757 destination[0] = (char)0x80;/*SPR 1728, add unicode tag*/ 2743 destination[0] = (char)0x80;/*SPR 1728, add unicode tag*/
2758 destination[1] = (char)0x7f; 2744 destination[1] = (char)0x7f;
2759 2745
2760 memcpy(&destination[2], (UBYTE*)txt+txt->text+1, txt->len-1); 2746 memcpy(&destination[2], (UBYTE*)txt+txt->text+1, txt->len-1);
2761 2747 }
2762 }
2763 break; 2748 break;
2764 case MFW_DCS_UCS2:/*MC, unicode string, convert to our display format*/ 2749 case MFW_DCS_UCS2:/*MC, unicode string, convert to our display format*/
2765 { destination[0] = (char)0x80;/*SPR 1728, add unicode tag*/ 2750 { destination[0] = (char)0x80;/*SPR 1728, add unicode tag*/
2766 destination[1] = (char)0x7f; 2751 destination[1] = (char)0x7f;
2767 2752
2768 //memcpy(&destination[2], (UBYTE*)txt+txt->text+1, txt->len-1); 2753 //memcpy(&destination[2], (UBYTE*)txt+txt->text+1, txt->len-1);
2769 memcpy(&destination[2], (UBYTE*)txt+txt->text, txt->len); /* SPR#2340 - DS - Corrected len */ 2754 memcpy(&destination[2], (UBYTE*)txt+txt->text, txt->len); /* SPR#2340 - DS - Corrected len */
2770 2755 }
2771 }
2772
2773 break; 2756 break;
2757
2774 default: 2758 default:
2775 TRACE_EVENT("sat_TEXT_to_UCODE() unexp. DCS"); 2759 TRACE_EVENT("sat_TEXT_to_UCODE() unexp. DCS");
2776 } 2760 }
2761
2777 /*MC, SPR 1086 Commented out traces here, as long buffers cause a crash*/ 2762 /*MC, SPR 1086 Commented out traces here, as long buffers cause a crash*/
2778 {int i; 2763 {int i;
2779 2764
2780 for (i=0; i <size && i<20; i++) 2765 for (i=0; i <size && i<20; i++)
2781 { if (destination[i] == 0) 2766 { if (destination[i] == 0)
2792 /******************************************************************************* 2777 /*******************************************************************************
2793 2778
2794 $Function: sat_create_TEXT_ASCIIZ 2779 $Function: sat_create_TEXT_ASCIIZ
2795 2780
2796 $Description: This routine creates out of an MFW SAT text descriptor an 2781 $Description: This routine creates out of an MFW SAT text descriptor an
2797 dynamically allocated ASCIIZ string pointer 2782 dynamically allocated ASCIIZ string pointer
2798 2783
2799 $Returns: none. 2784 $Returns: none.
2800 2785
2801 $Arguments: 2786 $Arguments:
2802 2787
2804 #define SAT_LEN_SIZE (U16)sizeof(U16) /* used to hold the allocation size */ 2789 #define SAT_LEN_SIZE (U16)sizeof(U16) /* used to hold the allocation size */
2805 #define SAT_TERMINATOR_SIZE (U16)sizeof(U16) /* used to hold terminating '\0' in U8 and U16 */ 2790 #define SAT_TERMINATOR_SIZE (U16)sizeof(U16) /* used to hold terminating '\0' in U8 and U16 */
2806 2791
2807 char * sat_create_TEXT_ASCIIZ (T_SAT_TXT * txt) 2792 char * sat_create_TEXT_ASCIIZ (T_SAT_TXT * txt)
2808 { 2793 {
2809
2810 char * res; 2794 char * res;
2811 U16 size; 2795 U16 size;
2812 UBYTE first_char= *((UBYTE*)txt+txt->text);/*SPR 1728*/ 2796 UBYTE first_char= *((UBYTE*)txt+txt->text);/*SPR 1728*/
2813 TRACE_EVENT("sat_create_TEXT_ASCIIZ ()"); 2797 TRACE_EVENT("sat_create_TEXT_ASCIIZ ()");
2814 #ifdef NO_ASCIIZ 2798 #ifdef NO_ASCIIZ
2815 TRACE_EVENT_P3("DCS:%d first_char:%d len: %d", txt->code, first_char, txt->len); 2799 TRACE_EVENT_P3("DCS:%d first_char:%d len: %d", txt->code, first_char, txt->len);
2816 /*SPR 1728, if unicode string format it for display*/ 2800 /*SPR 1728, if unicode string format it for display*/
2817 if ( first_char==0x80 ||txt->code==MFW_DCS_UCS2) 2801 if ( first_char==0x80 ||txt->code==MFW_DCS_UCS2)
2842 res += SAT_LEN_SIZE, /* set the pointer to the string, not to the alloc size */ 2826 res += SAT_LEN_SIZE, /* set the pointer to the string, not to the alloc size */
2843 2827
2844 /* convert the string */ 2828 /* convert the string */
2845 sat_TEXT_to_ASCIIZ (res, txt); 2829 sat_TEXT_to_ASCIIZ (res, txt);
2846 2830
2847
2848 return res; 2831 return res;
2849 } 2832 }
2850 2833
2851 /******************************************************************************* 2834 /*******************************************************************************
2852 2835
2853 $Function: sat_create_TEXT_UCODE 2836 $Function: sat_create_TEXT_UCODE
2854 2837
2855 $Description: This routine creates out of an MFW SAT text descriptor an 2838 $Description: This routine creates out of an MFW SAT text descriptor an
2856 dynamically allocated UCS2 string pointer 2839 dynamically allocated UCS2 string pointer
2857 2840
2858 $Returns: none. 2841 $Returns: none.
2859 2842
2860 $Arguments: 2843 $Arguments:
2861 2844
2889 /******************************************************************************* 2872 /*******************************************************************************
2890 2873
2891 $Function: sat_create_ITEM_ASCIIZ 2874 $Function: sat_create_ITEM_ASCIIZ
2892 2875
2893 $Description: This routine converts a MFW SAT Item descriptor into a 2876 $Description: This routine converts a MFW SAT Item descriptor into a
2894 conventional String pointer 2877 conventional String pointer
2895 MC, note: this function will add a Unicode tag to the beginning of Unicode 2878 MC, note: this function will add a Unicode tag to the beginning of Unicode
2896 strings returned 2879 strings returned
2897 2880
2898 $Returns: none. 2881 $Returns: none.
2899 2882
2900 $Arguments: 2883 $Arguments:
2901 2884
2975 sat_gsm_to_ascii (res, (char *)item + item->text, item->len); 2958 sat_gsm_to_ascii (res, (char *)item + item->text, item->len);
2976 #ifdef NO_ASCIIZ 2959 #ifdef NO_ASCIIZ
2977 } 2960 }
2978 #endif 2961 #endif
2979 2962
2980
2981 return res; 2963 return res;
2982 } 2964 }
2983 2965
2984 /******************************************************************************* 2966 /*******************************************************************************
2985 2967
2986 $Function: sat_destroy_TEXT_ASCIIZ 2968 $Function: sat_destroy_TEXT_ASCIIZ
2987 2969
2988 $Description: destroy an ASCIIZ string previously created with 2970 $Description: destroy an ASCIIZ string previously created with
2989 sat_create_TEXT_ASCIIZ() or sat_create_ITEM_ASCIIZ() 2971 sat_create_TEXT_ASCIIZ() or sat_create_ITEM_ASCIIZ()
2990 2972
2991 $Returns: none. 2973 $Returns: none.
2992 2974
2993 $Arguments: 2975 $Arguments:
2994 2976
2995 *******************************************************************************/ 2977 *******************************************************************************/
2996 void sat_destroy_TEXT_ASCIIZ (char * str) 2978 void sat_destroy_TEXT_ASCIIZ (char * str)
2997 { 2979 {
2998 /*MC, SPR 940/2 if we're in chinese, use Unicode string destuctor*/ 2980 /*MC, SPR 940/2 if we're in chinese, use Unicode string destuctor*/
2999 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) 2981 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
3000 { sat_destroy_TEXT_UCODE(str); 2982 {
3001 return; 2983 sat_destroy_TEXT_UCODE(str);
3002 } 2984 return;
3003 2985 }
3004 TRACE_FUNCTION("sat_destroy_TEXT_ASCIIZ"); 2986
2987 TRACE_FUNCTION("sat_destroy_TEXT_ASCIIZ");
3005 2988
3006 if (str NEQ NULL) 2989 if (str NEQ NULL)
3007 { 2990 {
3008 /* the two bytes before the string are holding the alloc size info */ 2991 /* the two bytes before the string are holding the alloc size info */
3009 FREE_MEMORY ((U8 *)(str-SAT_LEN_SIZE), *(U16 *) (str-SAT_LEN_SIZE)); 2992 FREE_MEMORY ((U8 *)(str-SAT_LEN_SIZE), *(U16 *) (str-SAT_LEN_SIZE));
3010 str = NULL; 2993 str = NULL;
3011 } 2994 }
3012 } 2995 }
3013 2996
3014 #ifdef MMI_TEST_SAT_LAUNCH_BROWSER 2997 #ifdef MMI_TEST_SAT_LAUNCH_BROWSER
3015 void mmiOpenDummyBrowser(T_MFW_HND win,char* information) 2998 void mmiOpenDummyBrowser(T_MFW_HND win,char* information)
3016 { 2999 {
3052 editor_data.editor_attr.win.sx = 84; 3035 editor_data.editor_attr.win.sx = 84;
3053 editor_data.editor_attr.win.sy = 24; 3036 editor_data.editor_attr.win.sy = 24;
3054 editor_data.editor_attr.font = 0; 3037 editor_data.editor_attr.font = 0;
3055 editor_data.editor_attr.mode = edtCurNone; 3038 editor_data.editor_attr.mode = edtCurNone;
3056 editor_data.editor_attr.controls = 0; 3039 editor_data.editor_attr.controls = 0;
3057 editor_data.editor_attr.size = INFORMATION_SIZE; 3040 editor_data.editor_attr.size = INFORMATION_SIZE;
3058 3041
3059 editor_data.editor_attr.text = information; 3042 editor_data.editor_attr.text = information;
3060 3043
3061 /* create the dialog handler */ 3044 /* create the dialog handler */
3062 editor_start(win, &editor_data); /* start the editor */ 3045 editor_start(win, &editor_data); /* start the editor */
3083 $Arguments: 3066 $Arguments:
3084 3067
3085 *******************************************************************************/ 3068 *******************************************************************************/
3086 void sat_release_the_editor (void) 3069 void sat_release_the_editor (void)
3087 { 3070 {
3088 TRACE_FUNCTION("sat_release_the_editor()"); 3071 TRACE_FUNCTION("sat_release_the_editor()");
3089 3072
3090 if (g_sim_toolkit_data->info_win NEQ NULL) 3073 if (g_sim_toolkit_data->info_win NEQ NULL)
3091 { 3074 {
3092 /* destroy any infoscreen if exist */ 3075 /* destroy any infoscreen if exist */
3093 /* SPR#1428 - SH - New Editor changes */ 3076 /* SPR#1428 - SH - New Editor changes */
3102 3085
3103 /*MC, SPR 940/2 uncommented function and changed param to char* */ 3086 /*MC, SPR 940/2 uncommented function and changed param to char* */
3104 void sat_destroy_TEXT_UCODE (/*cp_wstring_t*/char* str) 3087 void sat_destroy_TEXT_UCODE (/*cp_wstring_t*/char* str)
3105 { 3088 {
3106 if (str NEQ NULL) 3089 if (str NEQ NULL)
3107 { 3090 {
3108 FREE_MEMORY ((U8 *)((char *)str-SAT_LEN_SIZE), *(U16 *) ((char *)str-SAT_LEN_SIZE)); 3091 FREE_MEMORY ((U8 *)((char *)str-SAT_LEN_SIZE), *(U16 *) ((char *)str-SAT_LEN_SIZE));
3109 str = NULL; 3092 str = NULL;
3110 } 3093 }
3111 } 3094 }
3112 /******************************************************************************* 3095 /*******************************************************************************
3113 3096
3114 $Function: sat_add_unicode_tag_if_needed 3097 $Function: sat_add_unicode_tag_if_needed
3115 3098
3116 $Description: Checks if string ought to be pre-pended with a unicode tag and if it ought to, 3099 $Description: Checks if string ought to be pre-pended with a unicode tag and if it ought to,
3117 adds the tag (note, the string has to already have 2 "extra" chars allocated 3100 adds the tag (note, the string has to already have 2 "extra" chars allocated
3118 to it; this normally happens in the create_TEXT_UCODE function) 3101 to it; this normally happens in the create_TEXT_UCODE function)
3119 3102
3120 $Returns: none. 3103 $Returns: none.
3121 3104
3122 $Arguments: string 3105 $Arguments: string
3123 3106
3124 *******************************************************************************/ 3107 *******************************************************************************/
3125 /*SPR1257, new function*/ 3108 /*SPR1257, new function*/
3126 void sat_add_unicode_tag_if_needed(char* string) 3109 void sat_add_unicode_tag_if_needed(char* string)
3127 {/*Add tag to Unicode strings so info dialogue displays them correctly*/ 3110 {/*Add tag to Unicode strings so info dialogue displays them correctly*/
3128 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE&& string[0]!= (char)0x80 ) 3111 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE&& string[0]!= (char)0x80 )
3129 { 3112 {
3130 char TempString[MAX_MSG_LEN_SGL];/*MC, SPR 1292, more sensible length*/ 3113 char TempString[MAX_MSG_LEN_SGL];/*MC, SPR 1292, more sensible length*/
3131 #ifdef NEW_EDITOR /* SPR#1428 - SH - New Editor changes - new function to calculate length of unicode string */ 3114 #ifdef NEW_EDITOR /* SPR#1428 - SH - New Editor changes - new function to calculate length of unicode string */
3132 memcpy(&TempString[2], GET_TEXT(TxtSoftCall), ATB_string_UCLength((USHORT*)string)*sizeof(USHORT)); 3115 memcpy(&TempString[2], GET_TEXT(TxtSoftCall), ATB_string_UCLength((USHORT*)string)*sizeof(USHORT));
3133 #else /* NEW_EDITOR */ 3116 #else /* NEW_EDITOR */
3134 memcpy(&TempString[2], string, strlenUnicode((U16*) string)); 3117 memcpy(&TempString[2], string, strlenUnicode((U16*) string));
3135 #endif /* NEW_EDITOR */ 3118 #endif /* NEW_EDITOR */
3136 3119
3137 TempString[0] = (char)0x80; 3120 TempString[0] = (char)0x80;
3138 TempString[1] = (char)0x7f; 3121 TempString[1] = (char)0x7f;
3139 #ifdef NEW_EDITOR /* SPR#1428 - SH - New Editor changes - new function to calculate length of unicode string */ 3122 #ifdef NEW_EDITOR /* SPR#1428 - SH - New Editor changes - new function to calculate length of unicode string */
3140 memcpy(string, TempString, (ATB_string_UCLength((USHORT*)TempString)+1)*sizeof(USHORT)); 3123 memcpy(string, TempString, (ATB_string_UCLength((USHORT*)TempString)+1)*sizeof(USHORT));
3141 #else /* NEW_EDITOR */ 3124 #else /* NEW_EDITOR */
3142 memcpy( string, TempString, strlenUnicode((U16*)TempString)); 3125 memcpy( string, TempString, strlenUnicode((U16*)TempString));
3143 #endif /* NEW_EDITOR */ 3126 #endif /* NEW_EDITOR */
3144 3127
3145 } 3128 }
3146 } 3129 }
3147 3130
3148 /* Nov 17, 2006 REF:DR:OMAPS00104580 x0039928 3131 /* Nov 17, 2006 REF:DR:OMAPS00104580 x0039928
3149 -Deleted Redial flag enabling/disabling code*/ 3132 -Deleted Redial flag enabling/disabling code*/
3150