FreeCalypso > hg > fc-tourmaline
changeset 170:6125210a379b
mmiSmsBroadcast.c: formatting fixes and dead code elimination
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 18 Jan 2021 01:27:49 +0000 |
parents | adae850f9857 |
children | 4ef7466a72c9 |
files | src/ui/bmi/mmiSmsBroadcast.c |
diffstat | 1 files changed, 843 insertions(+), 1111 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ui/bmi/mmiSmsBroadcast.c Sun Jan 17 23:43:19 2021 +0000 +++ b/src/ui/bmi/mmiSmsBroadcast.c Mon Jan 18 01:27:49 2021 +0000 @@ -1,7 +1,6 @@ - /******************************************************************************* - CONDAT (UK) + CONDAT (UK) ******************************************************************************** @@ -12,12 +11,12 @@ $Project name: Basic MMI $Project code: BMI (6349) - $Module: SMS Cell Broadcast - $File: MmiSmsBroadcast.c - $Revision: 1.0 - - $Author: Condat(UK) - $Date: 22/02/01 + $Module: SMS Cell Broadcast + $File: MmiSmsBroadcast.c + $Revision: 1.0 + + $Author: Condat(UK) + $Date: 22/02/01 ******************************************************************************** @@ -147,7 +146,6 @@ #include "MmiSettings.h" - #define MENU_TEXT_LENGTH 16 /* count of chars to be displayed in one list entry */ /* SH - moved to .h file */ @@ -156,42 +154,37 @@ typedef struct { uint8 name[CB_TAG_LENGTH]; - } T_SMSCB_TOPIC_TAG; /* storage for Cell Broadcast lists */ typedef struct { - T_SMSCB_ATT cb_attributes[MAX_MIDS]; /* list of attributes of messages stored in fifo */ - /*SPR 1920, replaced cb_buffer with an array of dynically allocated strings */ - char* messages[MAX_STORED_PAGES]; - ListMenuData *cb_list_attributes; //atttributes for the menu list - - T_SMSCB_STATUS current_status; /*read status for all messages */ - - UBYTE found_mid; //indicate the already existing cb in the fifo - UBYTE clear_mid; //indicate the deleting process - UBYTE result_used; //to update the used-pointer, after deleting the cb message - UBYTE total_number; //this include the total number of messages in the fifo; need for Menu-list - - UBYTE multipage_number; //this include the total page of a particular multipage; need for showing msg. - UBYTE *multipage; //pointer to the first page of multipage - UBYTE start_used; //indicate the start point of the multipage, used for the searching - UBYTE end_used; //indicate the end point of the multipage, used for the searching - - UBYTE used_pointer; //start point of the free space link list - UBYTE free_pointer; //start point of the data link list - - + T_SMSCB_ATT cb_attributes[MAX_MIDS]; /* list of attributes of messages stored in fifo */ + /*SPR 1920, replaced cb_buffer with an array of dynically allocated strings */ + char* messages[MAX_STORED_PAGES]; + ListMenuData *cb_list_attributes; //atttributes for the menu list + + T_SMSCB_STATUS current_status; /*read status for all messages */ + + UBYTE found_mid; //indicate the already existing cb in the fifo + UBYTE clear_mid; //indicate the deleting process + UBYTE result_used; //to update the used-pointer, after deleting the cb message + UBYTE total_number; //this include the total number of messages in the fifo; need for Menu-list + + UBYTE multipage_number; //this include the total page of a particular multipage; need for showing msg. + UBYTE *multipage; //pointer to the first page of multipage + UBYTE start_used; //indicate the start point of the multipage, used for the searching + UBYTE end_used; //indicate the end point of the multipage, used for the searching + + UBYTE used_pointer; //start point of the free space link list + UBYTE free_pointer; //start point of the data link list } T_SMSCB_DATA; - T_SMSCB_DATASTORE g_smscb_data; /* storage for Cell Broadcast Info lists */ T_SMSCB_DATA smscb_data; /* storage for Cell Broadcast Message lists */ - //Attributes of the list menu static const MfwMnuAttr sms_cb_menuAttrib = { @@ -202,7 +195,6 @@ NULL, /* with these items */ 0, /* number of items */ COLOUR_LIST_SMS, TxtNull, NULL, MNUATTRSPARE - }; @@ -224,7 +216,7 @@ UBYTE sms_cb_update_free_pointer (UBYTE temp); UBYTE sms_cb_search_mid (USHORT mid, SHORT sn); UBYTE sms_cb_store_message (T_MFW_SMS_CB *Message); - UBYTE sms_cb_find_endpoint (USHORT mid, UBYTE end_used); +UBYTE sms_cb_find_endpoint (USHORT mid, UBYTE end_used); UBYTE sms_cb_find_startpoint (USHORT mid, UBYTE end_used); UBYTE sms_cb_give_position_of_msg (UBYTE used, UBYTE positon); UBYTE sms_cb_overwrite_old_message (T_MFW_SMS_CB *Message); @@ -288,7 +280,6 @@ } smscb_ID; - void msgsExtractPhoneNumber(UBYTE *InputString, UBYTE *Buffer); /* forward declaration of local start routines */ /*SPR 1920 removed header for smscb_M_CB_ACT_start()*/ @@ -306,13 +297,12 @@ void info_screen (T_MFW_HND win, USHORT TextId, USHORT TextId2, T_VOID_FUNC Callback) /* present info <TextId> for 3 seconds in a simple infoscreen */ { - T_DISPLAY_DATA display_info; TRACE_FUNCTION ("info_screen()"); - dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TextId, TextId2 , COLOUR_STATUS); - dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)Callback, THREE_SECS, 0 ); + dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TextId, TextId2 , COLOUR_STATUS); + dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)Callback, THREE_SECS, 0 ); display_info.Identifier = 0; info_dialog (win, &display_info); @@ -329,42 +319,11 @@ /*SPR 1920, removed function temp_smscb_M_CB_ExeRead()*/ /* SH moved prototype to header file */ -#if(0) /* x0039928 - Lint warning removal */ -static void listCreate(MfwHnd Parent, MfwMnuAttr *a , MfwEvt e, ListCbFunc cbFunc) -{ - - ListMenuData list_menu_data; - - /* initialization of the dialog data */ - list_menu_data.Attr = a; - list_menu_data.List = a->items; - list_menu_data.ListLength = a->nItems;/* Number of entries in list menu. */ - list_menu_data.ListPosition = 1;/* True cursor position in list menu. */ - list_menu_data.CursorPosition = 1;/* Cursor position in list snapshot. */ - list_menu_data.SnapshotSize = 4;/* Number of list entries to view. */ - list_menu_data.Font = 0; - list_menu_data.LeftSoftKey = TxtSoftSelect; - list_menu_data.RightSoftKey = TxtSoftBack; - /* SPR1428 - SH - Accept menu select key */ - list_menu_data.KeyEvents = KEY_CLEAR | KEY_RIGHT | KEY_LEFT | KEY_MNUUP | KEY_MNUDOWN | KEY_MNUSELECT; - list_menu_data.Reason = 0; - list_menu_data.Strings = FALSE; - list_menu_data.autoDestroy = TRUE; - - listDisplayListMenu(Parent, &list_menu_data, cbFunc,0); - -} -#endif -// end c020 rsa -/*SPR1920, removed declarations and functions for menu-handling*/ - - - /********************************************************************* ********************************************************************** - M_CB_ACT DYNAMIC MENU WINDOW. CONTENTS BEHAVIOUR + M_CB_ACT DYNAMIC MENU WINDOW. CONTENTS BEHAVIOUR ********************************************************************* **********************************************************************/ @@ -382,19 +341,18 @@ int smscb_M_CB_ACT_ExeNo(MfwMnu* m, MfwMnuItem* i) { T_MFW_HND win = mfwParent((MfwHdr *)mfw_header()); - /*SPR 1920, removed unneccessary variables*/ - /*GW SPR#2470 Call 'smscb_setCBsettings' so that sAT_PlusCSCB is also called.*/ - - settingsSetStatus(SettingsCBDisable, SET_SETTING );/*Remember settings in FFS*/ - // sms_set_mt_ind(MT_CB_NO_IDX); - smscb_setCBsettings(SMSCB_SWITCH_OFF); + /*SPR 1920, removed unneccessary variables*/ + /*GW SPR#2470 Call 'smscb_setCBsettings' so that sAT_PlusCSCB is also called.*/ + + settingsSetStatus(SettingsCBDisable, SET_SETTING );/*Remember settings in FFS*/ + // sms_set_mt_ind(MT_CB_NO_IDX); + smscb_setCBsettings(SMSCB_SWITCH_OFF); info_screen(win, TxtDeActivated,TxtNull, NULL); - statusCBCH(FALSE); - /* SPR 1920, removed window destruction code*/ + /* SPR 1920, removed window destruction code*/ return MFW_EVENT_CONSUMED; } @@ -436,7 +394,7 @@ $Description: - $Returns: none. + $Returns: none. $Arguments: @@ -444,37 +402,29 @@ int smscb_M_CB_ACT_ExeYes(MfwMnu* m, MfwMnuItem* i) { T_MFW_HND win = mfwParent((MfwHdr *)mfw_header()); - /*SPR 1920, removed unneccessary variables*/ - /*GW SPR#2470 Call 'smscb_setCBsettings' so that sAT_PlusCSCB is also called.*/ - - settingsSetStatus(SettingsCBDisable, CLEAR_SETTING );/*Remember settings in FFS*/ - //sms_set_mt_ind(MT_CB_MSG); - smscb_setCBsettings(SMSCB_SWITCH_ON); + /*SPR 1920, removed unneccessary variables*/ + /*GW SPR#2470 Call 'smscb_setCBsettings' so that sAT_PlusCSCB is also called.*/ + + settingsSetStatus(SettingsCBDisable, CLEAR_SETTING );/*Remember settings in FFS*/ + //sms_set_mt_ind(MT_CB_MSG); + smscb_setCBsettings(SMSCB_SWITCH_ON); info_screen(win, TxtActivated,TxtNull, NULL); - /*SPR1959, removed declarations and functions for menu-handling*/ #ifdef DEBUG_SMS_CB timer = tim_create(NULL, 5000, (MfwCb)test_tim_cb); tim_start(timer); - - - - - #endif //DEBUG_SMS_CB + return MFW_EVENT_CONSUMED; } - - - /********************************************************************* ********************************************************************** - M_CB_TOP DYNAMIC MENU WINDOW. CONTENTS BEHAVIOUR + M_CB_TOP DYNAMIC MENU WINDOW. CONTENTS BEHAVIOUR ********************************************************************* **********************************************************************/ @@ -484,7 +434,7 @@ $Description: - $Returns: none. + $Returns: none. $Arguments: @@ -494,38 +444,38 @@ T_MFW_HND win = mfwParent((MfwHdr *)mfw_header()); /*SPR 1920, removed unneccessary variables*/ - #ifdef DEBUG_SMS_CB UBYTE ii; - for (ii = 0; ii < MAX_MIDS; ii++) - { - /***************************Go-lite Optimization changes Start***********************/ - // Aug 16, 2004 REF: CRR 24323 Deepa M.D - TRACE_EVENT_P2 ("g_smscb_data.CBTopics.entry[0].msg_id:%d, i:%d", g_smscb_data.CBTopics.entry[ii].msg_id,ii); - /***************************Go-lite Optimization changes end***********************/ - } + for (ii = 0; ii < MAX_MIDS; ii++) + { + /***************************Go-lite Optimization changes Start***********************/ + // Aug 16, 2004 REF: CRR 24323 Deepa M.D + TRACE_EVENT_P2 ("g_smscb_data.CBTopics.entry[0].msg_id:%d, i:%d", g_smscb_data.CBTopics.entry[ii].msg_id,ii); + /***************************Go-lite Optimization changes end***********************/ + } #endif - - if (!smsidle_get_ready_state()) - { - info_screen(0, TxtSimNot, TxtReady, NULL); - TRACE_EVENT ("SIM is not ready !!"); - return MFW_EVENT_CONSUMED; /* x0039928 - Lint warning fix */ - } - - if (g_smscb_data.CBTopics.length EQ 0) - { - info_screen(0, TxtEmptyList,TxtNull, NULL); - - TRACE_EVENT ("CellBroadcast Topic-list is empty !!"); - return MFW_EVENT_CONSUMED; /* x0039928 - Lint warning fix */ - } + if (!smsidle_get_ready_state()) + { + info_screen(0, TxtSimNot, TxtReady, NULL); + TRACE_EVENT ("SIM is not ready !!"); + return MFW_EVENT_CONSUMED; /* x0039928 - Lint warning fix */ + } + + if (g_smscb_data.CBTopics.length EQ 0) + { + info_screen(0, TxtEmptyList,TxtNull, NULL); + + TRACE_EVENT ("CellBroadcast Topic-list is empty !!"); + return MFW_EVENT_CONSUMED; /* x0039928 - Lint warning fix */ + } // selection "Consult": menucreate M_CB_TOP_CONS return (int)smscb_M_CB_TOP_CONS_start (win, NULL); } + T_CB_index_param CB_index_param;/*MC SPR1920 added global variable*/ + /******************************************************************************* $Function: smscb_M_CB_TOP_ExeAddNew @@ -547,25 +497,23 @@ index = g_smscb_data.CBTopics.length;/* get the index of the next free entry in list CBTopics */ if (index > MAX_MIDS) - { - /* all entries are already used */ - info_screen (win, TxtFull /* ??? */,TxtNull, NULL); - return MFW_EVENT_CONSUMED; - } + { + /* all entries are already used */ + info_screen (win, TxtFull /* ??? */,TxtNull, NULL); + return MFW_EVENT_CONSUMED; + } else - { - - - CB_index_param.index = index; - return (int)smscb_CB_EDT_TEXTEDT_start(win, &CB_index_param); - } + { + CB_index_param.index = index; + return (int)smscb_CB_EDT_TEXTEDT_start(win, &CB_index_param); + } } /********************************************************************* ********************************************************************** - M_CB_TOP_CONS DYNAMIC MENU WINDOW. DECLARATION + M_CB_TOP_CONS DYNAMIC MENU WINDOW. DECLARATION ********************************************************************* **********************************************************************/ @@ -604,14 +552,13 @@ NULL, /* with these items */ 0, /* number of items */ - COLOUR_LIST_SMS, TxtNull, NULL, MNUATTRSPARE - + COLOUR_LIST_SMS, TxtNull, NULL, MNUATTRSPARE }; /********************************************************************* ********************************************************************** - M_CB_TOP_CONS DYNAMIC MENU WINDOW. IMPLEMENTATION + M_CB_TOP_CONS DYNAMIC MENU WINDOW. IMPLEMENTATION ********************************************************************* **********************************************************************/ @@ -636,9 +583,9 @@ win = smscb_M_CB_TOP_CONS_create (parent_window); if (win NEQ NULL) - { - SEND_EVENT (win, E_INIT, smscb_M_CB_TOP_CONS_ID, NULL); - } + { + SEND_EVENT (win, E_INIT, smscb_M_CB_TOP_CONS_ID, NULL); + } return win; } @@ -668,9 +615,9 @@ data->win = win_create (parent_window, 0, 0, NULL); if (data->win EQ NULL) - { - return NULL; - } + { + return NULL; + } /* * connect the dialog data to the MFW-window @@ -698,28 +645,28 @@ TRACE_FUNCTION ("smscb_M_CB_TOP_CONS_destroy()"); if (own_window) + { + win_data = ((T_MFW_HDR *)own_window)->data; + data = (T_M_CB_TOP_CONS *)win_data->user; + + if (data) { - win_data = ((T_MFW_HDR *)own_window)->data; - data = (T_M_CB_TOP_CONS *)win_data->user; - - if (data) - { - /* - * Delete WIN handler - */ - win_delete (data->win); - - /* - * Free Memory - */ - FREE_MEMORY ((void *)data->list_menu_data.List, MAX_MIDS * sizeof (MfwMnuItem)); // c017 rsa - FREE_MEMORY ((void *)data, sizeof (T_M_CB_TOP_CONS)); - } - else - { - TRACE_EVENT ("smscb_M_CB_TOP_CONS_destroy() called twice"); - } + /* + * Delete WIN handler + */ + win_delete (data->win); + + /* + * Free Memory + */ + FREE_MEMORY ((void *)data->list_menu_data.List, MAX_MIDS * sizeof (MfwMnuItem)); // c017 rsa + FREE_MEMORY ((void *)data, sizeof (T_M_CB_TOP_CONS)); } + else + { + TRACE_EVENT ("smscb_M_CB_TOP_CONS_destroy() called twice"); + } + } } /******************************************************************************* @@ -740,15 +687,15 @@ #ifdef DEBUG_SMS_CB UBYTE ii; - TRACE_EVENT ("before create a list !"); - for (ii = 0; ii < MAX_MIDS; ii++) - { - TRACE_EVENT_P2 (" 01 midlist:%d, i:%d", g_smscb_data.CBTopics.entry[ii].msg_id,ii); - } - /***************************Go-lite Optimization changes Start***********************/ - // Aug 16, 2004 REF: CRR 24323 Deepa M.D + TRACE_EVENT ("before create a list !"); + for (ii = 0; ii < MAX_MIDS; ii++) + { TRACE_EVENT_P2 (" 01 midlist:%d, i:%d", g_smscb_data.CBTopics.entry[ii].msg_id,ii); - /***************************Go-lite Optimization changes end***********************/ + } + /***************************Go-lite Optimization changes Start***********************/ + // Aug 16, 2004 REF: CRR 24323 Deepa M.D + TRACE_EVENT_P2 (" 01 midlist:%d, i:%d", g_smscb_data.CBTopics.entry[ii].msg_id,ii); + /***************************Go-lite Optimization changes end***********************/ #endif //on RECREATE|INIT: menucreate dynamiclist (List=CBTopics, SoftLeft=SELECT, SoftRight=BACK) /* show: 1. Name 2. MID */ @@ -759,21 +706,18 @@ // end c017 rsa for (i=0; i < g_smscb_data.CBTopics.length; i++) /* Fill Menu List */ - { - mnuInitDataItem(&data->list_menu_data.List[i]); - - - /* get the correct entry in list of CBTopics */ - data->list_menu_data.List[i].str = g_smscb_data.CBTopics.entry[i].name; - data->list_menu_data.List[i].flagFunc = item_flag_none; - - - } - - //actual number of entries in list menu - data->list_menu_data.ListLength = g_smscb_data.CBTopics.length; - - data->list_menu_data.autoDestroy = TRUE; + { + mnuInitDataItem(&data->list_menu_data.List[i]); + + /* get the correct entry in list of CBTopics */ + data->list_menu_data.List[i].str = g_smscb_data.CBTopics.entry[i].name; + data->list_menu_data.List[i].flagFunc = item_flag_none; + } + + //actual number of entries in list menu + data->list_menu_data.ListLength = g_smscb_data.CBTopics.length; + + data->list_menu_data.autoDestroy = TRUE; listDisplayListMenu(data->win, &data->list_menu_data, (ListCbFunc)smscb_M_CB_TOP_CONS_listmnu_cb,0); } @@ -792,7 +736,6 @@ void smscb_M_CB_TOP_CONS_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * dummy) /* callback handler for events sent to to trigger execution */ { - T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; T_M_CB_TOP_CONS * data = (T_M_CB_TOP_CONS *)win_data->user; T_MFW_HND * l_parent; @@ -818,33 +761,32 @@ data->list_menu_data.Reason = 0; data->list_menu_data.Strings = TRUE; // c020 rsa data->list_menu_data.Attr = (MfwMnuAttr*)&smscb_M_CB_TOP_CONSAttrib; - data->list_menu_data.autoDestroy = TRUE; + data->list_menu_data.autoDestroy = TRUE; /* NOBREAK */ case E_RETURN: case E_EXIT: /* terminate EXIT from CB_EDT_MIDEDT|M_CB_TOP_CONS_SEL here */ /* (re)create the dialog handler */ - TRACE_FUNCTION ("EXIT in M_CB_TOP_CONS_exec_cb"); - - //the special case : if the user deleted the last CB item - //check if there is any more CB in the list when not - //give a infoscreen and go back to the CB menu - if (g_smscb_data.CBTopics.length EQ 0) - { - info_screen(0, TxtEmptyList,TxtNull, NULL); - l_parent = data->parent; - l_id = data->id; - smscb_M_CB_TOP_CONS_destroy(data->win); - SEND_EVENT (l_parent, event, l_id, NULL); /* forward event to parent */ - - } - else - { - smscb_M_CB_TOP_CONS_recreate(data); - - /* put the (new) dialog window on top of the window stack */ - /* winUpdate(data->win); c021 rsa */ - } + TRACE_FUNCTION ("EXIT in M_CB_TOP_CONS_exec_cb"); + + //the special case : if the user deleted the last CB item + //check if there is any more CB in the list when not + //give a infoscreen and go back to the CB menu + if (g_smscb_data.CBTopics.length EQ 0) + { + info_screen(0, TxtEmptyList,TxtNull, NULL); + l_parent = data->parent; + l_id = data->id; + smscb_M_CB_TOP_CONS_destroy(data->win); + SEND_EVENT (l_parent, event, l_id, NULL); /* forward event to parent */ + } + else + { + smscb_M_CB_TOP_CONS_recreate(data); + + /* put the (new) dialog window on top of the window stack */ + /* winUpdate(data->win); c021 rsa */ + } break; case E_ABORT: /* defaultreaction */ TRACE_EVENT ("ABORT in M_CB_TOP_CONS_exec_cb"); @@ -885,9 +827,7 @@ //on SELECT: menucreate M_CB_TOP_CONS_SEL(Index=selection) index = ListData->ListPosition; data->CB_index_param.index = index; - - smscb_M_CB_TOP_CONS_SEL_ExeDelete(win); - + smscb_M_CB_TOP_CONS_SEL_ExeDelete(win); break; case LISTS_REASON_BACK: /* back to previous menu */ smscb_M_CB_TOP_CONS_destroy(data->win); @@ -905,7 +845,7 @@ /********************************************************************* ********************************************************************** - M_CB_TOP_CONS_SEL DYNAMIC MENU WINDOW. CONTENTS BEHAVIOUR + M_CB_TOP_CONS_SEL DYNAMIC MENU WINDOW. CONTENTS BEHAVIOUR ********************************************************************* **********************************************************************/ @@ -939,13 +879,11 @@ //show infoscreen ("Deleted"); info_screen(win, TxtDeleted, TxtNull, (T_VOID_FUNC) ExeDelete_infoscreen_cb); - - //save the updated Topic list on the SIM - smscb_setCBsettings(SMSCB_SWITCH_ON); + //save the updated Topic list on the SIM + smscb_setCBsettings(SMSCB_SWITCH_ON); //selfdestroy; sendevent EXIT - return MFW_EVENT_CONSUMED; } @@ -957,15 +895,14 @@ l_id = data->id; - //nm go back and recreate the CB list - SEND_EVENT (win, E_EXIT, l_id, NULL); - + //nm go back and recreate the CB list + SEND_EVENT (win, E_EXIT, l_id, NULL); } /********************************************************************* ********************************************************************** - CB_EDT_TEXTEDT DYNAMIC MENU WINDOW. DECLARATION + CB_EDT_TEXTEDT DYNAMIC MENU WINDOW. DECLARATION ********************************************************************* **********************************************************************/ @@ -986,7 +923,7 @@ /* internal data */ T_CB_index_param * param; /* pointer to parameter space in parent (index in list) */ #ifdef NEW_EDITOR - T_AUI_EDITOR_DATA editor_info; /* SPR#1428 - SH - New Editor data */ + T_AUI_EDITOR_DATA editor_info; /* SPR#1428 - SH - New Editor data */ #else T_EDITOR_DATA editor_info; /* storage for editor attributes */ #endif @@ -1001,7 +938,7 @@ /********************************************************************* ********************************************************************** - CB_EDT_TEXTEDT DYNAMIC MENU WINDOW. IMPLEMENTATION + CB_EDT_TEXTEDT DYNAMIC MENU WINDOW. IMPLEMENTATION ********************************************************************* **********************************************************************/ @@ -1015,9 +952,9 @@ win = smscb_CB_EDT_TEXTEDT_create (parent_window); if (win NEQ NULL) - { - SEND_EVENT (win, E_INIT, smscb_CB_EDT_TEXTEDT_ID, (void *)parameter); - } + { + SEND_EVENT (win, E_INIT, smscb_CB_EDT_TEXTEDT_ID, (void *)parameter); + } return win; } @@ -1047,9 +984,9 @@ data->win = win_create (parent_window, 0, 0, NULL); if (data->win EQ NULL) - { - return NULL; - } + { + return NULL; + } /* * connect the dialog data to the MFW-window @@ -1089,27 +1026,27 @@ TRACE_FUNCTION ("smscb_CB_EDT_TEXTEDT_destroy()"); if (own_window) + { + win_data = ((T_MFW_HDR *)own_window)->data; + data = (T_CB_EDT_TEXTEDT *)win_data->user; + + if (data) { - win_data = ((T_MFW_HDR *)own_window)->data; - data = (T_CB_EDT_TEXTEDT *)win_data->user; - - if (data) - { - /* - * Delete WIN handler - */ - win_delete (data->win); - - /* - * Free Memory - */ - FREE_MEMORY ((void *)data, sizeof (T_CB_EDT_TEXTEDT)); - } - else - { - TRACE_EVENT ("smscb_CB_EDT_TEXTEDT_destroy() called twice"); - } + /* + * Delete WIN handler + */ + win_delete (data->win); + + /* + * Free Memory + */ + FREE_MEMORY ((void *)data, sizeof (T_CB_EDT_TEXTEDT)); } + else + { + TRACE_EVENT ("smscb_CB_EDT_TEXTEDT_destroy() called twice"); + } + } } /******************************************************************************* @@ -1126,12 +1063,9 @@ void smscb_CB_EDT_TEXTEDT_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) /* callback handler for events sent to to trigger execution */ { - - T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; T_CB_EDT_TEXTEDT * data = (T_CB_EDT_TEXTEDT *)win_data->user; - int - index; + int index; TRACE_FUNCTION ("smscb_CB_EDT_TEXTEDT_exec_cb()"); @@ -1144,38 +1078,38 @@ #ifdef DEBUG_SMS_CB - /***************************Go-lite Optimization changes Start***********************/ - // Aug 16, 2004 REF: CRR 24323 Deepa M.D - TRACE_EVENT_P1( "the index is %d", data->param->index); - /***************************Go-lite Optimization changes end***********************/ + /***************************Go-lite Optimization changes Start***********************/ + // Aug 16, 2004 REF: CRR 24323 Deepa M.D + TRACE_EVENT_P1( "the index is %d", data->param->index); + /***************************Go-lite Optimization changes end***********************/ #endif /* initialization of the dialog data */ index = data->param->index; data->CB_EDT_MIDEDT_param.index = index; /* copy the index to parameter space of next menu */ -data->CB_EDT_MIDEDT_param.name[0] = '\0'; /* provide empty entry */ + data->CB_EDT_MIDEDT_param.name[0] = '\0'; /* provide empty entry */ //on INIT: exec "copy params to dynamic memory <data>"; RECREATE /* NOBREAK */ case E_RETURN: //on RETURN: RECREATE // recreate editor if back from options - /* SPR#1428 - SH - New Editor changes */ + /* SPR#1428 - SH - New Editor changes */ #ifdef NEW_EDITOR - AUI_edit_SetDefault(&data->editor_info); - AUI_edit_SetDisplay(&data->editor_info, ZONE_FULL_SK_TITLE, COLOUR_EDITOR_XX, EDITOR_FONT); - AUI_edit_SetEvents(&data->editor_info, value, TRUE, TEN_SECS, (T_AUI_EDIT_CB)smscb_CB_EDT_TEXTEDT_editor_cb); - AUI_edit_SetTextStr(&data->editor_info, TxtSoftOK, TxtDelete, TxtEnterName, NULL); - // Change by Sasken ( Deepa M.d) on March 29th 2004 - // Issue Number : MMI-SPR-12722 - // Subject: Right softkey should be "Back" when the editor is empty - // Bug : Right softkey should be "Back" when the editor is empty - // Solution : Added alternative string for the right softkey tobe displayed when the editor is empty - - AUI_edit_SetAltTextStr(&data->editor_info, 0, NULL, TRUE, TxtSoftBack); - AUI_edit_SetBuffer(&data->editor_info, ATB_DCS_ASCII, (UBYTE *)data->CB_EDT_MIDEDT_param.name, CB_TAG_LENGTH); - AUI_edit_SetMode(&data->editor_info, ED_MODE_ALPHA, ED_CURSOR_BAR); + AUI_edit_SetDefault(&data->editor_info); + AUI_edit_SetDisplay(&data->editor_info, ZONE_FULL_SK_TITLE, COLOUR_EDITOR_XX, EDITOR_FONT); + AUI_edit_SetEvents(&data->editor_info, value, TRUE, TEN_SECS, (T_AUI_EDIT_CB)smscb_CB_EDT_TEXTEDT_editor_cb); + AUI_edit_SetTextStr(&data->editor_info, TxtSoftOK, TxtDelete, TxtEnterName, NULL); + // Change by Sasken ( Deepa M.d) on March 29th 2004 + // Issue Number : MMI-SPR-12722 + // Subject: Right softkey should be "Back" when the editor is empty + // Bug : Right softkey should be "Back" when the editor is empty + // Solution : Added alternative string for the right softkey tobe displayed when the editor is empty + + AUI_edit_SetAltTextStr(&data->editor_info, 0, NULL, TRUE, TxtSoftBack); + AUI_edit_SetBuffer(&data->editor_info, ATB_DCS_ASCII, (UBYTE *)data->CB_EDT_MIDEDT_param.name, CB_TAG_LENGTH); + AUI_edit_SetMode(&data->editor_info, ED_MODE_ALPHA, ED_CURSOR_BAR); data->editor = AUI_edit_Start(data->win,&data->editor_info); /* start the editor */ #else /* NEW_EDITOR */ @@ -1184,7 +1118,7 @@ data->editor_info.editor_attr.win.py = Mmi_layout_line(2); data->editor_info.editor_attr.win.sx =SCREEN_SIZE_X; data->editor_info.editor_attr.win.sy = 2*Mmi_layout_line_height(); - data->editor_info.editor_attr.edtCol = COLOUR_EDITOR_XX; + data->editor_info.editor_attr.edtCol = COLOUR_EDITOR_XX; data->editor_info.editor_attr.font = 0; data->editor_info.editor_attr.mode = edtCurBar1; data->editor_info.editor_attr.controls = 0; @@ -1196,14 +1130,14 @@ data->editor_info.Identifier = value; /* optional */ data->editor_info.mode = ALPHA_MODE; data->editor_info.Callback = (T_EDIT_CB)smscb_CB_EDT_TEXTEDT_editor_cb; - data->editor_info.destroyEditor = TRUE; + data->editor_info.destroyEditor = TRUE; data->editor_info.hide = FALSE; - // Change by Sasken ( Deepa M.d) on March 29th 2004 - // Issue Number : MMI-SPR-12722 - // Subject: Right softkey should be "Back" when the editor is empty - // Bug : Right softkey should be "Back" when the editor is empty - // Solution : Added alternative string for the right softkey tobe displayed when the editor is empty - data->editor_info.AlternateLeftSoftKey = TxtSoftBack; + // Change by Sasken ( Deepa M.d) on March 29th 2004 + // Issue Number : MMI-SPR-12722 + // Subject: Right softkey should be "Back" when the editor is empty + // Bug : Right softkey should be "Back" when the editor is empty + // Solution : Added alternative string for the right softkey tobe displayed when the editor is empty + data->editor_info.AlternateLeftSoftKey = TxtSoftBack; data->editor_info.TextString = NULL; data->editor_info.min_enter = 0; data->editor_info.timeout = TEN_SECS; @@ -1216,7 +1150,7 @@ case E_ABORT: case E_EXIT: /* defaultreaction */ smscb_CB_EDT_TEXTEDT_destroy(data->win); - /*SPR 1920, removed sending of exit event to parent, no longer needed*/ + /*SPR 1920, removed sending of exit event to parent, no longer needed*/ break; default: return; @@ -1265,7 +1199,7 @@ /********************************************************************* ********************************************************************** - CB_EDT_MIDEDT DYNAMIC MENU WINDOW. DECLARATION + CB_EDT_MIDEDT DYNAMIC MENU WINDOW. DECLARATION ********************************************************************* **********************************************************************/ @@ -1286,7 +1220,7 @@ /* internal data */ T_CB_EDT_MIDEDT_param * param; /* pointer to parameter space in parent (buffer for editing) */ #ifdef NEW_EDITOR - T_AUI_EDITOR_DATA editor_info; /* SPR#1428 - SH - New Editor data */ + T_AUI_EDITOR_DATA editor_info; /* SPR#1428 - SH - New Editor data */ #else T_EDITOR_DATA editor_info; /* storage for editor attributes */ #endif @@ -1300,7 +1234,7 @@ /********************************************************************* ********************************************************************** - CB_EDT_MIDEDT DYNAMIC MENU WINDOW. IMPLEMENTATION + CB_EDT_MIDEDT DYNAMIC MENU WINDOW. IMPLEMENTATION ********************************************************************* **********************************************************************/ @@ -1314,9 +1248,9 @@ win = smscb_CB_EDT_MIDEDT_create (parent_window); if (win NEQ NULL) - { - SEND_EVENT (win, E_INIT, smscb_CB_EDT_MIDEDT_ID, (void *)parameter); - } + { + SEND_EVENT (win, E_INIT, smscb_CB_EDT_MIDEDT_ID, (void *)parameter); + } return win; } @@ -1345,9 +1279,9 @@ data->win = win_create (parent_window, 0, 0, NULL); if (data->win EQ NULL) - { - return NULL; - } + { + return NULL; + } /* * connect the dialog data to the MFW-window @@ -1384,31 +1318,30 @@ T_MFW_WIN * win_data; T_CB_EDT_MIDEDT * data; - TRACE_FUNCTION ("smscb_CB_EDT_MIDEDT_destroy()"); if (own_window) + { + win_data = ((T_MFW_HDR *)own_window)->data; + data = (T_CB_EDT_MIDEDT *)win_data->user; + + if (data) { - win_data = ((T_MFW_HDR *)own_window)->data; - data = (T_CB_EDT_MIDEDT *)win_data->user; - - if (data) - { - /* - * Delete WIN handler - */ - win_delete (data->win); - - /* - * Free Memory - */ - FREE_MEMORY ((void *)data, sizeof (T_CB_EDT_MIDEDT)); - } - else - { - TRACE_EVENT ("smscb_CB_EDT_MIDEDT_destroy() called twice"); - } + /* + * Delete WIN handler + */ + win_delete (data->win); + + /* + * Free Memory + */ + FREE_MEMORY ((void *)data, sizeof (T_CB_EDT_MIDEDT)); } + else + { + TRACE_EVENT ("smscb_CB_EDT_MIDEDT_destroy() called twice"); + } + } } @@ -1445,33 +1378,32 @@ /* initialization of the dialog data */ index = data->param->index; if (g_smscb_data.CBTopics.entry[index].msg_id NEQ NO_MID) - { - data->param->number[0] = '\0'; /* provide empty entry */ - - } + { + data->param->number[0] = '\0'; /* provide empty entry */ + } else - { - data->param->number[0] = '\0'; /* provide empty entry */ - } + { + data->param->number[0] = '\0'; /* provide empty entry */ + } //on INIT: call editor (Type=numeric, Length=3, Prompt="Enter MID Number", // Number=data->List.Number[data->ListIndex], SoftLeft=OK, SoftRight=BACK) - /* SPR#1428 - SH - New Editor changes */ + /* SPR#1428 - SH - New Editor changes */ #ifdef NEW_EDITOR - AUI_edit_SetDefault(&data->editor_info); - AUI_edit_SetDisplay(&data->editor_info, ZONE_FULL_SK_TITLE, COLOUR_EDITOR, EDITOR_FONT); - AUI_edit_SetEvents(&data->editor_info, value, TRUE, TEN_SECS, (T_AUI_EDIT_CB)smscb_CB_EDT_MIDEDT_editor_cb); - AUI_edit_SetTextStr(&data->editor_info, TxtSoftOK, TxtDelete, TxtEnterMid, NULL); - AUI_edit_SetAltTextStr(&data->editor_info, 1, TxtNull, TRUE, TxtSoftBack); - AUI_edit_SetBuffer(&data->editor_info, ATB_DCS_ASCII, (UBYTE *)data->param->number, CB_MID_LENGTH); - AUI_edit_SetMode(&data->editor_info, 0, ED_CURSOR_BAR); + AUI_edit_SetDefault(&data->editor_info); + AUI_edit_SetDisplay(&data->editor_info, ZONE_FULL_SK_TITLE, COLOUR_EDITOR, EDITOR_FONT); + AUI_edit_SetEvents(&data->editor_info, value, TRUE, TEN_SECS, (T_AUI_EDIT_CB)smscb_CB_EDT_MIDEDT_editor_cb); + AUI_edit_SetTextStr(&data->editor_info, TxtSoftOK, TxtDelete, TxtEnterMid, NULL); + AUI_edit_SetAltTextStr(&data->editor_info, 1, TxtNull, TRUE, TxtSoftBack); + AUI_edit_SetBuffer(&data->editor_info, ATB_DCS_ASCII, (UBYTE *)data->param->number, CB_MID_LENGTH); + AUI_edit_SetMode(&data->editor_info, 0, ED_CURSOR_BAR); data->editor = AUI_edit_Start(data->win,&data->editor_info); /* start the editor */ #else /* NEW_EDITOR */ - editor_attr_init(&data->editor_info.editor_attr, ZONE_SMALL_EDITOR, edtCurBar1, 0, data->param->number, CB_MID_LENGTH, COLOUR_EDITOR ); + editor_attr_init(&data->editor_info.editor_attr, ZONE_SMALL_EDITOR, edtCurBar1, 0, data->param->number, CB_MID_LENGTH, COLOUR_EDITOR ); editor_data_init(&data->editor_info,(T_EDIT_CB)smscb_CB_EDT_MIDEDT_editor_cb,TxtSoftOK,TxtDelete,TxtEnterMid,1 ,DIGITS_MODE, TEN_SECS); - data->editor_info.destroyEditor = TRUE; - data->editor_info.Identifier = value; + data->editor_info.destroyEditor = TRUE; + data->editor_info.Identifier = value; data->editor_info.hide = FALSE; data->editor_info.TextString = NULL; @@ -1511,12 +1443,12 @@ T_MFW_HND * l_parent; SHORT l_id; int index; - UBYTE ll; + UBYTE ll; T_SMSCB_TOPIC_TAG ffs_tag;/*SPR1920*/ char file_name[20]; int val; #ifdef DEBUG_SMS_CB - UBYTE ii; + UBYTE ii; #endif TRACE_FUNCTION ("smscb_CB_EDT_MIDEDT_editor_cb()"); @@ -1525,92 +1457,87 @@ l_id = data->id; switch(event) - { + { case INFO_KCD_LEFT: index = data->param->index; - //nm "-1"the zero is counted as well + //nm "-1"the zero is counted as well if (index < MAX_MIDS -1 ) + { + /* add a new entry */ + + + memcpy (g_smscb_data.CBTopics.entry[index].name, data->param->name, CB_TAG_LENGTH); + g_smscb_data.CBTopics.entry[index].msg_id = atoi(data->param->number); + /*SPR1959, save name to FFS*/ + memcpy(ffs_tag.name, data->param->name, CB_TAG_LENGTH); { - /* add a new entry */ - - - memcpy (g_smscb_data.CBTopics.entry[index].name, data->param->name, CB_TAG_LENGTH); - g_smscb_data.CBTopics.entry[index].msg_id = atoi(data->param->number); - /*SPR1959, save name to FFS*/ - memcpy(ffs_tag.name, data->param->name, CB_TAG_LENGTH); - { val = ffs_fwrite((const char*)ffs_cb_tag_name(g_smscb_data.CBTopics.entry[index].msg_id, file_name), (void*)&ffs_tag, sizeof(T_SMSCB_TOPIC_TAG)); - - TRACE_EVENT_P1("CB tag name write status:%d", val); - } - -#ifdef DEBUG_SMS_CB - /***************************Go-lite Optimization changes Start***********************/ - // Aug 16, 2004 REF: CRR 24323 Deepa M.D - TRACE_EVENT_P1 ( "the index is %d", index); - /***************************Go-lite Optimization changes end***********************/ -#endif - - /* add a new entry */ - index += 1; - g_smscb_data.CBTopics.length = index; - - smscb_setCBsettings(SMSCB_SWITCH_ON); /* save in SIM */ - - info_screen(win, TxtSaved ,TxtNull, NULL); - + val = ffs_fwrite((const char*)ffs_cb_tag_name(g_smscb_data.CBTopics.entry[index].msg_id, file_name), (void*)&ffs_tag, sizeof(T_SMSCB_TOPIC_TAG)); + TRACE_EVENT_P1("CB tag name write status:%d", val); } - else - { - info_screen (win, TxtFull, TxtNull, NULL); - } - - // Apr 29, 2004 REF: CRR 11630 Deepa M.D - // Refresh the list,so that if a name exists for a channelId in FFS, it is displayed. - for(ll = 0; ll < g_smscb_data.CBTopics.length; ll++) - { - if (g_smscb_data.CBTopics.entry[ll].msg_id EQ NO_MID) - { - break; - } - - /* Set default tag string, until we get the saved name from PCM */ - g_smscb_data.CBTopics.entry[ll].name[0] = '\0'; - /*attempt to read channel name from FFS file*/ - val = ffs_fread(ffs_cb_tag_name(g_smscb_data.CBTopics.entry[ll].msg_id, file_name), &ffs_tag, sizeof(T_SMSCB_TOPIC_TAG)); - /*if reading successful, copy name to data structure*/ - - if (val == sizeof(ffs_tag)) - { - memcpy(g_smscb_data.CBTopics.entry[ll].name, ffs_tag.name, CB_TAG_LENGTH); - } - /* update here g_smscb_data.CBTopics.entry[i].name from PCM */ - if (g_smscb_data.CBTopics.entry[ll].name[0] EQ '\0') - { - /* but if it's empty substitute it by the channel number */ - sprintf (g_smscb_data.CBTopics.entry[ll].name,"Ch%d,ID:%d",ll,g_smscb_data.CBTopics.entry[ll].msg_id); - } - - } - #ifdef DEBUG_SMS_CB /***************************Go-lite Optimization changes Start***********************/ // Aug 16, 2004 REF: CRR 24323 Deepa M.D - TRACE_EVENT ("after add a new one !"); - for (ii = 0; ii < MAX_MIDS; ii++) - { - - TRACE_EVENT_P2 (" 04 midlist:%d, i:%d", g_smscb_data.CBTopics.entry[ii].msg_id,ii); - } - - TRACE_EVENT_P1 ("04 midlist:%d", g_smscb_data.CBTopics.length); - + TRACE_EVENT_P1 ( "the index is %d", index); /***************************Go-lite Optimization changes end***********************/ #endif - - + /* add a new entry */ + index += 1; + g_smscb_data.CBTopics.length = index; + + smscb_setCBsettings(SMSCB_SWITCH_ON); /* save in SIM */ + + info_screen(win, TxtSaved ,TxtNull, NULL); + + } + else + { + info_screen (win, TxtFull, TxtNull, NULL); + } + + // Apr 29, 2004 REF: CRR 11630 Deepa M.D + // Refresh the list,so that if a name exists for a channelId in FFS, it is displayed. + for(ll = 0; ll < g_smscb_data.CBTopics.length; ll++) + { + if (g_smscb_data.CBTopics.entry[ll].msg_id EQ NO_MID) + { + break; + } + + /* Set default tag string, until we get the saved name from PCM */ + g_smscb_data.CBTopics.entry[ll].name[0] = '\0'; + /*attempt to read channel name from FFS file*/ + val = ffs_fread(ffs_cb_tag_name(g_smscb_data.CBTopics.entry[ll].msg_id, file_name), &ffs_tag, sizeof(T_SMSCB_TOPIC_TAG)); + /*if reading successful, copy name to data structure*/ + + if (val == sizeof(ffs_tag)) + { + memcpy(g_smscb_data.CBTopics.entry[ll].name, ffs_tag.name, CB_TAG_LENGTH); + } + /* update here g_smscb_data.CBTopics.entry[i].name from PCM */ + if (g_smscb_data.CBTopics.entry[ll].name[0] EQ '\0') + { + /* but if it's empty substitute it by the channel number */ + sprintf (g_smscb_data.CBTopics.entry[ll].name,"Ch%d,ID:%d",ll,g_smscb_data.CBTopics.entry[ll].msg_id); + } + + } + +#ifdef DEBUG_SMS_CB + /***************************Go-lite Optimization changes Start***********************/ + // Aug 16, 2004 REF: CRR 24323 Deepa M.D + TRACE_EVENT ("after add a new one !"); + for (ii = 0; ii < MAX_MIDS; ii++) + { + TRACE_EVENT_P2 (" 04 midlist:%d, i:%d", g_smscb_data.CBTopics.entry[ii].msg_id,ii); + } + + TRACE_EVENT_P1 ("04 midlist:%d", g_smscb_data.CBTopics.length); + + /***************************Go-lite Optimization changes end***********************/ +#endif smscb_CB_EDT_MIDEDT_destroy(data->win); SEND_EVENT (l_parent, E_EXIT, l_id, NULL); @@ -1622,15 +1549,14 @@ break; default: break; - } + } return; } /********************************************************************* ********************************************************************** - - cell broadcast routines IMPLEMENTATION + cell broadcast routines IMPLEMENTATION ********************************************************************* **********************************************************************/ @@ -1642,7 +1568,7 @@ $Description: Initialises CB message storage - $Returns: none. + $Returns: none. $Arguments: @@ -1653,24 +1579,20 @@ g_smscb_data.CBTopics.length = 0; for (i = 0; i < MAX_MIDS; i++) - { - g_smscb_data.CBTopics.entry[i].msg_id = NO_MID; /* Set MID list default values. */ - g_smscb_data.CBTopics.entry[i].name[0] = '\0'; - g_smscb_data.CBTopics.entry[i].dcs = 0; - } - + { + g_smscb_data.CBTopics.entry[i].msg_id = NO_MID; /* Set MID list default values. */ + g_smscb_data.CBTopics.entry[i].name[0] = '\0'; + g_smscb_data.CBTopics.entry[i].dcs = 0; + } } /******************************************************************************* $Function: smscb_delete_topic - - $Description: : This function is used to delete an MID from the current list <g_smscb_data.CBTopics>. - $Returns: $Arguments: @@ -1692,15 +1614,14 @@ * set MidCount to first entry which contains NO_MID or * set MidCount to MAX_MIDS if list is full */ - // MidCount = g_smscb_data.CBTopics.length + 1; /* Move the MID data up one. */ while (MidOffset < (MidCount)) //c005 rsa avoid copying from behind the array - { - g_smscb_data.CBTopics.entry[MidOffset] = g_smscb_data.CBTopics.entry[MidOffset + 1]; - MidOffset++; - } + { + g_smscb_data.CBTopics.entry[MidOffset] = g_smscb_data.CBTopics.entry[MidOffset + 1]; + MidOffset++; + } //c005 rsa but assign NO_MID behind the last entry if (MidCount > 0) g_smscb_data.CBTopics.entry[MidCount].msg_id = NO_MID; @@ -1717,31 +1638,27 @@ while ((i < MAX_MIDS) && (g_smscb_data.CBTopics.entry[i].msg_id != Mid)) i++; - #ifdef DEBUG_SMS_CB - /***************************Go-lite Optimization changes Start***********************/ - // Aug 16, 2004 REF: CRR 24323 Deepa M.D + /***************************Go-lite Optimization changes Start***********************/ + // Aug 16, 2004 REF: CRR 24323 Deepa M.D TRACE_EVENT_P1 ("i is %d", i); - /***************************Go-lite Optimization changes end***********************/ + /***************************Go-lite Optimization changes end***********************/ #endif #ifdef DEBUG_SMS_CB - /***************************Go-lite Optimization changes Start***********************/ - // Aug 16, 2004 REF: CRR 24323 Deepa M.D - TRACE_EVENT ("after deleting !"); - for (ii = 0; ii < MAX_MIDS; ii++) - { - - TRACE_EVENT_P2 (" 03 midlist:%d, i:%d", g_smscb_data.CBTopics.entry[ii].msg_id,ii); - } - - TRACE_EVENT_P1 ("03 midlist:%d", g_smscb_data.CBTopics.length); - /***************************Go-lite Optimization changes end***********************/ + /***************************Go-lite Optimization changes Start***********************/ + // Aug 16, 2004 REF: CRR 24323 Deepa M.D + TRACE_EVENT ("after deleting !"); + for (ii = 0; ii < MAX_MIDS; ii++) + { + TRACE_EVENT_P2 (" 03 midlist:%d, i:%d", g_smscb_data.CBTopics.entry[ii].msg_id,ii); + } + + TRACE_EVENT_P1 ("03 midlist:%d", g_smscb_data.CBTopics.length); + /***************************Go-lite Optimization changes end***********************/ #endif - - return 1; } @@ -1771,7 +1688,6 @@ $Description: This function allows the MS-User to examine the current list of MIDs being used to filter CB messages. - $Returns: $Arguments: @@ -1782,7 +1698,7 @@ T_MFW status; UBYTE i,d=0; /*MC SPR 1920, need to allocate this as large data structure*/ - T_MFW_SMS_CB_INFO* SmsCbInfo = (T_MFW_SMS_CB_INFO*)ALLOC_MEMORY(sizeof(T_MFW_SMS_CB_INFO)); + T_MFW_SMS_CB_INFO* SmsCbInfo = (T_MFW_SMS_CB_INFO*)ALLOC_MEMORY(sizeof(T_MFW_SMS_CB_INFO)); T_SMSCB_TOPIC_TAG ffs_tag;/*SPR1920*/ char file_name[20];/*SPR1920*/ int val;/*SPR1920*/ @@ -1795,90 +1711,84 @@ TRACE_EVENT (" get the list from sim"); #endif - //clear the Topic list - smscb_InitData(); - - //get the Topic list from the SIM + //clear the Topic list + smscb_InitData(); + + //get the Topic list from the SIM status = sms_get_cell_broadcast_info(SmsCbInfo); - //set to default - g_smscb_data.CBTopics.length = 0xFF; - + //set to default + g_smscb_data.CBTopics.length = 0xFF; + +#ifdef DEBUG_SMS_CB + /***************************Go-lite Optimization changes Start***********************/ + // Aug 16, 2004 REF: CRR 24323 Deepa M.D + for (i = 0; i <= 19; i++) + { + TRACE_EVENT_P2("DATA from mfw %d i:%d", SmsCbInfo->msg_id[i],i); + } + /***************************Go-lite Optimization changes end***********************/ +#endif + + for (i = 0; i < MAX_MIDS; i++) + { + /* Update MID list from SIM data. */ + g_smscb_data.CBTopics.entry[i].msg_id = SmsCbInfo->msg_id[d]; + + g_smscb_data.CBTopics.entry[i].dcs = SmsCbInfo->dcs[d]; + + if (g_smscb_data.CBTopics.entry[i].msg_id EQ NO_MID) + { + break; + } + else + { + g_smscb_data.CBTopics.length = i; + } + + /* Set default tag string, until we get the saved name form PCM */ + g_smscb_data.CBTopics.entry[i].name[0] = '\0'; + /*attempt to read channel name from FFS file*/ + val = ffs_fread(ffs_cb_tag_name(g_smscb_data.CBTopics.entry[i].msg_id, file_name), &ffs_tag, sizeof(T_SMSCB_TOPIC_TAG)); + /*if reading successful, copy name to data structure*/ + if (val == sizeof(ffs_tag)) + { + memcpy(g_smscb_data.CBTopics.entry[i].name, ffs_tag.name, CB_TAG_LENGTH); + } + /*SPR1920, end*/ + /* ??? update here g_smscb_data.CBTopics.entry[i].name from PCM */ + if (g_smscb_data.CBTopics.entry[i].name[0] EQ '\0') + { + /* but if it's empty substitute it by the channel number */ + sprintf (g_smscb_data.CBTopics.entry[i].name,"Ch%d,ID:%d",i,g_smscb_data.CBTopics.entry[i].msg_id); + } + //x0pleela 16 Feb, 2007 DR: OMAPS00116175 + //Changed the incremental value from 2 to 1 as the successive CB parameters ( message id) was getting skipped while reading back + //from cell broadcast parameters + d++; #ifdef DEBUG_SMS_CB /***************************Go-lite Optimization changes Start***********************/ // Aug 16, 2004 REF: CRR 24323 Deepa M.D - for (i = 0; i <= 19; i++) - { - TRACE_EVENT_P2("DATA from mfw %d i:%d", SmsCbInfo->msg_id[i],i); - } + TRACE_EVENT_P2 ( "02 midlist:%d, i:%d", g_smscb_data.CBTopics.entry[i].msg_id,i); /***************************Go-lite Optimization changes end***********************/ #endif - - for (i = 0; i < MAX_MIDS; i++) - { - /* Update MID list from SIM data. */ - g_smscb_data.CBTopics.entry[i].msg_id = SmsCbInfo->msg_id[d]; - - g_smscb_data.CBTopics.entry[i].dcs = SmsCbInfo->dcs[d]; - - if (g_smscb_data.CBTopics.entry[i].msg_id EQ NO_MID) - { - break; - } - else - { - g_smscb_data.CBTopics.length = i; - } - - /* Set default tag string, until we get the saved name form PCM */ - g_smscb_data.CBTopics.entry[i].name[0] = '\0'; - /*SPR1920*/ - /*attempt to read channel name from FFS file*/ - val = ffs_fread(ffs_cb_tag_name(g_smscb_data.CBTopics.entry[i].msg_id, file_name), &ffs_tag, sizeof(T_SMSCB_TOPIC_TAG)); - /*if reading successful, copy name to data structure*/ - if (val == sizeof(ffs_tag)) - { - memcpy(g_smscb_data.CBTopics.entry[i].name, ffs_tag.name, CB_TAG_LENGTH); - } - /*SPR1920, end*/ - /* ??? update here g_smscb_data.CBTopics.entry[i].name from PCM */ - if (g_smscb_data.CBTopics.entry[i].name[0] EQ '\0') - { - /* but if it's empty substitute it by the channel number */ - sprintf (g_smscb_data.CBTopics.entry[i].name,"Ch%d,ID:%d",i,g_smscb_data.CBTopics.entry[i].msg_id); - } - //x0pleela 16 Feb, 2007 DR: OMAPS00116175 - //Changed the incremental value from 2 to 1 as the successive CB parameters ( message id) was getting skipped while reading back - //from cell broadcast parameters - d++; - -#ifdef DEBUG_SMS_CB - /***************************Go-lite Optimization changes Start***********************/ - // Aug 16, 2004 REF: CRR 24323 Deepa M.D - TRACE_EVENT_P2 ( "02 midlist:%d, i:%d", g_smscb_data.CBTopics.entry[i].msg_id,i); - /***************************Go-lite Optimization changes end***********************/ -#endif - - } - - - if (g_smscb_data.CBTopics.length EQ 0xFF) - { - //list is empty - g_smscb_data.CBTopics.length = 0; - } - else - { - //+1 because the "0" was counted as well - g_smscb_data.CBTopics.length +=1; - } - - - - /*SPR 1920, end of function, deallocate memory*/ - FREE_MEMORY((void*)SmsCbInfo,sizeof(T_MFW_SMS_CB_INFO)); + } + + if (g_smscb_data.CBTopics.length EQ 0xFF) + { + //list is empty + g_smscb_data.CBTopics.length = 0; + } + else + { + //+1 because the "0" was counted as well + g_smscb_data.CBTopics.length +=1; + } + + /*SPR 1920, end of function, deallocate memory*/ + FREE_MEMORY((void*)SmsCbInfo,sizeof(T_MFW_SMS_CB_INFO)); return status; } @@ -1925,33 +1835,30 @@ /* SH - moved up here otherwise does not execute*/ //nm - if (State EQ SMSCB_SWITCH_ON ) - sms_set_mt_ind(MT_CB_MSG); - else - sms_set_mt_ind(MT_CB_NO_IDX); - + if (State EQ SMSCB_SWITCH_ON ) + sms_set_mt_ind(MT_CB_MSG); + else + sms_set_mt_ind(MT_CB_NO_IDX); /* copy local list to SIM */ - SmsCbInfo->mode = State; - - - for (i = 0; i < MAX_MIDS; i++) - { - SmsCbInfo->msg_id[i] = NO_MID; /* Set MID list default values. */ - SmsCbInfo->dcs[i] = 0xFF; - } + SmsCbInfo->mode = State; + + for (i = 0; i < MAX_MIDS; i++) + { + SmsCbInfo->msg_id[i] = NO_MID; /* Set MID list default values. */ + SmsCbInfo->dcs[i] = 0xFF; + } // Dec 22, 2004 REF: CRR MFW-SPR-27847 xnkulkar // Description: MFW memory size variable changed from U16 -> U32 // Solution: 'd' is checked against 'MAX_IDENTS' to restrict increment beyond limit for (i = 0; (i < g_smscb_data.CBTopics.length) && (d < MAX_IDENTS); i++) - { - - SmsCbInfo->msg_id[d] = g_smscb_data.CBTopics.entry[i].msg_id; - /* ??? update here PCM with g_smscb_data.CBTopics.entry[i].name */ - SmsCbInfo->dcs[d] = (char)g_smscb_data.CBTopics.entry[i].dcs; - - d++; + { + + SmsCbInfo->msg_id[d] = g_smscb_data.CBTopics.entry[i].msg_id; + /* ??? update here PCM with g_smscb_data.CBTopics.entry[i].name */ + SmsCbInfo->dcs[d] = (char)g_smscb_data.CBTopics.entry[i].dcs; + d++; // Dec 22, 2004 REF: CRR MFW-SPR-27847 xnkulkar // Description: MFW memory size variable changed from U16 -> U32 @@ -1963,30 +1870,29 @@ // d++; - - } - + } #ifdef DEBUG_SMS_CB - /***************************Go-lite Optimization changes Start***********************/ - // Aug 16, 2004 REF: CRR 24323 Deepa M.D + /***************************Go-lite Optimization changes Start***********************/ + // Aug 16, 2004 REF: CRR 24323 Deepa M.D for (i = 0; i <= 25; i++) - { - TRACE_EVENT_P2 ("SAVING..SmsCbInfo.msg_id[i] %d i:%d", SmsCbInfo->msg_id[i],i); - } - /***************************Go-lite Optimization changes end***********************/ + { + TRACE_EVENT_P2 ("SAVING..SmsCbInfo.msg_id[i] %d i:%d", SmsCbInfo->msg_id[i],i); + } + /***************************Go-lite Optimization changes end***********************/ #endif - Status = sms_set_cell_broadcast_info(State, SmsCbInfo); + Status = sms_set_cell_broadcast_info(State, SmsCbInfo); #ifdef DEBUG_SMS_CB - /***************************Go-lite Optimization changes Start***********************/ - // Aug 16, 2004 REF: CRR 24323 Deepa M.D + /***************************Go-lite Optimization changes Start***********************/ + // Aug 16, 2004 REF: CRR 24323 Deepa M.D TRACE_EVENT_P1 ("SAVING.Status is %d", Status); - /***************************Go-lite Optimization changes end***********************/ + /***************************Go-lite Optimization changes end***********************/ #endif - /*SPR 1920, end of function, deallocate memory*/ - FREE_MEMORY((void*)SmsCbInfo,sizeof(T_MFW_SMS_CB_INFO)); + + /*SPR 1920, end of function, deallocate memory*/ + FREE_MEMORY((void*)SmsCbInfo,sizeof(T_MFW_SMS_CB_INFO)); return Status; } @@ -1997,7 +1903,7 @@ $Description: Calls from the MainMenu - $Returns: none. + $Returns: none. $Arguments: @@ -2010,12 +1916,12 @@ count = 0; /*SPR 1920, use cb_attributes list as smsCBList removed*/ for (j=0; j<MAX_MIDS; j++) + { + if (smscb_data.cb_attributes[j].status== UNREAD_MESSAGE) { - if (smscb_data.cb_attributes[j].status== UNREAD_MESSAGE) - { - count++; /* found an unread message */ - } + count++; /* found an unread message */ } + } return count; } @@ -2052,82 +1958,77 @@ Buffer[0] = '\0'; } } + #ifdef DEBUG_SMS_CB void handle_dummy_message(T_MFW_SMS_CB* Message) { - USHORT i; - SHORT geograhical_scope = (SHORT)0xC000; - char temp_buffer[MAX_CBMSG_LEN]; - - TRACE_EVENT ("E_SMS_CB"); - - memset(temp_buffer, '\0', MAX_CBMSG_LEN); - - //check: does the incoming CB indicates a immediate scope - if (! (Message->sn & geograhical_scope) ) - { - //Immediate scope - // API - 859 - German characters were not visable in the CB message - TRACE_EVENT("Immediate Scope"); - - - - for(i=0;i <= Message->msg_len;i++) - { - //check now for the termination "0x00D" - //the message is NOT terminated with '\0' - if (Message->cb_msg[i] EQ 0x0d) - { - Message->cb_msg[i]='\0'; - } - } - // API - 859 - Convert the the incoming GSM Text to ASCII - ATB_convert_String(Message->cb_msg, MFW_DCS_8bits, Message->msg_len, - temp_buffer, MFW_ASCII, MAX_CBMSG_LEN, FALSE); + USHORT i; + SHORT geograhical_scope = (SHORT)0xC000; + char temp_buffer[MAX_CBMSG_LEN]; + + TRACE_EVENT ("E_SMS_CB"); + + memset(temp_buffer, '\0', MAX_CBMSG_LEN); + + //check: does the incoming CB indicates a immediate scope + if (! (Message->sn & geograhical_scope) ) + { + //Immediate scope + // API - 859 - German characters were not visable in the CB message + TRACE_EVENT("Immediate Scope"); + + for (i=0; i <= Message->msg_len; i++) + { + //check now for the termination "0x00D" + //the message is NOT terminated with '\0' + if (Message->cb_msg[i] EQ 0x0d) + { + Message->cb_msg[i]='\0'; + } + } + // API - 859 - Convert the the incoming GSM Text to ASCII + ATB_convert_String(Message->cb_msg, MFW_DCS_8bits, Message->msg_len, + temp_buffer, MFW_ASCII, MAX_CBMSG_LEN, FALSE); #ifdef MMI_HOMEZONE_ENABLED // SH 11/12/01 - /* SPR759 - SH - Homezone: check to see if CB gives us the coordinates of the centre of the current cell */ - - if (Message->msg_id==HZ_IDENTIFIER) - { - homezoneCBData(Message->cb_msg); - } - else - { + /* SPR759 - SH - Homezone: check to see if CB gives us the coordinates of the centre of the current cell */ + + if (Message->msg_id==HZ_IDENTIFIER) + { + homezoneCBData(Message->cb_msg); + } + else + { #endif // HOMEZONE - //display now on the idle screen - addCBCH(temp_buffer, IdleNewCBImmediateMessage); + addCBCH(temp_buffer, IdleNewCBImmediateMessage); statusCBCH(TRUE); #ifdef MMI_HOMEZONE_ENABLED - } /* SPR759 - SH */ + } /* SPR759 - SH */ #endif - } - - else //Normal scope + } + else //Normal scope + { + TRACE_EVENT("Normal Scope"); + //only for single- and the last page of mulitpages + //other pages have not the termination "0x00D" + + // API - 859 - Convert the the incoming GSM Text to ASCII { - TRACE_EVENT("Normal Scope"); - //only for single- and the last page of mulitpages - //other pages have not the termination "0x00D" - - // API - 859 - Convert the the incoming GSM Text to ASCII - - { - Message->cb_msg[MAX_CBMSG_LEN-1]='\0'; - } - ATB_convert_String(Message->cb_msg, MFW_DCS_8bits, Message->msg_len, - temp_buffer, MFW_ASCII, /*MAX_MSG_LEN*/MAX_CBMSG_LEN, FALSE); - memcpy(Message->cb_msg, temp_buffer, MAX_CBMSG_LEN); - //indicate on the idle screen the new incoming cb - addCBCH( NULL, IdleNewCBNormalMessage ); - statusCBCH(TRUE); - //save the incoming cb messages in the fifo - sms_new_incoming_cb (Message); - + Message->cb_msg[MAX_CBMSG_LEN-1]='\0'; } - + ATB_convert_String(Message->cb_msg, MFW_DCS_8bits, Message->msg_len, + temp_buffer, MFW_ASCII, /*MAX_MSG_LEN*/MAX_CBMSG_LEN, FALSE); + memcpy(Message->cb_msg, temp_buffer, MAX_CBMSG_LEN); + //indicate on the idle screen the new incoming cb + addCBCH( NULL, IdleNewCBNormalMessage ); + statusCBCH(TRUE); + //save the incoming cb messages in the fifo + sms_new_incoming_cb (Message); } +} + /******************************************************************************* $Function: test_function_to_send_cb @@ -2139,13 +2040,11 @@ *******************************************************************************/ - void test_function_to_send_cb (void) { T_MFW_SMS_CB Message; UBYTE i; - DEBUG = FALSE; // for testing only @@ -2160,7 +2059,6 @@ handle_dummy_message (&Message); - Message.sn = 61; Message.msg_id = 61; Message.page = 1; @@ -2170,7 +2068,6 @@ handle_dummy_message (&Message); - Message.sn = 62; Message.msg_id = 61; Message.page = 1; @@ -2189,7 +2086,6 @@ handle_dummy_message (&Message); - Message.sn = /*56*/0xC038; Message.msg_id = 55; Message.page = 1; @@ -2199,7 +2095,6 @@ handle_dummy_message (&Message); - Message.sn = /*56*/0xC038; Message.msg_id = 56; Message.page = 2; @@ -2243,7 +2138,6 @@ handle_dummy_message (&Message); - Message.sn = 16384; Message.msg_id = 59; Message.page = 2; @@ -2268,7 +2162,6 @@ handle_dummy_message (&Message); - Message.sn = 16384; Message.msg_id = 59; Message.page = 5; @@ -2293,7 +2186,6 @@ handle_dummy_message (&Message); - Message.sn = 16384; Message.msg_id = 59; Message.page = 8; @@ -2318,7 +2210,6 @@ handle_dummy_message (&Message); - Message.sn = 16384; Message.msg_id = 59; Message.page = 11; @@ -2343,7 +2234,6 @@ handle_dummy_message (&Message); - Message.sn = 16384; Message.msg_id = 59; Message.page = 14; @@ -2363,9 +2253,6 @@ #if 0 - - - Message.sn = 63; Message.msg_id = 63; Message.page = 1; @@ -2576,23 +2463,19 @@ *******************************************************************************/ void sms_cb_init (void) { - //for tracing #ifdef DEBUG_SMS_CB - char buf [100]; + char buf [100]; #endif - UBYTE i; - //set to the default, "FF" -> no CB messages stored smscb_data.used_pointer = 0xFF; //set to the default, "0" -> free spaces on the first index in fifo smscb_data.free_pointer = 0; - //set the fifo to the default for (i=0; i<MAX_STORED_PAGES -1 ; i++) { @@ -2605,8 +2488,6 @@ smscb_data.cb_attributes[i].header = NULL;/* SPR 1920,ensure unalloacted pointers set to NULL*/ } - - //"FF" on the last entry means end of the free spaces list smscb_data.cb_attributes[MAX_STORED_PAGES-1].next_link = 0xFF; smscb_getCBsettings(); @@ -2616,11 +2497,6 @@ else smscb_setCBsettings(SMSCB_SWITCH_ON); //for tracing - - - - - } /******************************************************************************* @@ -2657,8 +2533,8 @@ $Function: sms_new_incoming_cb $Description: This function will be call after each NEW incoming cb messages. - It checks for free spaces and organize to save the cb messages - in the right order. + It checks for free spaces and organize to save the cb messages + in the right order. $Returns: $Arguments: @@ -2666,25 +2542,21 @@ *******************************************************************************/ void sms_new_incoming_cb (T_MFW_SMS_CB *Message) { - //only for tracing #ifdef DEBUG_SMS_CB UBYTE i, test; #endif - //set to default UBYTE result =0; smscb_data.found_mid = FALSE; smscb_data.clear_mid = FALSE; - //only for tracing #ifdef DEBUG_SMS_CB TRACE_EVENT("--------------start------------"); #endif //DEBUG_SMS_CB - //search the new MID with the MID's in the fifo. //used_pointer EQ 0xFF means there is no message in the fifo if (smscb_data.used_pointer NEQ 0xFF) @@ -2692,7 +2564,6 @@ result = sms_cb_search_mid (Message->msg_id, Message->sn); } - //error: in searching mid if (result EQ 0xAA) { @@ -2700,7 +2571,6 @@ return; } - // does the message with the same MID already exist in the fifo ? if(smscb_data.found_mid) { @@ -2708,27 +2578,22 @@ sms_cb_delete_message (Message->msg_id); - smscb_data.clear_mid = TRUE; } - // does we have free space ? if (smscb_data.free_pointer EQ 0xFF) { //no free spaces -> means overwrite the oldest message sms_cb_overwrite_old_message (Message); - } else // does we have free space ? { //still free spaces sms_cb_store_message (Message); - } - //only for tracing #ifdef DEBUG_SMS_CB /***************************Go-lite Optimization changes Start***********************/ @@ -2739,13 +2604,10 @@ /***************************Go-lite Optimization changes end***********************/ TRACE_EVENT("--------------finish------------"); - #endif //DEBUG_SMS_CB - } - /******************************************************************************* $Function: sms_cb_store_message @@ -2759,10 +2621,8 @@ *******************************************************************************/ UBYTE sms_cb_store_message (T_MFW_SMS_CB *Message) { - TRACE_FUNCTION("sms_cb_store_message"); - //it is only for the first time if (smscb_data.used_pointer EQ 0xFF) { @@ -2770,7 +2630,6 @@ smscb_data.used_pointer = smscb_data.free_pointer; } - //save the new message in the fifo /*MC SPR 1920 if memory not alloacted for message, allocate some*/ TRACE_EVENT_P1("Allocating memory to slot %d for CB message", smscb_data.free_pointer); @@ -2793,7 +2652,6 @@ UBYTE temp, result; - //keep the link-value for later temp = smscb_data.used_pointer; @@ -2807,7 +2665,6 @@ return 0; // RAVI } - //update the link-list smscb_data.cb_attributes[smscb_data.used_pointer].next_link = smscb_data.free_pointer; @@ -2823,7 +2680,6 @@ smscb_data.used_pointer = smscb_data.result_used; } - } else //was it the last free space ? { @@ -2834,15 +2690,12 @@ //keep the usedpointer-value for later temp_2 = smscb_data.used_pointer; - //keep the link-value for later temp = smscb_data.cb_attributes[smscb_data.free_pointer].next_link; - //terminate the used list smscb_data.cb_attributes[smscb_data.free_pointer].next_link = 0xFF; - //find the termination in the link list result = sms_cb_find_termination (&smscb_data.used_pointer); @@ -2853,18 +2706,15 @@ return 0; } - //update the use pointer if (smscb_data.used_pointer NEQ smscb_data.free_pointer) { smscb_data.cb_attributes[smscb_data.used_pointer].next_link = smscb_data.free_pointer; } - // update the free pointer as well smscb_data.free_pointer = temp; - //did it clear before ? if (smscb_data.clear_mid) { @@ -2876,7 +2726,6 @@ smscb_data.used_pointer = temp_2 ; } - } //ADDED BY RAVI- 28-11-2005 return 1; @@ -2911,22 +2760,18 @@ /***************************Go-lite Optimization changes end***********************/ #endif //DEBUG_SMS_CB - TRACE_EVENT("sms_cb_overwrite_old_message"); //keep the value for later // temp = smscb_data.used_pointer; - //find the page in the fifo with the same MID number & delete them sms_cb_delete_message (smscb_data.cb_attributes[smscb_data.used_pointer].mid); - //now we have free space to store the new incoming cb message sms_cb_store_message (Message); return 1; // ADDED BY RAVI - 28-11-2005 - } /******************************************************************************* @@ -2935,7 +2780,7 @@ $Description: Store the attributes of the new incoming cb - Attributes are stored seperatly from the message text + Attributes are stored seperatly from the message text $Returns: $Arguments: @@ -2950,7 +2795,6 @@ smscb_data.cb_attributes[position].page = Message->page; smscb_data.cb_attributes[position].pages = Message->pages; smscb_data.cb_attributes[position].msg_len = Message->msg_len; - } @@ -2974,7 +2818,6 @@ temp = smscb_data.used_pointer; - if (smscb_data.cb_attributes[temp].mid EQ mid) { //found the mid in the fifo @@ -2982,10 +2825,10 @@ if ((smscb_data.cb_attributes[temp].sn & update_number_mask) NEQ (sn & update_number_mask) ) { - //the new cb is the update of the existing one - smscb_data.found_mid = TRUE; - TRACE_EVENT("found = True, return"); - return temp; + //the new cb is the update of the existing one + smscb_data.found_mid = TRUE; + TRACE_EVENT("found = True, return"); + return temp; } /*SPR 2429, return this index as otherwise there will be two copies of the same message*/ @@ -2993,14 +2836,11 @@ return temp; } - while (smscb_data.cb_attributes[temp].next_link NEQ 0xFF) { - // going through the link list temp = smscb_data.cb_attributes[temp].next_link; - if (smscb_data.cb_attributes[temp].mid EQ mid) { //found the mid in the fifo @@ -3008,12 +2848,9 @@ if ((smscb_data.cb_attributes[temp].sn & update_number_mask) NEQ (sn & update_number_mask) ) { - //the new cb is the update of the existing one in the fifo smscb_data.found_mid = TRUE; return temp; - - } /*SPR 2429, return this index as otherwise there will be two copies of the same message*/ @@ -3021,7 +2858,6 @@ return temp;/*SHould just replace old one with new one anyway*/ } - // only to be sure there is a ever ending loop i++; if (i > MAX_STORED_PAGES) @@ -3032,7 +2868,6 @@ } - /******************************************************************************* $Function: sms_cb_delete_message @@ -3046,7 +2881,6 @@ *******************************************************************************/ UBYTE sms_cb_delete_message (USHORT mid) { - //only tracing #ifdef DEBUG_SMS_CB char buf[100]; @@ -3056,11 +2890,9 @@ TRACE_EVENT("sms_cb_delete_message"); - //keep the value for later temp_2 = smscb_data.used_pointer; - // keep the value for later smscb_data.start_used = smscb_data.used_pointer; @@ -3074,7 +2906,6 @@ return 0; // RAVI } - //found immediately ? if (smscb_data.start_used EQ smscb_data.used_pointer) { @@ -3088,7 +2919,6 @@ //search for the last page smscb_data.end_used = sms_cb_find_endpoint (mid, smscb_data.used_pointer); - //error: couldnt find the termination ?! if (smscb_data.end_used EQ 0xAA) { @@ -3096,15 +2926,12 @@ return 0; // RAVI } - - if ( (smscb_data.cb_attributes[smscb_data.used_pointer].next_link EQ 0xFF) && (smscb_data.cb_attributes[smscb_data.used_pointer].mid EQ mid) ) { //it is the oldest cb and also the only one in the fifo TRACE_EVENT("oldest position and the only one in the list"); - //deleted messages -> now more space availabe -> update the free pointer result = sms_cb_update_free_pointer (temp); @@ -3133,7 +2960,6 @@ //terminate the free pointer list smscb_data.cb_attributes[smscb_data.end_used].next_link = 0xFF; - //error: couldnt find the termination ?! if (result EQ 0xAA) { @@ -3143,11 +2969,9 @@ } - } else //found immediately ? { - //keep the value for later temp = smscb_data.used_pointer; @@ -3160,7 +2984,6 @@ return 0; } - if (smscb_data.cb_attributes[smscb_data.used_pointer].next_link EQ 0xFF && smscb_data.cb_attributes[smscb_data.used_pointer].mid EQ mid) { @@ -3171,14 +2994,12 @@ //terminate the position where the multipage began smscb_data.cb_attributes[smscb_data.start_used].next_link= 0xFF; - //deleted messages -> now more space availabe -> update the free pointer result = sms_cb_update_free_pointer (temp); //terminate the free pointer list smscb_data.cb_attributes[smscb_data.used_pointer].next_link = 0xFF; - //error: couldnt find the termination ?! if (result EQ 0xAA) { @@ -3189,7 +3010,6 @@ smscb_data.result_used = temp_2; smscb_data.used_pointer = temp_2; - } else { @@ -3206,11 +3026,6 @@ //terminate the free pointer list smscb_data.cb_attributes[smscb_data.end_used].next_link = 0xFF; - - - - - //error: couldnt find the termination ?! if (result EQ 0xAA) { @@ -3218,15 +3033,11 @@ return 0; } - smscb_data.result_used = temp_2; } - - } - return 1; // ADDED BY RAVI - 28-11-2005 - + return 1; // ADDED BY RAVI - 28-11-2005 } /******************************************************************************* @@ -3235,7 +3046,6 @@ $Description: find the startpoint of the multipage. It is also used for singlepage. - $Returns: $Arguments: @@ -3252,24 +3062,22 @@ TRACE_EVENT("in sms_cb_find_startpoint "); #endif //DEBUG_SMS_CB - //search for the first page of the multipages while (smscb_data.cb_attributes[smscb_data.used_pointer].mid NEQ mid) { - start_used = smscb_data.used_pointer; // going through the link list smscb_data.used_pointer = smscb_data.cb_attributes[smscb_data.used_pointer].next_link; - // only to be sure there is a ever ending loop - i++; - if (i > MAX_STORED_PAGES) - return 0xAA; + // only to be sure there is a ever ending loop + i++; + if (i > MAX_STORED_PAGES) + return 0xAA; } -//only tracing -TRACE_EVENT_P1("start_used: %d", start_used); + //only tracing + TRACE_EVENT_P1("start_used: %d", start_used); return start_used; } @@ -3279,8 +3087,8 @@ $Function: sms_cb_find_startpoint $Description: find the lastpage of the multipage. - It is also used for the singlepage but in this case the - end_used will be equal to used_pointer + It is also used for the singlepage but in this case the + end_used will be equal to used_pointer $Returns: @@ -3291,13 +3099,10 @@ { UBYTE i = 0; - - //search for the last page of the multipages while (smscb_data.cb_attributes[smscb_data.used_pointer].mid EQ mid && - smscb_data.cb_attributes[smscb_data.used_pointer].next_link NEQ 0xFF ) + smscb_data.cb_attributes[smscb_data.used_pointer].next_link NEQ 0xFF ) { - end_used = smscb_data.used_pointer; // going through the link list @@ -3309,8 +3114,7 @@ return 0xAA; } - -TRACE_EVENT_P1("end_used: %d", end_used); + TRACE_EVENT_P1("end_used: %d", end_used); return end_used; } @@ -3320,8 +3124,7 @@ $Function: sms_cb_update_free_pointer $Description: This function is updating the free pointer after deleting - cb messages in the fifo (space available !) - + cb messages in the fifo (space available !) $Returns: @@ -3332,11 +3135,9 @@ { UBYTE update=0, i=0; - TRACE_EVENT("sms_cb_update_free_pointer"); - -TRACE_EVENT_P1("temp index:%d", temp); + TRACE_EVENT_P1("temp index:%d", temp); if (smscb_data.free_pointer EQ 0xFF) {TRACE_EVENT("free pointer = 0xff"); //take the old used_pointer (before of deleting the messages) @@ -3368,32 +3169,24 @@ return 0xAA; } - //continue the free pointer link list to the new deleted multipage smscb_data.cb_attributes[smscb_data.free_pointer].next_link = temp; - //show on the first deleted multipage smscb_data.free_pointer = update; - } - //indicate that we deleted cb messages smscb_data.clear_mid = TRUE; - //need for later smscb_data.result_used = smscb_data.used_pointer; -TRACE_EVENT_P1("used pointer: %d", smscb_data.used_pointer); -//only for tracing - + TRACE_EVENT_P1("used pointer: %d", smscb_data.used_pointer); + //only for tracing return update; - - } @@ -3402,8 +3195,8 @@ $Function: sms_cb_find_termination $Description: This function search for the termination in the link list. - It jumps from one link to the another link until he founds - the termination "0xFF" + It jumps from one link to the another link until he founds + the termination "0xFF" $Returns: @@ -3423,7 +3216,6 @@ i++; if (i > MAX_STORED_PAGES) return 0xAA; - } return *used; @@ -3435,7 +3227,7 @@ $Function: sms_cb_count_messages $Description: This function counts messages in the fifo. - ! Multipage are counted as one page ! + ! Multipage are counted as one page ! $Returns: @@ -3446,14 +3238,12 @@ { UBYTE i=0, count=0, used, page, pages, mid, start_flag = 1; //, temp_used; - for (i=0; i<MAX_STORED_PAGES ; i++) { smscb_data.cb_attributes[i].start_page = 0; } i=0; - if (smscb_data.used_pointer EQ 0xFF) { //there are no cb messages in the fifo @@ -3464,7 +3254,6 @@ while ( i < MAX_STORED_PAGES) { - //single or multipage ? if(smscb_data.cb_attributes[used].pages EQ 0x01) { @@ -3509,7 +3298,6 @@ return count; } - } else //single or multipage ? { @@ -3526,7 +3314,6 @@ /***************************Go-lite Optimization changes end***********************/ } - page = smscb_data.cb_attributes[used].page; pages = smscb_data.cb_attributes[used].pages; mid = smscb_data.cb_attributes[used].mid; @@ -3539,11 +3326,9 @@ used = smscb_data.cb_attributes[used].next_link; } - //is it the last message in the fifo ? if (smscb_data.cb_attributes[used].next_link EQ 0xFF) { - //The last page, does it still continue or does it complete //the multipage ? if( smscb_data.cb_attributes[used].pages EQ pages && @@ -3639,7 +3424,6 @@ } - // only to be sure there is a ever ending loop i++; } @@ -3663,7 +3447,7 @@ { UBYTE i=0, m=0, used; -used = smscb_data.used_pointer; + used = smscb_data.used_pointer; while (smscb_data.cb_attributes[used].next_link NEQ 0xFF) { @@ -3678,15 +3462,12 @@ i++; if (i > MAX_STORED_PAGES) return 0xAA; - } - // have a check of the last one if (smscb_data.cb_attributes[used].status EQ UNREAD_MESSAGE) m ++; - #ifdef DEBUG_SMS_CB /***************************Go-lite Optimization changes Start***********************/ // Aug 16, 2004 REF: CRR 24323 Deepa M.D @@ -3703,7 +3484,7 @@ $Function: sms_cb_give_position_of_msg $Description: You give the position (order of the msg from oldest to the latest) - and he gives you the real positon of the link list + and he gives you the real positon of the link list $Returns: @@ -3717,7 +3498,6 @@ while ( (smscb_data.cb_attributes[used].next_link NEQ 0xFF) && (i NEQ positon) ) { - // going through the link list used= smscb_data.cb_attributes[used].next_link; @@ -3727,13 +3507,10 @@ i++; } - - if (m > MAX_STORED_PAGES) return 0xAA; m++; - } //return the positon in the link list @@ -3750,12 +3527,10 @@ $Arguments: - *******************************************************************************/ int sms_cb_select_read (MfwMnu* m, MfwMnuItem* i) { - - sms_cb_read_msg (ALL_MESSAGE); + sms_cb_read_msg (ALL_MESSAGE); return 1; } @@ -3764,7 +3539,7 @@ $Function: sms_cb_read_msg $Description: This function prepare to read the cb messages - It could be call from everywhere. + It could be call from everywhere. $Returns: @@ -3774,60 +3549,54 @@ *******************************************************************************/ int sms_cb_read_msg (T_SMSCB_STATUS status) { - UBYTE result; //, i; // RAVI - + UBYTE result; //, i; // RAVI T_MFW_HND win = mfwParent(mfw_header()); - TRACE_FUNCTION("sms_cb_read_msg"); - - - - //count the number of the stored messages in the fifo - - result = sms_cb_count_messages (); - - if (result EQ 0x00) - { - TRACE_EVENT("sms cb ERROR, there are 0 cb messages"); - } - - - if((smscb_data.used_pointer EQ 0xFF) || (result EQ 0x00)) - { - TRACE_EVENT("There is no cb message stored"); - - info_screen(0, TxtEmptyList ,TxtNull, NULL); - } - else - { + TRACE_FUNCTION("sms_cb_read_msg"); + + //count the number of the stored messages in the fifo + + result = sms_cb_count_messages (); + + if (result EQ 0x00) + { + TRACE_EVENT("sms cb ERROR, there are 0 cb messages"); + } + + if((smscb_data.used_pointer EQ 0xFF) || (result EQ 0x00)) + { + TRACE_EVENT("There is no cb message stored"); + + info_screen(0, TxtEmptyList ,TxtNull, NULL); + } + else + { /***************************Go-lite Optimization changes Start***********************/ // Aug 16, 2004 REF: CRR 24323 Deepa M.D - TRACE_EVENT_P1("Total msg%d ", result); + TRACE_EVENT_P1("Total msg%d ", result); /***************************Go-lite Optimization changes end***********************/ - if (result EQ 0xAA) - { - TRACE_EVENT("sms cb ERROR, couldnt find the termination"); - return 0; // RAVI - } - - - //keep this value for the callback function from menu-list - smscb_data.total_number = result; - - //set the reason of reading - //read "all_message" , "unread_message", .......... - smscb_data.current_status = status; - - //fill up the menu list attributes - smscb_data.cb_list_attributes = sms_cb_create_list (smscb_data.total_number); - - - //show the menu list on the screen now - listDisplayListMenu (win, smscb_data.cb_list_attributes ,(ListCbFunc)sms_cb_list_cb,0); - + if (result EQ 0xAA) + { + TRACE_EVENT("sms cb ERROR, couldnt find the termination"); + return 0; // RAVI } + //keep this value for the callback function from menu-list + smscb_data.total_number = result; + + //set the reason of reading + //read "all_message" , "unread_message", .......... + smscb_data.current_status = status; + + //fill up the menu list attributes + smscb_data.cb_list_attributes = sms_cb_create_list (smscb_data.total_number); + + //show the menu list on the screen now + listDisplayListMenu (win, smscb_data.cb_list_attributes ,(ListCbFunc)sms_cb_list_cb,0); + + } + return 1; } @@ -3847,156 +3616,137 @@ { UBYTE i = 0, used, next_used, number_multipg =1; // RAVI - Removed - page, pages, variable. , control_bit=0; - ListMenuData *list_menu_data = (ListMenuData *)ALLOC_MEMORY (sizeof(ListMenuData)); if (list_menu_data EQ 0) { - TRACE_EVENT ("failed to create the list for cb"); + TRACE_EVENT ("failed to create the list for cb"); return NULL; } - list_menu_data->List = (T_MFW_MNU_ITEM *) ALLOC_MEMORY (number * sizeof (T_MFW_MNU_ITEM)); - if (list_menu_data->List EQ 0) { - TRACE_EVENT ("failed to create the list for cb"); + TRACE_EVENT ("failed to create the list for cb"); return NULL; } - TRACE_EVENT ("sms_cb_create_list ()"); - - - //take the current position in the fifo - used = smscb_data.used_pointer; - + TRACE_EVENT ("sms_cb_create_list ()"); + + //take the current position in the fifo + used = smscb_data.used_pointer; /* * Fill Menu List */ - - //until to reach the end of the fifo - while ( smscb_data.cb_attributes[used].next_link NEQ 0xFF ) + //until to reach the end of the fifo + while ( smscb_data.cb_attributes[used].next_link NEQ 0xFF ) + { + if (smscb_data.cb_attributes[used].start_page EQ 0x55) { - - if (smscb_data.cb_attributes[used].start_page EQ 0x55) + mnuInitDataItem(&list_menu_data->List[i]); + + next_used = used; + + // going through the link list + next_used = smscb_data.cb_attributes[next_used].next_link; + + //before we put the item for a multipage, we have to + //know how long it is. + //This is counting the number of pages belongs to a multipage + //Every multipage &singlepage starts with the indication 0x55 + while(smscb_data.cb_attributes[next_used].start_page NEQ 0x55) { - mnuInitDataItem(&list_menu_data->List[i]); - - next_used = used; - - // going through the link list + //sprintf(buf, "number_multipg %d in while", number_multipg); + //TRACE_EVENT(buf); + + number_multipg++; + + //go out when we reach the end of the link list + if (smscb_data.cb_attributes[next_used].next_link EQ 0xFF) + break; + + // going through the link list & take the next cb message next_used = smscb_data.cb_attributes[next_used].next_link; - - - - //before we put the item for a multipage, we have to - //know how long it is. - //This is counting the number of pages belongs to a multipage - //Every multipage &singlepage starts with the indication 0x55 - while(smscb_data.cb_attributes[next_used].start_page NEQ 0x55) - { - //sprintf(buf, "number_multipg %d in while", number_multipg); - //TRACE_EVENT(buf); - - number_multipg++; - - //go out when we reach the end of the link list - if (smscb_data.cb_attributes[next_used].next_link EQ 0xFF) - break; - - // going through the link list & take the next cb message - next_used = smscb_data.cb_attributes[next_used].next_link; - } - - - - //fill up the header - //"MID" + "available Page" + "Total page" - //the user release the uncomplete page about the available page. - /*SPR1920, allocate memory for header string*/ - if (smscb_data.cb_attributes[used].header == NULL) - smscb_data.cb_attributes[used].header = (char*)ALLOC_MEMORY(sizeof(char)*25); + } + + //fill up the header + //"MID" + "available Page" + "Total page" + //the user release the uncomplete page about the available page. + /*SPR1920, allocate memory for header string*/ + if (smscb_data.cb_attributes[used].header == NULL) + smscb_data.cb_attributes[used].header = (char*)ALLOC_MEMORY(sizeof(char)*25); sprintf(smscb_data.cb_attributes[used].header,"MID%d,%d/%d", smscb_data.cb_attributes[used].mid, - number_multipg, smscb_data.cb_attributes[used].pages); + number_multipg, smscb_data.cb_attributes[used].pages); list_menu_data->List[i].str =(char *) smscb_data.cb_attributes[used].header; - //set item to visible - if (smscb_data.current_status EQ ALL_MESSAGE) - { - //show all the cb messages + //set item to visible + if (smscb_data.current_status EQ ALL_MESSAGE) + { + //show all the cb messages list_menu_data->List[i].flagFunc = item_flag_none; - } - else if (smscb_data.current_status EQ UNREAD_MESSAGE) - { - if (smscb_data.cb_attributes[used].status EQ smscb_data.current_status) - list_menu_data->List[i].flagFunc = item_flag_none; - else - list_menu_data->List[i].flagFunc = item_flag_hide; - } - - i++; - number_multipg = 1; - - } - - // going through the link list & take the next cb message - used = smscb_data.cb_attributes[used].next_link; - - // only to be sure there is a ever ending loop - if (i > MAX_STORED_PAGES) - return NULL; - } - - + else if (smscb_data.current_status EQ UNREAD_MESSAGE) + { + if (smscb_data.cb_attributes[used].status EQ smscb_data.current_status) + list_menu_data->List[i].flagFunc = item_flag_none; + else + list_menu_data->List[i].flagFunc = item_flag_hide; + } + + i++; number_multipg = 1; - //fill up the last message of the fifo !! - if (smscb_data.cb_attributes[used].start_page EQ 0x55) - { - mnuInitDataItem(&list_menu_data->List[i]); - - //fill up the header - //"MID" + "available Page" + "Total page" - //the user release the uncomplete page about the available page. - /*SPR1920, allocate memory for header string*/ - if (smscb_data.cb_attributes[used].header == NULL) - smscb_data.cb_attributes[used].header = (char*)ALLOC_MEMORY(sizeof(char)*25); - sprintf(smscb_data.cb_attributes[used].header,"MID%d,%d/%d", smscb_data.cb_attributes[used].mid, - number_multipg, smscb_data.cb_attributes[used].pages); - - - list_menu_data->List[i].str =(char *) smscb_data.cb_attributes[used].header; - - //set item to visible - if (smscb_data.current_status EQ ALL_MESSAGE) - { - //show all the cb messages - list_menu_data->List[i].flagFunc = item_flag_none; - } - else if (smscb_data.current_status EQ UNREAD_MESSAGE) - { - if (smscb_data.cb_attributes[used].status EQ smscb_data.current_status) - list_menu_data->List[i].flagFunc = item_flag_none; - else - list_menu_data->List[i].flagFunc = item_flag_hide; - } - } - - - - + } + + // going through the link list & take the next cb message + used = smscb_data.cb_attributes[used].next_link; + + // only to be sure there is a ever ending loop + if (i > MAX_STORED_PAGES) + return NULL; + } + + number_multipg = 1; + + //fill up the last message of the fifo !! + if (smscb_data.cb_attributes[used].start_page EQ 0x55) + { + mnuInitDataItem(&list_menu_data->List[i]); + + //fill up the header + //"MID" + "available Page" + "Total page" + //the user release the uncomplete page about the available page. + /*SPR1920, allocate memory for header string*/ + if (smscb_data.cb_attributes[used].header == NULL) + smscb_data.cb_attributes[used].header = (char*)ALLOC_MEMORY(sizeof(char)*25); + sprintf(smscb_data.cb_attributes[used].header,"MID%d,%d/%d", smscb_data.cb_attributes[used].mid, + number_multipg, smscb_data.cb_attributes[used].pages); + + list_menu_data->List[i].str =(char *) smscb_data.cb_attributes[used].header; + + //set item to visible + if (smscb_data.current_status EQ ALL_MESSAGE) + { + //show all the cb messages + list_menu_data->List[i].flagFunc = item_flag_none; + } + else if (smscb_data.current_status EQ UNREAD_MESSAGE) + { + if (smscb_data.cb_attributes[used].status EQ smscb_data.current_status) + list_menu_data->List[i].flagFunc = item_flag_none; + else + list_menu_data->List[i].flagFunc = item_flag_hide; + } + } /* * Fill common parameter for list handling */ - list_menu_data->ListLength = number; list_menu_data->ListPosition = 1; list_menu_data->CursorPosition = 1; @@ -4028,69 +3778,64 @@ static void sms_cb_list_cb(T_MFW_HND win, ListMenuData * ListData) { - UBYTE number, selected_postion; - int i;/*SPR 1920*/ - - - TRACE_FUNCTION ("sms_cb_list_cb()"); + UBYTE number, selected_postion; + int i;/*SPR 1920*/ + + TRACE_FUNCTION ("sms_cb_list_cb()"); switch (ListData->Reason) { - case LISTS_REASON_SELECT: /* */ - - - // - selected_postion = sms_cb_give_position_of_msg (smscb_data.used_pointer, ListData->ListPosition); - - - //display the selected message on the scree - sms_cb_show_cb_message (selected_postion); - - - //destroy the list menu - listsDestroy(ListData->win); - - //counted the total number of cb msg before created the menu list - number = smscb_data.total_number; - - - FREE_MEMORY ((UBYTE *)smscb_data.cb_list_attributes->List, number * sizeof (T_MFW_MNU_ITEM)); - FREE_MEMORY ((UBYTE *)smscb_data.cb_list_attributes, sizeof (ListMenuData)); - /* SPR 1920 if any memory alloacted for list headers, deallocate it*/ - for(i=0; i<MAX_MIDS;i++) - { if (smscb_data.cb_attributes[i].header != NULL) - { FREE_MEMORY((void*)smscb_data.cb_attributes[i].header,sizeof(char)*25); - smscb_data.cb_attributes[i].header = NULL; - } + case LISTS_REASON_SELECT: /* */ + + selected_postion = sms_cb_give_position_of_msg (smscb_data.used_pointer, ListData->ListPosition); + + //display the selected message on the scree + sms_cb_show_cb_message (selected_postion); + + //destroy the list menu + listsDestroy(ListData->win); + + //counted the total number of cb msg before created the menu list + number = smscb_data.total_number; + + FREE_MEMORY ((UBYTE *)smscb_data.cb_list_attributes->List, number * sizeof (T_MFW_MNU_ITEM)); + FREE_MEMORY ((UBYTE *)smscb_data.cb_list_attributes, sizeof (ListMenuData)); + /* SPR 1920 if any memory alloacted for list headers, deallocate it*/ + for(i=0; i<MAX_MIDS;i++) + { + if (smscb_data.cb_attributes[i].header != NULL) + { + FREE_MEMORY((void*)smscb_data.cb_attributes[i].header,sizeof(char)*25); + smscb_data.cb_attributes[i].header = NULL; } - break; - - case LISTS_REASON_BACK: /* back to previous menu */ - - TRACE_EVENT("pressed Back-key"); - - //destroy the list menu - listsDestroy(ListData->win); - - //counted the total number of cb msg before created the menu list - number = smscb_data.total_number; - - FREE_MEMORY ((UBYTE *)smscb_data.cb_list_attributes->List, number * sizeof (T_MFW_MNU_ITEM)); - FREE_MEMORY ((UBYTE *)smscb_data.cb_list_attributes, sizeof (ListMenuData)); - /* SPR 1920 if any memory alloacted for list headers, deallocate it*/ - for(i=0; i<MAX_MIDS;i++) - { if (smscb_data.cb_attributes[i].header != NULL) - { FREE_MEMORY((void*)smscb_data.cb_attributes[i].header,sizeof(char)*25); - smscb_data.cb_attributes[i].header = NULL; - } + } + break; + + case LISTS_REASON_BACK: /* back to previous menu */ + + TRACE_EVENT("pressed Back-key"); + + //destroy the list menu + listsDestroy(ListData->win); + + //counted the total number of cb msg before created the menu list + number = smscb_data.total_number; + + FREE_MEMORY ((UBYTE *)smscb_data.cb_list_attributes->List, number * sizeof (T_MFW_MNU_ITEM)); + FREE_MEMORY ((UBYTE *)smscb_data.cb_list_attributes, sizeof (ListMenuData)); + /* SPR 1920 if any memory alloacted for list headers, deallocate it*/ + for(i=0; i<MAX_MIDS;i++) + { + if (smscb_data.cb_attributes[i].header != NULL) + { + FREE_MEMORY((void*)smscb_data.cb_attributes[i].header,sizeof(char)*25); + smscb_data.cb_attributes[i].header = NULL; } - break; - default: + } + break; + default: return; } - - - } @@ -4107,113 +3852,111 @@ *******************************************************************************/ void sms_cb_show_cb_message(UBYTE link_list_position) { - T_MFW_HND win = mfwParent(mfw_header()); #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; + T_EDITOR_DATA editor_data; #endif - UBYTE number_multipg =1, temp, next_used; - - //char buf[60]; - - next_used = link_list_position; - - //check : is it the end of the link list - //if yes, not necassary to go through the link list - if (smscb_data.cb_attributes[next_used].next_link NEQ 0xFF) - { - // going through the link list - next_used = smscb_data.cb_attributes[next_used].next_link; - } - - //if the multipage contain more than one page, find out - //how many pages ! - //This is counting the number of pages belongs to a multipage - //Every multipage & singlepge starts with the indication 0x55 - while(smscb_data.cb_attributes[next_used].start_page NEQ 0x55) - { - //sprintf(buf, "number_multipg %d", number_multipg); - //TRACE_EVENT(buf); - - number_multipg++; - - if (smscb_data.cb_attributes[next_used].next_link EQ 0xFF) - break; - - // going through the link list & take the next cb message - next_used = smscb_data.cb_attributes[next_used].next_link; - } - - //sprintf(buf, "number_multipg %d after..", number_multipg); + UBYTE number_multipg =1, temp, next_used; + + //char buf[60]; + + next_used = link_list_position; + + //check : is it the end of the link list + //if yes, not necassary to go through the link list + if (smscb_data.cb_attributes[next_used].next_link NEQ 0xFF) + { + // going through the link list + next_used = smscb_data.cb_attributes[next_used].next_link; + } + + //if the multipage contain more than one page, find out + //how many pages ! + //This is counting the number of pages belongs to a multipage + //Every multipage & singlepge starts with the indication 0x55 + while(smscb_data.cb_attributes[next_used].start_page NEQ 0x55) + { + //sprintf(buf, "number_multipg %d", number_multipg); //TRACE_EVENT(buf); - //keep the value for later - smscb_data.multipage_number = number_multipg; - - sms_cb_loadEditDefault(&editor_data); - - //buffer for the multipage - smscb_data.multipage = (UBYTE *) ALLOC_MEMORY (OFFSET(smscb_data.multipage_number) * sizeof (UBYTE)); - - next_used = link_list_position; - - //fill up the new buffer with the first page + number_multipg++; + + if (smscb_data.cb_attributes[next_used].next_link EQ 0xFF) + break; + + // going through the link list & take the next cb message + next_used = smscb_data.cb_attributes[next_used].next_link; + } + + //sprintf(buf, "number_multipg %d after..", number_multipg); + //TRACE_EVENT(buf); + + //keep the value for later + smscb_data.multipage_number = number_multipg; + + sms_cb_loadEditDefault(&editor_data); + + //buffer for the multipage + smscb_data.multipage = (UBYTE *) ALLOC_MEMORY (OFFSET(smscb_data.multipage_number) * sizeof (UBYTE)); + + next_used = link_list_position; + + //fill up the new buffer with the first page + /*MC SPR 1920, refer to new message array*/ + strcat((char *)smscb_data.multipage, smscb_data.messages[next_used]); + /*MC end*/ + //check : is it the end of the link list + //if yes, not necassary to go through the link list + if (smscb_data.cb_attributes[next_used].next_link NEQ 0xFF) + { + // going through the link list + next_used = smscb_data.cb_attributes[next_used].next_link; + } + + temp = smscb_data.multipage_number; + + //if the multipage contain more than one page, fill up the data + //to the new buffer + while(temp > 1) + { /*MC SPR 1920, refer to new message array*/ strcat((char *)smscb_data.multipage, smscb_data.messages[next_used]); /*MC end*/ - //check : is it the end of the link list - //if yes, not necassary to go through the link list - if (smscb_data.cb_attributes[next_used].next_link NEQ 0xFF) - { - // going through the link list - next_used = smscb_data.cb_attributes[next_used].next_link; - } - - temp = smscb_data.multipage_number; - - //if the multipage contain more than one page, fill up the data - //to the new buffer - while(temp > 1) - { - - /*MC SPR 1920, refer to new message array*/ - strcat((char *)smscb_data.multipage, smscb_data.messages[next_used]); - /*MC end*/ - - // going through the link list & take the next cb message - next_used = smscb_data.cb_attributes[next_used].next_link; - - temp --; - } - - //set the mark - smscb_data.cb_attributes[link_list_position].status = READ_MESSAGE; - - /* SPR#1428 - SH - New Editor changes */ + + // going through the link list & take the next cb message + next_used = smscb_data.cb_attributes[next_used].next_link; + + temp --; + } + + //set the mark + smscb_data.cb_attributes[link_list_position].status = READ_MESSAGE; + + /* SPR#1428 - SH - New Editor changes */ #ifdef NEW_EDITOR - AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, smscb_data.multipage, OFFSET(smscb_data.multipage_number)); - AUI_edit_SetEvents(&editor_data, link_list_position, TRUE, FOREVER, (T_AUI_EDIT_CB)sms_cb_editor_cb); - AUI_edit_SetTextStr(&editor_data, TxtDelete, TxtSoftBack, 0, NULL); - AUI_edit_SetAltTextStr(&editor_data, 0, TxtSoftOptions, FALSE, TxtNull); - AUI_edit_SetMode(&editor_data, ED_MODE_READONLY, ED_CURSOR_NONE); - AUI_edit_Start(win, &editor_data); + AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, smscb_data.multipage, OFFSET(smscb_data.multipage_number)); + AUI_edit_SetEvents(&editor_data, link_list_position, TRUE, FOREVER, (T_AUI_EDIT_CB)sms_cb_editor_cb); + AUI_edit_SetTextStr(&editor_data, TxtDelete, TxtSoftBack, 0, NULL); + AUI_edit_SetAltTextStr(&editor_data, 0, TxtSoftOptions, FALSE, TxtNull); + AUI_edit_SetMode(&editor_data, ED_MODE_READONLY, ED_CURSOR_NONE); + AUI_edit_Start(win, &editor_data); #else /* NEW_EDITOR */ - editor_data.editor_attr.text =(char *) smscb_data.multipage; - - editor_data.Identifier = link_list_position ; //keep the value (selected cb message) - editor_data.editor_attr.size = OFFSET(smscb_data.multipage_number); - editor_data.min_enter = 0; - editor_data.LeftSoftKey = TxtDelete; - editor_data.AlternateLeftSoftKey = TxtSoftOptions; - editor_data.RightSoftKey = TxtSoftBack; - editor_data.Callback = (T_EDIT_CB)sms_cb_editor_cb; - editor_data.mode = READ_ONLY_MODE; - - editor_start(win, &editor_data); /* start the editor */ + editor_data.editor_attr.text =(char *) smscb_data.multipage; + + editor_data.Identifier = link_list_position ; //keep the value (selected cb message) + editor_data.editor_attr.size = OFFSET(smscb_data.multipage_number); + editor_data.min_enter = 0; + editor_data.LeftSoftKey = TxtDelete; + editor_data.AlternateLeftSoftKey = TxtSoftOptions; + editor_data.RightSoftKey = TxtSoftBack; + editor_data.Callback = (T_EDIT_CB)sms_cb_editor_cb; + editor_data.mode = READ_ONLY_MODE; + + editor_start(win, &editor_data); /* start the editor */ #endif /* NEW_EDITOR */ } @@ -4223,7 +3966,7 @@ $Description: Configure T_EDITOR_DATA structure with default editor settings. - $Returns: none + $Returns: none $Arguments: editor_data - editor data. @@ -4232,28 +3975,28 @@ #ifdef NEW_EDITOR void sms_cb_loadEditDefault (T_AUI_EDITOR_DATA *editor_data) { - TRACE_FUNCTION ("sms_cb_loadEditDefault()"); - - AUI_edit_SetDefault(editor_data); - AUI_edit_SetMode(editor_data, ED_MODE_ALPHA, ED_CURSOR_NONE); - AUI_edit_SetTextStr(editor_data, TxtSoftSelect, TxtSoftBack, 0, NULL); - AUI_edit_SetDisplay(editor_data, 0, COLOUR_EDITOR, EDITOR_FONT); - - return; + TRACE_FUNCTION ("sms_cb_loadEditDefault()"); + + AUI_edit_SetDefault(editor_data); + AUI_edit_SetMode(editor_data, ED_MODE_ALPHA, ED_CURSOR_NONE); + AUI_edit_SetTextStr(editor_data, TxtSoftSelect, TxtSoftBack, 0, NULL); + AUI_edit_SetDisplay(editor_data, 0, COLOUR_EDITOR, EDITOR_FONT); + + return; } #else /* NEW_EDITOR */ void sms_cb_loadEditDefault (T_EDITOR_DATA *editor_data) { - TRACE_FUNCTION ("sms_cb_loadEditDefault()"); - - editor_attr_init(&editor_data->editor_attr, NULL, edtCurNone, 0, 0, 0, COLOUR_EDITOR); - editor_data_init(editor_data, NULL, TxtSoftSelect, TxtSoftBack, 0, 1, ALPHA_MODE, FOREVER); - editor_data->hide = FALSE; - editor_data->AlternateLeftSoftKey = TxtNull; - editor_data->Identifier = 0; - editor_data->TextString = NULL; - editor_data->destroyEditor = TRUE ; + TRACE_FUNCTION ("sms_cb_loadEditDefault()"); + + editor_attr_init(&editor_data->editor_attr, NULL, edtCurNone, 0, 0, 0, COLOUR_EDITOR); + editor_data_init(editor_data, NULL, TxtSoftSelect, TxtSoftBack, 0, 1, ALPHA_MODE, FOREVER); + editor_data->hide = FALSE; + editor_data->AlternateLeftSoftKey = TxtNull; + editor_data->Identifier = 0; + editor_data->TextString = NULL; + editor_data->destroyEditor = TRUE ; } #endif /* NEW_EDITOR */ @@ -4264,7 +4007,7 @@ $Description: callback function of the editor - $Returns: none + $Returns: none $Arguments: @@ -4289,7 +4032,6 @@ { case INFO_KCD_LEFT: - //user selected to delete the message sms_cb_delete_message (smscb_data.cb_attributes[Identifier].mid); @@ -4302,7 +4044,6 @@ smscb_data.used_pointer = 0xFF; } - if (smscb_data.current_status EQ ALL_MESSAGE) { //go back to the cb list @@ -4312,17 +4053,13 @@ { // if (sms_cb_count_unread_messages ()) // sms_cb_read_msg (smscb_data.current_status); - } - - break; case INFO_KCD_RIGHT: case INFO_KCD_HUP: - //only for tracing #ifdef DEBUG_SMS_CB /***************************Go-lite Optimization changes Start***********************/ @@ -4347,8 +4084,6 @@ /***************************Go-lite Optimization changes end***********************/ #endif //DEBUG_SMS_CB - - if (smscb_data.current_status EQ ALL_MESSAGE) { //go back to the cb list @@ -4368,6 +4103,3 @@ break; } } - - -