FreeCalypso > hg > fc-tourmaline
changeset 169:adae850f9857
mmiSimToolkit.c: formatting fixes
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 17 Jan 2021 23:43:19 +0000 |
parents | 464d69ef83e2 |
children | 6125210a379b |
files | src/ui/bmi/mmiSimToolkit.c |
diffstat | 1 files changed, 123 insertions(+), 141 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ui/bmi/mmiSimToolkit.c Sun Jan 17 23:20:41 2021 +0000 +++ b/src/ui/bmi/mmiSimToolkit.c Sun Jan 17 23:43:19 2021 +0000 @@ -11,19 +11,18 @@ $Project name: Basic MMI $Project code: BMI (6349) - $Module: MMI - $File: MmiSimToolkit.c - $Revision: 1.0 - - $Author: Condat(UK) - $Date: 22/02/01 + $Module: MMI + $File: MmiSimToolkit.c + $Revision: 1.0 + + $Author: Condat(UK) + $Date: 22/02/01 ******************************************************************************** Description: - ******************************************************************************** $History: MmiSimToolkit.c @@ -275,7 +274,7 @@ T_SAT_call_setup_parameter * call_setup_parameter; /* parameter psace of call setup to be passed to call() */ T_SAT_EVENTS active_sat_session; /* event which caused the currently active session */ #ifdef NEW_EDITOR - T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */ + T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */ #else T_EDITOR_DATA editor_data; #endif @@ -325,7 +324,6 @@ *******************************************************************************/ USHORT sim_toolkit_check (struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi) { - T_sim_toolkit * data = g_sim_toolkit_data; TRACE_FUNCTION("sim_toolkit_check"); @@ -339,12 +337,9 @@ { return 1; } - } - - /******************************************************************************* $Function: simToolkitInit @@ -352,7 +347,6 @@ $Description: This is the start-up time initialisation routine. For compatibility reasons the functions is still there. - $Returns: none. $Arguments: @@ -360,7 +354,7 @@ *******************************************************************************/ void simToolkitInit (T_MFW_HND parent_window) { - TRACE_FUNCTION("simToolkitInit"); + TRACE_FUNCTION("simToolkitInit"); g_sim_toolkit_data = (T_sim_toolkit *)ALLOC_MEMORY (sizeof (T_sim_toolkit)); @@ -382,14 +376,14 @@ *******************************************************************************/ void simToolkitExit(void) { - TRACE_FUNCTION("simTookitExit"); + TRACE_FUNCTION("simTookitExit"); sim_toolkit_destroy (g_sim_toolkit_data->win); // FREE_MEMORY ((U8 *)g_sim_toolkit_data, sizeof (T_sim_toolkit)); - if (sat_mainmenu_label != NULL) - { - sat_destroy_TEXT_ASCIIZ (sat_mainmenu_label); - sat_mainmenu_label = NULL; - } + if (sat_mainmenu_label != NULL) + { + sat_destroy_TEXT_ASCIIZ (sat_mainmenu_label); + sat_mainmenu_label = NULL; + } } @@ -492,7 +486,6 @@ Type of dialog : SINGLE_STATIC Top Window must be available at any time, only one instance. - $Returns: none. $Arguments: @@ -528,8 +521,8 @@ /* possible SAT events */ MfwSatSessionEnd | /* end of session */ MfwSatRefresh | /* refresh SIM fields */ - MfwSatDataRefreshed | /*data Refreshed */ - MfwSatTextOut| /* display string */ + MfwSatDataRefreshed | /*data Refreshed */ + MfwSatTextOut| /* display string */ MfwSatGetKey| /* get user keystroke */ MfwSatGetString| /* get user input */ MfwSatPlayTone| /* play audio tone */ @@ -540,23 +533,23 @@ MfwSatSendUSSD| /* send USSD command */ MfwSatSendDTMF| /* send dtmf command */ MfwSatCall| /* setup a call */ - MfwSatSetEvents| /* setup event lists */ - MfwSatIdleText| /* set idle text */ - MfwSatCcRes| /* call control result */ + MfwSatSetEvents| /* setup event lists */ + MfwSatIdleText| /* set idle text */ + MfwSatCcRes| /* call control result */ MfwSatCcAlert /* call control alerting */ #if defined(FF_WAP) |MfwSatLaunchBrowser #else #endif |MfwSatOpenChannel| - MfwSatCloseChannel| - MfwSatSendData| - MfwSatReceiveData| - MfwSatErrBusy /* SAT error handling */ - #ifdef FF_MMI_R99_SAT_LANG - |MfwSatLangNotify | /*OMAPS00070661 (SAT-lang notify and local info(lang setting)) a0393213(R.Prabakar)*/ - MfwSatLocalInfo - #endif + MfwSatCloseChannel| + MfwSatSendData| + MfwSatReceiveData| + MfwSatErrBusy /* SAT error handling */ + #ifdef FF_MMI_R99_SAT_LANG + |MfwSatLangNotify | /*OMAPS00070661 (SAT-lang notify and local info(lang setting)) a0393213(R.Prabakar)*/ + MfwSatLocalInfo + #endif , (T_MFW_CB)sim_toolkit_sat_cb, // event callback data->sat_command); // control block for MFW @@ -657,10 +650,10 @@ // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 #ifdef FF_MMI_SAT_ICON - USHORT icon_length; + USHORT icon_length; #endif #ifdef FF_MMI_R99_SAT_LANG - T_DISPLAY_DATA display_info; + T_DISPLAY_DATA display_info; #endif TRACE_FUNCTION ("sim_toolkit_exec()"); @@ -2096,7 +2089,7 @@ *******************************************************************************/ static void sat_setup_menu_proc(T_SAT_CMD * sat_command) { - TRACE_FUNCTION("sat_setup_menu_proc"); + TRACE_FUNCTION("sat_setup_menu_proc"); if (sat_command->c.menu.items[0].len EQ 0) { @@ -2105,14 +2098,14 @@ * hide the SIM toolkit menu item in the main menu */ menuDisableSimMenu(); - g_sim_toolkit_data->sat_available_on_SIM = FALSE; - //release the labe of the mainmenu - //GW-SPR#1035 Free memory using sat_destroy_TEXT_ASCIIZ (as it is allocated using corresponding procedure) - if (sat_mainmenu_label NEQ NULL) - { - sat_destroy_TEXT_ASCIIZ (sat_mainmenu_label); - sat_mainmenu_label = NULL; - } + g_sim_toolkit_data->sat_available_on_SIM = FALSE; + //release the labe of the mainmenu + //GW-SPR#1035 Free memory using sat_destroy_TEXT_ASCIIZ (as it is allocated using corresponding procedure) + if (sat_mainmenu_label NEQ NULL) + { + sat_destroy_TEXT_ASCIIZ (sat_mainmenu_label); + sat_mainmenu_label = NULL; + } if (sat_get_setup_menu_win() NEQ NULL) { @@ -2189,7 +2182,6 @@ $Description: Default sat window event handler. Avoid intermediate visibility of lower menus - $Returns: none. $Arguments: @@ -2197,10 +2189,10 @@ *******************************************************************************/ int sat_win_cb (T_MFW_EVENT event, T_MFW_WIN * win) { - TRACE_FUNCTION("sat_win_cb"); + TRACE_FUNCTION("sat_win_cb"); if (win EQ NULL) - return MFW_EVENT_CONSUMED; + return MFW_EVENT_CONSUMED; switch (event) { @@ -2224,7 +2216,6 @@ $Description: Default sat window keyboard handler - $Returns: none. $Arguments: @@ -2243,19 +2234,18 @@ /* deal with the incoming key code */ - switch( key->code ) - { - - /* Destroy the window on either right softkey or hangup keypresses */ + switch( key->code ) + { + /* Destroy the window on either right softkey or hangup keypresses */ case KCD_HUP: case KCD_RIGHT: { SEND_EVENT(win, SAT_DESTROY_WINDOW, 0, 0); break; } - } - - return MFW_EVENT_CONSUMED; + } + + return MFW_EVENT_CONSUMED; } @@ -2281,14 +2271,14 @@ if (win EQ NULL) return; - /* - * Who has initiated the information screen - */ + /* + * Who has initiated the information screen + */ switch (identifier) { //x0035544 added fix done by x0021334 for CQ-33597 21-11-2005 case SAT_SEND_DTMF: // x0021334 : To test SAT session end - CQ33597 - { + { // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 #ifdef FF_MMI_SAT_ICON if (info_data->editor_data.editor_attr.TitleIcon.data != NULL) @@ -2302,7 +2292,7 @@ switch(reason) { case INFO_KCD_RIGHT: - case INFO_KCD_HUP: + case INFO_KCD_HUP: // Call mfw function to end the session Mfw_SAT_DTMF_EndSession(); #ifdef NEW_EDITOR @@ -2362,8 +2352,7 @@ *******************************************************************************/ void sat_set_setup_menu_win(T_MFW_HND win) { - TRACE_FUNCTION("sat_set_setup_menu_win"); - + TRACE_FUNCTION("sat_set_setup_menu_win"); g_sim_toolkit_data->sat_setup_menu_win = win; } @@ -2381,7 +2370,7 @@ *******************************************************************************/ T_MFW_HND sat_get_setup_menu_win(void) { - TRACE_EVENT("sat_get_setup_menu_win"); + TRACE_EVENT("sat_get_setup_menu_win"); return g_sim_toolkit_data->sat_setup_menu_win; } @@ -2399,8 +2388,7 @@ *******************************************************************************/ void sat_set_setup_menu_listmnu_win(T_MFW_HND win) { - TRACE_FUNCTION("sat_set_setup_menu_listmnu_win"); - + TRACE_FUNCTION("sat_set_setup_menu_listmnu_win"); g_sim_toolkit_data->sat_setup_menu_listmnu_win= win; } @@ -2418,7 +2406,7 @@ *******************************************************************************/ T_MFW_HND sat_get_setup_menu_listmnu_win(void) { - TRACE_EVENT("sat_get_setup_menu_listmnu_win"); + TRACE_EVENT("sat_get_setup_menu_listmnu_win"); return g_sim_toolkit_data->sat_setup_menu_listmnu_win; } @@ -2436,7 +2424,7 @@ *******************************************************************************/ void sat_set_call_setup_win(T_MFW_HND win) { - TRACE_FUNCTION("sat_set_call_setup_win"); + TRACE_FUNCTION("sat_set_call_setup_win"); g_sim_toolkit_data->sat_call_setup_win = win; } @@ -2455,7 +2443,7 @@ /* Marcus: Issue 1057: 21/01/2003: Made public */ T_MFW_HND sat_get_call_setup_win(void) { - TRACE_FUNCTION("sat_get_call_setup_win"); + TRACE_FUNCTION("sat_get_call_setup_win"); return g_sim_toolkit_data->sat_call_setup_win; } @@ -2508,7 +2496,7 @@ void sat_ascii_to_gsm (char * gsm_string, char * ascii_string, U16 length) { U16 i; - TRACE_FUNCTION("sat_ascii_to_gsm"); + TRACE_FUNCTION("sat_ascii_to_gsm"); for (i = 0; i < length; i++) gsm_string[i] = g_ascii_gsm_table[ascii_string[i]]; @@ -2528,7 +2516,7 @@ void sat_ascii_to_ucode (wchar_t * UCS2_chars, char * ascii_string, U16 length) { U16 i; - TRACE_FUNCTION("sat_ascii_to_ucode"); + TRACE_FUNCTION("sat_ascii_to_ucode"); for (i = 0; i < length; i++) UCS2_chars[i] = (wchar_t)(int)(ascii_string[i]);/*a0393213 extra casting done to avoid lint warning*/ } @@ -2547,7 +2535,7 @@ void sat_ucode_to_ascii (char * ascii_string, wchar_t * UCS2_chars, U16 length) { U16 i; - TRACE_FUNCTION("sat_ucode_to_asci"); + TRACE_FUNCTION("sat_ucode_to_asci"); for (i = 0; i < length; i++) ascii_string[i] = (char)UCS2_chars[i]; @@ -2664,8 +2652,8 @@ $Returns: length of decoded string $Arguments: encoded - GSM string pointer - plain - Buffer to hold the decoded ASCII string - Length - Length of the encoded GSM string + plain - Buffer to hold the decoded ASCII string + Length - Length of the encoded GSM string *******************************************************************************/ @@ -2710,7 +2698,7 @@ $Arguments: - MC, Note: text returned by this function has no Unicode tag at beginning + MC, Note: text returned by this function has no Unicode tag at beginning $Returns: none. $Arguments: @@ -2719,13 +2707,11 @@ /*MC, SPR 940/2 uncommented function back in, and then rewrote it :)*/ void sat_TEXT_to_UCODE (char* destination, int size, T_SAT_TXT * txt) { - UBYTE * temp_buffer; char debug[50]; - - TRACE_EVENT("sat_TEXT_to_UCODE()"); + TRACE_EVENT("sat_TEXT_to_UCODE()"); switch (txt->code) /*DCS of Text*/ { @@ -2735,31 +2721,30 @@ utl_cvt7To8 ((UBYTE *)txt + txt->text, txt->len, temp_buffer, 0); /*MC, convert from 8 bit to UCS2*/ - /*SPR2175, use new function for conversion*/ - ATB_convert_String((char*)temp_buffer, MFW_DCS_8bits, (((txt->len*8)/7)+1), (char*)destination, MFW_DCS_UCS2, /*txt->len*2*/size, FALSE); + /*SPR2175, use new function for conversion*/ + ATB_convert_String((char*)temp_buffer, MFW_DCS_8bits, (((txt->len*8)/7)+1), (char*)destination, MFW_DCS_UCS2, /*txt->len*2*/size, FALSE); FREE_MEMORY ((U8 *)temp_buffer, ((txt->len*8)/7)+1); break; case MFW_DCS_8bits:/*DCS tends to come out as 8 bit whatever it is*/ - if (*((UBYTE*)txt+txt->text) !=0x80)/*MC, if ASCII, convert to Unicode*/ - { + if (*((UBYTE*)txt+txt->text) !=0x80)/*MC, if ASCII, convert to Unicode*/ + { #ifdef SAT_TEXT_TRACING - //string_GSM_to_UCS2((UBYTE)txt->len, (UBYTE *)txt + txt->text, (USHORT)(txt->len), destination); - sprintf(debug, "Length of MENU HEADER:%d", txt->len); - TRACE_EVENT(debug); + //string_GSM_to_UCS2((UBYTE)txt->len, (UBYTE *)txt + txt->text, (USHORT)(txt->len), destination); + sprintf(debug, "Length of MENU HEADER:%d", txt->len); + TRACE_EVENT(debug); #endif - /*MC, convert from 8 bit to UCS2*/ - /*SPR2175, use new function for conversion*/ - ATB_convert_String((char *)txt +txt->text, MFW_DCS_8bits, txt->len, (char*)destination, MFW_DCS_UCS2, /*txt->len*2*/size, FALSE); - } - else - { - /*MC, unicode string, convert to our display format*/ - destination[0] = (char)0x80;/*SPR 1728, add unicode tag*/ - destination[1] = (char)0x7f; - - memcpy(&destination[2], (UBYTE*)txt+txt->text+1, txt->len-1); - - } + /*MC, convert from 8 bit to UCS2*/ + /*SPR2175, use new function for conversion*/ + ATB_convert_String((char *)txt +txt->text, MFW_DCS_8bits, txt->len, (char*)destination, MFW_DCS_UCS2, /*txt->len*2*/size, FALSE); + } + else + { + /*MC, unicode string, convert to our display format*/ + destination[0] = (char)0x80;/*SPR 1728, add unicode tag*/ + destination[1] = (char)0x7f; + + memcpy(&destination[2], (UBYTE*)txt+txt->text+1, txt->len-1); + } break; case MFW_DCS_UCS2:/*MC, unicode string, convert to our display format*/ { destination[0] = (char)0x80;/*SPR 1728, add unicode tag*/ @@ -2767,13 +2752,13 @@ //memcpy(&destination[2], (UBYTE*)txt+txt->text+1, txt->len-1); memcpy(&destination[2], (UBYTE*)txt+txt->text, txt->len); /* SPR#2340 - DS - Corrected len */ - - } - + } break; + default: TRACE_EVENT("sat_TEXT_to_UCODE() unexp. DCS"); } + /*MC, SPR 1086 Commented out traces here, as long buffers cause a crash*/ {int i; @@ -2794,7 +2779,7 @@ $Function: sat_create_TEXT_ASCIIZ $Description: This routine creates out of an MFW SAT text descriptor an - dynamically allocated ASCIIZ string pointer + dynamically allocated ASCIIZ string pointer $Returns: none. @@ -2806,10 +2791,9 @@ char * sat_create_TEXT_ASCIIZ (T_SAT_TXT * txt) { - char * res; U16 size; - UBYTE first_char= *((UBYTE*)txt+txt->text);/*SPR 1728*/ + UBYTE first_char= *((UBYTE*)txt+txt->text);/*SPR 1728*/ TRACE_EVENT("sat_create_TEXT_ASCIIZ ()"); #ifdef NO_ASCIIZ TRACE_EVENT_P3("DCS:%d first_char:%d len: %d", txt->code, first_char, txt->len); @@ -2844,7 +2828,6 @@ /* convert the string */ sat_TEXT_to_ASCIIZ (res, txt); - return res; } @@ -2853,7 +2836,7 @@ $Function: sat_create_TEXT_UCODE $Description: This routine creates out of an MFW SAT text descriptor an - dynamically allocated UCS2 string pointer + dynamically allocated UCS2 string pointer $Returns: none. @@ -2891,9 +2874,9 @@ $Function: sat_create_ITEM_ASCIIZ $Description: This routine converts a MFW SAT Item descriptor into a - conventional String pointer - MC, note: this function will add a Unicode tag to the beginning of Unicode - strings returned + conventional String pointer + MC, note: this function will add a Unicode tag to the beginning of Unicode + strings returned $Returns: none. @@ -2977,7 +2960,6 @@ } #endif - return res; } @@ -2986,7 +2968,7 @@ $Function: sat_destroy_TEXT_ASCIIZ $Description: destroy an ASCIIZ string previously created with - sat_create_TEXT_ASCIIZ() or sat_create_ITEM_ASCIIZ() + sat_create_TEXT_ASCIIZ() or sat_create_ITEM_ASCIIZ() $Returns: none. @@ -2996,19 +2978,20 @@ void sat_destroy_TEXT_ASCIIZ (char * str) { /*MC, SPR 940/2 if we're in chinese, use Unicode string destuctor*/ - if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) - { sat_destroy_TEXT_UCODE(str); - return; - } - - TRACE_FUNCTION("sat_destroy_TEXT_ASCIIZ"); + if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) + { + sat_destroy_TEXT_UCODE(str); + return; + } + + TRACE_FUNCTION("sat_destroy_TEXT_ASCIIZ"); if (str NEQ NULL) - { - /* the two bytes before the string are holding the alloc size info */ - FREE_MEMORY ((U8 *)(str-SAT_LEN_SIZE), *(U16 *) (str-SAT_LEN_SIZE)); - str = NULL; - } + { + /* the two bytes before the string are holding the alloc size info */ + FREE_MEMORY ((U8 *)(str-SAT_LEN_SIZE), *(U16 *) (str-SAT_LEN_SIZE)); + str = NULL; + } } #ifdef MMI_TEST_SAT_LAUNCH_BROWSER @@ -3054,7 +3037,7 @@ editor_data.editor_attr.font = 0; editor_data.editor_attr.mode = edtCurNone; editor_data.editor_attr.controls = 0; - editor_data.editor_attr.size = INFORMATION_SIZE; + editor_data.editor_attr.size = INFORMATION_SIZE; editor_data.editor_attr.text = information; @@ -3085,7 +3068,7 @@ *******************************************************************************/ void sat_release_the_editor (void) { - TRACE_FUNCTION("sat_release_the_editor()"); + TRACE_FUNCTION("sat_release_the_editor()"); if (g_sim_toolkit_data->info_win NEQ NULL) { @@ -3104,18 +3087,18 @@ void sat_destroy_TEXT_UCODE (/*cp_wstring_t*/char* str) { if (str NEQ NULL) - { - FREE_MEMORY ((U8 *)((char *)str-SAT_LEN_SIZE), *(U16 *) ((char *)str-SAT_LEN_SIZE)); - str = NULL; - } + { + FREE_MEMORY ((U8 *)((char *)str-SAT_LEN_SIZE), *(U16 *) ((char *)str-SAT_LEN_SIZE)); + str = NULL; + } } /******************************************************************************* $Function: sat_add_unicode_tag_if_needed $Description: Checks if string ought to be pre-pended with a unicode tag and if it ought to, - adds the tag (note, the string has to already have 2 "extra" chars allocated - to it; this normally happens in the create_TEXT_UCODE function) + adds the tag (note, the string has to already have 2 "extra" chars allocated + to it; this normally happens in the create_TEXT_UCODE function) $Returns: none. @@ -3125,26 +3108,25 @@ /*SPR1257, new function*/ void sat_add_unicode_tag_if_needed(char* string) {/*Add tag to Unicode strings so info dialogue displays them correctly*/ - if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE&& string[0]!= (char)0x80 ) - { - char TempString[MAX_MSG_LEN_SGL];/*MC, SPR 1292, more sensible length*/ + if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE&& string[0]!= (char)0x80 ) + { + char TempString[MAX_MSG_LEN_SGL];/*MC, SPR 1292, more sensible length*/ #ifdef NEW_EDITOR /* SPR#1428 - SH - New Editor changes - new function to calculate length of unicode string */ - memcpy(&TempString[2], GET_TEXT(TxtSoftCall), ATB_string_UCLength((USHORT*)string)*sizeof(USHORT)); + memcpy(&TempString[2], GET_TEXT(TxtSoftCall), ATB_string_UCLength((USHORT*)string)*sizeof(USHORT)); #else /* NEW_EDITOR */ - memcpy(&TempString[2], string, strlenUnicode((U16*) string)); + memcpy(&TempString[2], string, strlenUnicode((U16*) string)); #endif /* NEW_EDITOR */ - TempString[0] = (char)0x80; - TempString[1] = (char)0x7f; + TempString[0] = (char)0x80; + TempString[1] = (char)0x7f; #ifdef NEW_EDITOR /* SPR#1428 - SH - New Editor changes - new function to calculate length of unicode string */ - memcpy(string, TempString, (ATB_string_UCLength((USHORT*)TempString)+1)*sizeof(USHORT)); + memcpy(string, TempString, (ATB_string_UCLength((USHORT*)TempString)+1)*sizeof(USHORT)); #else /* NEW_EDITOR */ - memcpy( string, TempString, strlenUnicode((U16*)TempString)); + memcpy( string, TempString, strlenUnicode((U16*)TempString)); #endif /* NEW_EDITOR */ - } + } } /* Nov 17, 2006 REF:DR:OMAPS00104580 x0039928 -Deleted Redial flag enabling/disabling code*/ -