CellBroadcast.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:177k
源码类别:
MTK
开发平台:
C/C++
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * CellBroadcast.C
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * This file is intends for MMI SMS APP.
- *
- * Author:
- * -------
- * -------
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- /**
- * Copyright Notice
- * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
- * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
- * (It is illegal to remove this copyright notice from this software or any
- * portion of it)
- */
- /**************************************************************
- FILENAME : CellBroadcast.c
- PURPOSE : Cell Broadcast application
- REMARKS : nil
- AUTHOR : Hariprasad, Magesh k
- DATE : JAN 09,03
- **************************************************************/
- #ifdef __MOD_SMSAL__
- /* */
- #include "MMI_features.h"
- #include "stdC.h"
- #include "L4Dr1.h"
- #include "PixtelDataTypes.h"
- /* ... Add More MMI header */
- #include "EventsGprot.h"
- #include "HistoryGprot.h"
- #include "GlobalMenuItems.h"
- #include "GlobalConstants.h"
- #include "Globaldefs.h"
- #include "wgui_categories.h"
- #include "wgui_categories_inputs.h"
- #include "CustMenuRes.h"
- #include "CommonScreens.h"
- #include "Unicodexdcl.h"
- #include "TimerEvents.h"
- #include "DebugInitDef.h"
- #include "ProtocolEvents.h"
- /* ...Add MSG header */
- #include "customer_ps_inc.h"
- #include "mmi_msg_context.h"
- #include "MessagesL4Def.h"
- #include "MessagesResourceData.h"
- #include "MessagesMiscell.h"
- #include "MessagesExDcl.h"
- #include "SmsGuiInterfaceProt.h"
- #include "SMsGuiInterfaceType.h"
- #include "SmsPsHandler.h"
- #include "CellBroadcastType.h"
- /* */
- #include "Gui_ems.h"
- #include "wgui_ems.h"
- #include "GSM7BitDefaultAlphabet.h"
- /* */
- #include "NVRAMEnum.h"
- #include "NVRAMProt.h"
- #include "NVRAMType.h"
- #include "SettingProfile.h"
- #include "ProfileGprots.h"
- #include "SettingProt.h"
- #include "PhoneBookGprot.h"
- #include "GpioInc.h"
- #include "KeyBrd.h"
- #include "IdleAppDef.h"
- #include "CallManagementGprot.h"
- #ifdef MMI_ON_HARDWARE_P
- #include "nvram_user_defs.h"
- #endif
- #include "SMSApi.h"
- #include "SMSStruct.h" /* temp!! */
- /* */
- #ifndef NVRAM_SMS_CB_CHNL_RECORD_SIZE
- #define NVRAM_SMS_CB_CHNL_RECORD_SIZE 180
- #endif
- #ifndef NVRAM_SMS_CB_SMS_RECORD_SIZE
- /* MTK Joy modified for corrected NVRAM data size, 1207 */
- #define NVRAM_SMS_CB_SMS_RECORD_SIZE 826
- /* MTK end */
- #endif /* NVRAM_SMS_CB_SMS_RECORD_SIZE */
- //
- //MTK Joy added for multipage CB, 0113
- #define SWAP_USHORT(Var) *Var = *(unsigned short*)SwapEndian((void*)Var, sizeof(short))
- #ifndef NVRAM_SMS_CB_SMS_PAGE_SIZE
- #define NVRAM_SMS_CB_SMS_PAGE_SIZE 94
- #endif
- #ifndef NVRAM_SMS_CB_SMS_PAGE_NUM_TOTAL
- #define NVRAM_SMS_CB_SMS_PAGE_NUM_TOTAL 30
- #endif
- #ifndef NVRAM_SMS_CB_SMS_INFO_SIZE
- #define NVRAM_SMS_CB_SMS_INFO_SIZE 20
- #endif
- #define SMS_CB_SMS_PAGE_SIZE_UCS2 82
- /* MTK end */
- #define MESSAGES_CB_BOOTUP_TIMEOUT_DURATION 3000 /* 3 Seconds */
- static msg_cb_channel_nvram_struct cbNvramStruct;
- static U8 IsCBMessageReadOperRequired = TRUE;
- static msg_cb_msg_index_struct cbMsgIndex;
- static msg_cb_msg_info_struct cbMsgInfo;
- static msg_cb_msg_content_struct cbMsgContent[MAX_CB_MSG_TOTAL_PAGE][NVRAM_SMS_CB_SMS_PAGE_SIZE];
- static U8 *cbMsgStart;
- //#ifdef __MMI_MESSAGES_TWO_CB_MODES_DISPLAY__
- //static U16 kplLSKStringtID;
- //static U16 kplLSKIconID;
- //static U16 kplRSKStringID;
- //static U16 kplRSKIconID;
- //#endif
- static U8 dispCBMessage[NVRAM_SMS_CB_SMS_PAGE_SIZE * ENCODING_LENGTH * MAX_CB_MSG_PAGE];
- static U32 dispCBLength = 0;
- static U16 cbChnlEditorIcons[MAX_CB_CHNL_INLINE_ITEM] =
- {
- IMG_CB_CHNL_TITLE,
- IMG_SMS_COMMON_NOIMAGE,
- IMG_CB_CHNL_NUMBER,
- IMG_SMS_COMMON_NOIMAGE
- };
- const U16 cbDefaultChnlNameStrId[SMS_CB_MAX_ENTRY] =
- {
- STR_CB_CHNL_NAME_1,
- STR_CB_CHNL_NAME_2,
- STR_CB_CHNL_NAME_3,
- STR_CB_CHNL_NAME_4,
- STR_CB_CHNL_NAME_5,
- STR_CB_CHNL_NAME_6,
- STR_CB_CHNL_NAME_7,
- STR_CB_CHNL_NAME_8,
- STR_CB_CHNL_NAME_9,
- STR_CB_CHNL_NAME_10,
- STR_CB_CHNL_NAME_11,
- STR_CB_CHNL_NAME_12,
- STR_CB_CHNL_NAME_13,
- STR_CB_CHNL_NAME_14,
- STR_CB_CHNL_NAME_15,
- STR_CB_CHNL_NAME_16,
- STR_CB_CHNL_NAME_17,
- STR_CB_CHNL_NAME_18,
- STR_CB_CHNL_NAME_19,
- STR_CB_CHNL_NAME_20,
- STR_CB_CHNL_NAME_21,
- STR_CB_CHNL_NAME_22,
- STR_CB_CHNL_NAME_23,
- STR_CB_CHNL_NAME_24,
- STR_CB_CHNL_NAME_25,
- STR_CB_CHNL_NAME_26,
- STR_CB_CHNL_NAME_27,
- STR_CB_CHNL_NAME_28,
- STR_CB_CHNL_NAME_29,
- STR_CB_CHNL_NAME_30,
- STR_CB_CHNL_NAME_31,
- STR_CB_CHNL_NAME_32,
- STR_CB_CHNL_NAME_33,
- STR_CB_CHNL_NAME_34,
- STR_CB_CHNL_NAME_35,
- STR_CB_CHNL_NAME_36,
- STR_CB_CHNL_NAME_37,
- STR_CB_CHNL_NAME_38,
- STR_CB_CHNL_NAME_39,
- STR_CB_CHNL_NAME_40,
- };
- /* */
- /**************************************************************
- revised part--variable
- **************************************************************/
- static msg_cb_info_struct cb_info;
- static msg_cb_state_enum cb_state;
- static msg_cb_display_struct cb_display;
- extern wgui_inline_item wgui_inline_items[];
- /*************************************************************
- Cb language
- *************************************************************/
- const U32 LangEnumAndStrID[MAX_LANG_SUPPORT][2] =
- {
- {MMI_CBS0_GERMAN, STR_LANG_GERMAN},
- {MMI_CBS0_ENGLISH, STR_LANG_ENGLISH},
- {MMI_CBS0_ITALIAN, STR_LANG_ITALIAN},
- {MMI_CBS0_FRENCH, STR_LANG_FRENCH},
- {MMI_CBS0_SPANISH, STR_LANG_SPANISH},
- {MMI_CBS0_DUTCH, STR_LANG_DUTCH},
- {MMI_CBS0_SWEDISH, STR_LANG_SWEDISH},
- {MMI_CBS0_DANISH, STR_LANG_DANISH},
- {MMI_CBS0_PORTUGUESE, STR_LANG_PORTUGUESE},
- {MMI_CBS0_FINNISH, STR_LANG_FINNISH},
- {MMI_CBS0_NORWEGIAN, STR_LANG_NORWEGIAN},
- {MMI_CBS0_GREEK, STR_LANG_GREEK},
- {MMI_CBS0_TURKISH, STR_LANG_TURKISH},
- {MMI_CBS0_HUNGARIAN, STR_LANG_HUNGARIAN},
- {MMI_CBS0_POLISH, STR_LANG_POLISH},
- {MMI_CBS0_LANG_UNSPECIFIED, STR103_MITEM103_CB_LANGUAGE_UNSPECIFIED},
- {MMI_CBS1_CZECH, STR_LANG_CZECH},
- {MMI_CBS1_HEBREW, STR_LANG_HEBREW},
- {MMI_CBS1_ARABIC, STR_LANG_ARABIC},
- {MMI_CBS1_RUSSIAN, STR_LANG_RUSSIAN},
- {MMI_CBS2_AA, STR_LANG_AFAR},
- {MMI_CBS2_AB, STR_LANG_ABKHAZIAN},
- {MMI_CBS2_AF, STR_LANG_AFRIKAANS},
- {MMI_CBS2_AM, STR_LANG_AMHARIC},
- {MMI_CBS2_AR, STR_LANG_ARABIC},
- {MMI_CBS2_AS, STR_LANG_ASSAMESE},
- {MMI_CBS2_AY, STR_LANG_AYMARA},
- {MMI_CBS2_AZ, STR_LANG_AZERBAIJANI},
- {MMI_CBS2_BA, STR_LANG_BASHKIR},
- {MMI_CBS2_BE, STR_LANG_BYELORUSSIAN},
- {MMI_CBS2_BG, STR_LANG_BULGARIAN},
- {MMI_CBS2_BH, STR_LANG_BIHARI},
- {MMI_CBS2_BI, STR_LANG_BISLAMA},
- {MMI_CBS2_BN, STR_LANG_BENGALI},
- {MMI_CBS2_BO, STR_LANG_TIBETAN},
- {MMI_CBS2_BR, STR_LANG_BRETON},
- {MMI_CBS2_CA, STR_LANG_CATALAN},
- {MMI_CBS2_CO, STR_LANG_CORSICAN},
- {MMI_CBS2_CS, STR_LANG_CZECH},
- {MMI_CBS2_CY, STR_LANG_WELSH},
- {MMI_CBS2_DA, STR_LANG_DANISH},
- {MMI_CBS2_DE, STR_LANG_GERMAN},
- {MMI_CBS2_DZ, STR_LANG_BHUTANI},
- {MMI_CBS2_EL, STR_LANG_GREEK},
- {MMI_CBS2_EN, STR_LANG_ENGLISH},
- {MMI_CBS2_EO, STR_LANG_ESPERANTO},
- {MMI_CBS2_ES, STR_LANG_SPANISH},
- {MMI_CBS2_ET, STR_LANG_ESTONIAN},
- {MMI_CBS2_EU, STR_LANG_BASQUE},
- {MMI_CBS2_FA, STR_LANG_PERSIAN},
- {MMI_CBS2_FI, STR_LANG_FINNISH},
- {MMI_CBS2_FJ, STR_LANG_FIJI},
- {MMI_CBS2_FO, STR_LANG_FAROESE},
- {MMI_CBS2_FR, STR_LANG_FRENCH},
- {MMI_CBS2_FY, STR_LANG_FRISIAN},
- {MMI_CBS2_GA, STR_LANG_IRISH},
- {MMI_CBS2_GD, STR_LANG_SCOTS_GAELIC},
- {MMI_CBS2_GL, STR_LANG_GALICIAN},
- {MMI_CBS2_GN, STR_LANG_GUARANI},
- {MMI_CBS2_GU, STR_LANG_GUJARATI},
- {MMI_CBS2_HA, STR_LANG_HAUSA},
- {MMI_CBS2_HE, STR_LANG_HEBREW},
- {MMI_CBS2_HI, STR_LANG_HINDI},
- {MMI_CBS2_HR, STR_LANG_CROATIAN},
- {MMI_CBS2_HU, STR_LANG_HUNGARIAN},
- {MMI_CBS2_HY, STR_LANG_ARMENIAN},
- {MMI_CBS2_IA, STR_LANG_INTERLINGUA},
- {MMI_CBS2_ID, STR_LANG_INDONESIAN},
- {MMI_CBS2_IE, STR_LANG_INTERLINGUE},
- {MMI_CBS2_IK, STR_LANG_INUPIAK},
- {MMI_CBS2_IS, STR_LANG_ICELANDIC},
- {MMI_CBS2_IT, STR_LANG_ITALIAN},
- {MMI_CBS2_IU, STR_LANG_INUKTITUT},
- {MMI_CBS2_JA, STR_LANG_JAPANESE},
- {MMI_CBS2_JW, STR_LANG_JAVANESE},
- {MMI_CBS2_KA, STR_LANG_GEORGIAN},
- {MMI_CBS2_KK, STR_LANG_KAZAKH},
- {MMI_CBS2_KL, STR_LANG_GREENLANDIC},
- {MMI_CBS2_KM, STR_LANG_CAMBODIAN},
- {MMI_CBS2_KN, STR_LANG_KANNADA},
- {MMI_CBS2_KO, STR_LANG_KOREAN},
- {MMI_CBS2_KS, STR_LANG_KASHMIRI},
- {MMI_CBS2_KU, STR_LANG_KURDISH},
- {MMI_CBS2_KY, STR_LANG_KIRGHIZ},
- {MMI_CBS2_LA, STR_LANG_LATIN},
- {MMI_CBS2_LN, STR_LANG_LINGALA},
- {MMI_CBS2_LO, STR_LANG_LAOTHIAN},
- {MMI_CBS2_LT, STR_LANG_LITHUANIAN},
- {MMI_CBS2_LV, STR_LANG_LATVIAN},
- {MMI_CBS2_MG, STR_LANG_MALAGASY},
- {MMI_CBS2_MI, STR_LANG_MAORI},
- {MMI_CBS2_MK, STR_LANG_MACEDONIAN},
- {MMI_CBS2_ML, STR_LANG_MALAYALAM},
- {MMI_CBS2_MN, STR_LANG_MONGOLIAN},
- {MMI_CBS2_MO, STR_LANG_MOLDAVIAN},
- {MMI_CBS2_MR, STR_LANG_MARATHI},
- {MMI_CBS2_MS, STR_LANG_MALAY},
- {MMI_CBS2_MT, STR_LANG_MALTESE},
- {MMI_CBS2_MY, STR_LANG_BURMESE},
- {MMI_CBS2_NA, STR_LANG_NAURU},
- {MMI_CBS2_NE, STR_LANG_NEPALI},
- {MMI_CBS2_NL, STR_LANG_DUTCH},
- {MMI_CBS2_NO, STR_LANG_NORWEGIAN},
- {MMI_CBS2_OC, STR_LANG_OCCITAN},
- {MMI_CBS2_OM, STR_LANG_OROMO},
- {MMI_CBS2_OR, STR_LANG_ORIYA},
- {MMI_CBS2_PA, STR_LANG_PUNJABI},
- {MMI_CBS2_PL, STR_LANG_POLISH},
- {MMI_CBS2_PS, STR_LANG_PASHTO},
- {MMI_CBS2_PT, STR_LANG_PORTUGUESE},
- {MMI_CBS2_QU, STR_LANG_QUECHUA},
- {MMI_CBS2_RM, STR_LANG_RHAETO_ROMANCE},
- {MMI_CBS2_RN, STR_LANG_KIRUNDI},
- {MMI_CBS2_RO, STR_LANG_ROMANIAN},
- {MMI_CBS2_RU, STR_LANG_RUSSIAN},
- {MMI_CBS2_RW, STR_LANG_KINYARWANDA},
- {MMI_CBS2_SA, STR_LANG_SANSKRIT},
- {MMI_CBS2_SD, STR_LANG_SINDHI},
- {MMI_CBS2_SG, STR_LANG_SANGHO},
- {MMI_CBS2_SH, STR_LANG_SERBO_CROATIAN},
- {MMI_CBS2_SI, STR_LANG_SINHALESE},
- {MMI_CBS2_SK, STR_LANG_SLOVAK},
- {MMI_CBS2_SL, STR_LANG_SLOVENIAN},
- {MMI_CBS2_SM, STR_LANG_SAMOAN},
- {MMI_CBS2_SN, STR_LANG_SHONA},
- {MMI_CBS2_SO, STR_LANG_SOMALI},
- {MMI_CBS2_SQ, STR_LANG_ALBANIAN},
- {MMI_CBS2_SR, STR_LANG_SERBIAN},
- {MMI_CBS2_SS, STR_LANG_SISWATI},
- {MMI_CBS2_ST, STR_LANG_SESOTHO},
- {MMI_CBS2_SU, STR_LANG_SUNDANESE},
- {MMI_CBS2_SV, STR_LANG_SWEDISH},
- {MMI_CBS2_SW, STR_LANG_SWAHILI},
- {MMI_CBS2_TA, STR_LANG_TAMIL},
- {MMI_CBS2_TE, STR_LANG_TELUGU},
- {MMI_CBS2_TG, STR_LANG_TAJIK},
- {MMI_CBS2_TH, STR_LANG_THAI},
- {MMI_CBS2_TI, STR_LANG_TIGRINYA},
- {MMI_CBS2_TK, STR_LANG_TURKMEN},
- {MMI_CBS2_TL, STR_LANG_TAGALOG},
- {MMI_CBS2_TN, STR_LANG_SETSWANA},
- {MMI_CBS2_TO, STR_LANG_TONGA},
- {MMI_CBS2_TR, STR_LANG_TURKISH},
- {MMI_CBS2_TS, STR_LANG_TSONGA},
- {MMI_CBS2_TT, STR_LANG_TATAR},
- {MMI_CBS2_TW, STR_LANG_TWI},
- {MMI_CBS2_UG, STR_LANG_UIGHUR},
- {MMI_CBS2_UK, STR_LANG_UKRAINIAN},
- {MMI_CBS2_UR, STR_LANG_URDU},
- {MMI_CBS2_UZ, STR_LANG_UZBEK},
- {MMI_CBS2_VI, STR_LANG_VIETNAMESE},
- {MMI_CBS2_VO, STR_LANG_VOLAPUK},
- {MMI_CBS2_WO, STR_LANG_WOLOF},
- {MMI_CBS2_XH, STR_LANG_XHOSA},
- {MMI_CBS2_YI, STR_LANG_YIDDISH},
- {MMI_CBS2_YO, STR_LANG_YORUBA},
- {MMI_CBS2_ZA, STR_LANG_ZHUANG},
- {MMI_CBS2_ZH, STR_LANG_CHINESE},
- {MMI_CBS2_ZU, STR_LANG_ZULU},
- {MMI_CBS_INVALID, 0}
- };
- /*****************************************************************************
- * FUNCTION
- * MMICbsDecodeLang
- * DESCRIPTION
- * Decode CB language
- * PARAMETERS
- * char1 [IN] Char 1
- * char2 [IN] Char 2
- * lang_type [IN/OUT] Language type
- * RETURNS
- * void
- *****************************************************************************/
- void MMICbsDecodeLang(U8 char1, U8 char2, msg_cb_lang_enum *lang_type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *lang_type = MMI_CBS_INVALID;
- switch (char1)
- {
- case 'a':
- switch (char2)
- {
- case 'a':
- *lang_type = MMI_CBS2_AA;
- break;
- case 'b':
- *lang_type = MMI_CBS2_AB;
- break;
- case 'f':
- *lang_type = MMI_CBS2_AF;
- break;
- case 'm':
- *lang_type = MMI_CBS2_AM;
- break;
- case 'r':
- *lang_type = MMI_CBS2_AR;
- break;
- case 's':
- *lang_type = MMI_CBS2_AS;
- break;
- case 'y':
- *lang_type = MMI_CBS2_AY;
- break;
- case 'z':
- *lang_type = MMI_CBS2_AZ;
- break;
- }
- break;
- case 'b':
- switch (char2)
- {
- case 'a':
- *lang_type = MMI_CBS2_BA;
- break;
- case 'e':
- *lang_type = MMI_CBS2_BE;
- break;
- case 'g':
- *lang_type = MMI_CBS2_BG;
- break;
- case 'h':
- *lang_type = MMI_CBS2_BH;
- break;
- case 'i':
- *lang_type = MMI_CBS2_BI;
- break;
- case 'n':
- *lang_type = MMI_CBS2_BN;
- break;
- case 'o':
- *lang_type = MMI_CBS2_BO;
- break;
- case 'r':
- *lang_type = MMI_CBS2_BR;
- break;
- }
- break;
- case 'c':
- switch (char2)
- {
- case 'a':
- *lang_type = MMI_CBS2_CA;
- break;
- case 'o':
- *lang_type = MMI_CBS2_CO;
- break;
- case 's':
- *lang_type = MMI_CBS2_CS;
- break;
- case 'y':
- *lang_type = MMI_CBS2_CY;
- break;
- }
- break;
- case 'd':
- switch (char2)
- {
- case 'a':
- *lang_type = MMI_CBS2_DA;
- break;
- case 'e':
- *lang_type = MMI_CBS2_DE;
- break;
- case 'z':
- *lang_type = MMI_CBS2_DZ;
- break;
- }
- break;
- case 'e':
- switch (char2)
- {
- case 'l':
- *lang_type = MMI_CBS2_EL;
- break;
- case 'n':
- *lang_type = MMI_CBS2_EN;
- break;
- case 'o':
- *lang_type = MMI_CBS2_EO;
- break;
- case 's':
- *lang_type = MMI_CBS2_ES;
- break;
- case 't':
- *lang_type = MMI_CBS2_ET;
- break;
- case 'u':
- *lang_type = MMI_CBS2_EU;
- break;
- }
- break;
- case 'f':
- switch (char2)
- {
- case 'a':
- *lang_type = MMI_CBS2_FA;
- break;
- case 'i':
- *lang_type = MMI_CBS2_FI;
- break;
- case 'j':
- *lang_type = MMI_CBS2_FJ;
- break;
- case 'o':
- *lang_type = MMI_CBS2_FO;
- break;
- case 'r':
- *lang_type = MMI_CBS2_FR;
- break;
- case 'y':
- *lang_type = MMI_CBS2_FY;
- break;
- }
- break;
- case 'g':
- switch (char2)
- {
- case 'a':
- *lang_type = MMI_CBS2_GA;
- break;
- case 'd':
- *lang_type = MMI_CBS2_GD;
- break;
- case 'l':
- *lang_type = MMI_CBS2_GL;
- break;
- case 'n':
- *lang_type = MMI_CBS2_GN;
- break;
- case 'u':
- *lang_type = MMI_CBS2_GU;
- break;
- }
- break;
- case 'h':
- switch (char2)
- {
- case 'a':
- *lang_type = MMI_CBS2_HA;
- break;
- case 'e':
- *lang_type = MMI_CBS2_HE;
- break;
- case 'i':
- *lang_type = MMI_CBS2_HI;
- break;
- case 'r':
- *lang_type = MMI_CBS2_HR;
- break;
- case 'u':
- *lang_type = MMI_CBS2_HU;
- break;
- case 'y':
- *lang_type = MMI_CBS2_HY;
- break;
- }
- break;
- case 'i':
- switch (char2)
- {
- case 'a':
- *lang_type = MMI_CBS2_IA;
- break;
- case 'd':
- *lang_type = MMI_CBS2_ID;
- break;
- case 'e':
- *lang_type = MMI_CBS2_IE;
- break;
- case 'k':
- *lang_type = MMI_CBS2_IK;
- break;
- case 's':
- *lang_type = MMI_CBS2_IS;
- break;
- case 't':
- *lang_type = MMI_CBS2_IT;
- break;
- case 'u':
- *lang_type = MMI_CBS2_IU;
- break;
- }
- break;
- case 'j':
- switch (char2)
- {
- case 'a':
- *lang_type = MMI_CBS2_JA;
- break;
- case 'w':
- *lang_type = MMI_CBS2_JW;
- break;
- }
- break;
- case 'k':
- switch (char2)
- {
- case 'a':
- *lang_type = MMI_CBS2_KA;
- break;
- case 'k':
- *lang_type = MMI_CBS2_KK;
- break;
- case 'l':
- *lang_type = MMI_CBS2_KL;
- break;
- case 'm':
- *lang_type = MMI_CBS2_KM;
- break;
- case 'n':
- *lang_type = MMI_CBS2_KN;
- break;
- case 'o':
- *lang_type = MMI_CBS2_KO;
- break;
- case 's':
- *lang_type = MMI_CBS2_KS;
- break;
- case 'u':
- *lang_type = MMI_CBS2_KU;
- break;
- case 'y':
- *lang_type = MMI_CBS2_KY;
- break;
- }
- break;
- case 'l':
- switch (char2)
- {
- case 'a':
- *lang_type = MMI_CBS2_LA;
- break;
- case 'n':
- *lang_type = MMI_CBS2_LN;
- break;
- case 'o':
- *lang_type = MMI_CBS2_LO;
- break;
- case 't':
- *lang_type = MMI_CBS2_LT;
- break;
- case 'v':
- *lang_type = MMI_CBS2_LV;
- break;
- }
- break;
- case 'm':
- switch (char2)
- {
- case 'g':
- *lang_type = MMI_CBS2_MG;
- break;
- case 'i':
- *lang_type = MMI_CBS2_MI;
- break;
- case 'k':
- *lang_type = MMI_CBS2_MK;
- break;
- case 'l':
- *lang_type = MMI_CBS2_ML;
- break;
- case 'n':
- *lang_type = MMI_CBS2_MN;
- break;
- case 'o':
- *lang_type = MMI_CBS2_MO;
- break;
- case 'r':
- *lang_type = MMI_CBS2_MR;
- break;
- case 's':
- *lang_type = MMI_CBS2_MS;
- break;
- case 't':
- *lang_type = MMI_CBS2_MT;
- break;
- case 'y':
- *lang_type = MMI_CBS2_MY;
- break;
- }
- break;
- case 'n':
- switch (char2)
- {
- case 'a':
- *lang_type = MMI_CBS2_NA;
- break;
- case 'e':
- *lang_type = MMI_CBS2_NE;
- break;
- case 'l':
- *lang_type = MMI_CBS2_NL;
- break;
- case 'o':
- *lang_type = MMI_CBS2_NO;
- break;
- }
- break;
- case 'o':
- switch (char2)
- {
- case 'c':
- *lang_type = MMI_CBS2_OC;
- break;
- case 'm':
- *lang_type = MMI_CBS2_OM;
- break;
- case 'r':
- *lang_type = MMI_CBS2_OR;
- break;
- }
- break;
- case 'p':
- switch (char2)
- {
- case 'a':
- *lang_type = MMI_CBS2_PA;
- break;
- case 'l':
- *lang_type = MMI_CBS2_PL;
- break;
- case 's':
- *lang_type = MMI_CBS2_PS;
- break;
- case 't':
- *lang_type = MMI_CBS2_PT;
- break;
- }
- break;
- case 'q':
- switch (char2)
- {
- case 'u':
- *lang_type = MMI_CBS2_QU;
- break;
- }
- break;
- case 'r':
- switch (char2)
- {
- case 'm':
- *lang_type = MMI_CBS2_RM;
- break;
- case 'n':
- *lang_type = MMI_CBS2_RN;
- break;
- case 'o':
- *lang_type = MMI_CBS2_RO;
- break;
- case 'u':
- *lang_type = MMI_CBS2_RU;
- break;
- case 'w':
- *lang_type = MMI_CBS2_RW;
- break;
- }
- break;
- case 's':
- switch (char2)
- {
- case 'a':
- *lang_type = MMI_CBS2_SA;
- break;
- case 'd':
- *lang_type = MMI_CBS2_SD;
- break;
- case 'g':
- *lang_type = MMI_CBS2_SG;
- break;
- case 'h':
- *lang_type = MMI_CBS2_SH;
- break;
- case 'i':
- *lang_type = MMI_CBS2_SI;
- break;
- case 'k':
- *lang_type = MMI_CBS2_SK;
- break;
- case 'l':
- *lang_type = MMI_CBS2_SL;
- break;
- case 'm':
- *lang_type = MMI_CBS2_SM;
- break;
- case 'n':
- *lang_type = MMI_CBS2_SN;
- break;
- case 'o':
- *lang_type = MMI_CBS2_SO;
- break;
- case 'q':
- *lang_type = MMI_CBS2_SQ;
- break;
- case 'r':
- *lang_type = MMI_CBS2_SR;
- break;
- case 's':
- *lang_type = MMI_CBS2_SS;
- break;
- case 't':
- *lang_type = MMI_CBS2_ST;
- break;
- case 'u':
- *lang_type = MMI_CBS2_SU;
- break;
- case 'v':
- *lang_type = MMI_CBS2_SV;
- break;
- case 'w':
- *lang_type = MMI_CBS2_SW;
- break;
- }
- break;
- case 't':
- switch (char2)
- {
- case 'a':
- *lang_type = MMI_CBS2_TA;
- break;
- case 'e':
- *lang_type = MMI_CBS2_TE;
- break;
- case 'g':
- *lang_type = MMI_CBS2_TG;
- break;
- case 'h':
- *lang_type = MMI_CBS2_TH;
- break;
- case 'i':
- *lang_type = MMI_CBS2_TI;
- break;
- case 'k':
- *lang_type = MMI_CBS2_TK;
- break;
- case 'l':
- *lang_type = MMI_CBS2_TL;
- break;
- case 'n':
- *lang_type = MMI_CBS2_TN;
- break;
- case 'o':
- *lang_type = MMI_CBS2_TO;
- break;
- case 'r':
- *lang_type = MMI_CBS2_TR;
- break;
- case 's':
- *lang_type = MMI_CBS2_TS;
- break;
- case 't':
- *lang_type = MMI_CBS2_TT;
- break;
- case 'w':
- *lang_type = MMI_CBS2_TW;
- break;
- }
- break;
- case 'u':
- switch (char2)
- {
- case 'g':
- *lang_type = MMI_CBS2_UG;
- break;
- case 'k':
- *lang_type = MMI_CBS2_UK;
- break;
- case 'r':
- *lang_type = MMI_CBS2_UR;
- break;
- case 'z':
- *lang_type = MMI_CBS2_UZ;
- break;
- }
- break;
- case 'v':
- switch (char2)
- {
- case 'i':
- *lang_type = MMI_CBS2_VI;
- break;
- case 'o':
- *lang_type = MMI_CBS2_VO;
- break;
- }
- break;
- case 'w':
- switch (char2)
- {
- case 'o':
- *lang_type = MMI_CBS2_WO;
- break;
- }
- break;
- case 'x':
- switch (char2)
- {
- case 'h':
- *lang_type = MMI_CBS2_XH;
- break;
- }
- break;
- case 'y':
- switch (char2)
- {
- case 'i':
- *lang_type = MMI_CBS2_YI;
- break;
- case 'o':
- *lang_type = MMI_CBS2_YO;
- break;
- }
- break;
- case 'z':
- switch (char2)
- {
- case 'a':
- *lang_type = MMI_CBS2_ZA;
- break;
- case 'h':
- *lang_type = MMI_CBS2_ZH;
- break;
- case 'u':
- *lang_type = MMI_CBS2_ZU;
- break;
- }
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * DecodeCbsDcs
- * DESCRIPTION
- * Decode Cb DCS
- * PARAMETERS
- * dcs [IN] DCS
- * char1 [IN] Char 1
- * char2 [IN] Char 2
- * char3 [IN] Char 3
- * lang_type [IN/OUT] Language type
- * alphabet_type [IN/OUT] Alphabet type
- * msg_class [IN/OUT] Message class
- * is_compress [IN/OUT] Is compress
- * is_reserved [IN/OUT] Is reserved
- * RETURNS
- * skip character
- *****************************************************************************/
- U8 DecodeCbsDcs(
- U8 dcs,
- U8 char1,
- U8 char2,
- U8 char3,
- msg_cb_lang_enum *lang_type,
- smsal_dcs_enum *alphabet_type,
- msg_cb_class_enum *msg_class,
- pBOOL *is_compress,
- pBOOL *is_reserved)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- kal_uint8 coding_group = (dcs >> 4);
- kal_uint8 coding_bits = (dcs & 0x0f);
- kal_uint8 skip_char = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *lang_type = MMI_CBS0_LANG_UNSPECIFIED;
- *alphabet_type = SMSAL_DEFAULT_DCS;
- *msg_class = MMI_CBS_CLASS_UNSPECIFIED;
- *is_compress = KAL_FALSE;
- *is_reserved = KAL_FALSE;
- switch (coding_group)
- {
- case 0x00:
- *lang_type = (msg_cb_lang_enum) coding_bits;
- break;
- case 0x01:
- /*
- * GSM7: PS side already unpack
- * UCS2: PS side didn't unpack
- */
- if (coding_bits == 0) /* GSM7 */
- {
- if (char3 == 0x0d) /* CR */
- {
- MMICbsDecodeLang(char1, char2, lang_type);
- skip_char = 3;
- }
- }
- else if (coding_bits == 1) /* UCS2 */
- {
- *alphabet_type = SMSAL_UCS2_DCS;
- MMICbsDecodeLang((U8) (char1 & 0x7f), (U8) (((char2 & 0x3f) << 1) | ((char1 & 0x80) >> 7)), lang_type);
- skip_char = 2;
- }
- /* MTK end */
- else
- {
- *is_reserved = KAL_TRUE;
- }
- break;
- case 0x02:
- if (coding_bits < 0x04)
- {
- *lang_type = (msg_cb_lang_enum) (16 + coding_bits);
- }
- else
- {
- *is_reserved = KAL_TRUE;
- }
- break;
- case 0x03:
- *is_reserved = KAL_TRUE;
- break;
- case 0x04: /* General Data Coding Scheme */
- case 0x05:
- case 0x06:
- case 0x07:
- if ((coding_group & 0x02) != 0)
- {
- *is_compress = KAL_TRUE;
- }
- if ((coding_group & 0x01) == 0x01)
- {
- *msg_class = (msg_cb_class_enum) (dcs & 0x03);
- }
- *alphabet_type = (smsal_dcs_enum) (dcs & 0x0C);
- break;
- case 0x08: /* 0x08 - 0x0d: Reserved */
- case 0x09:
- case 0x0a:
- case 0x0b:
- case 0x0c:
- case 0x0d:
- *is_reserved = KAL_TRUE;
- break;
- case 0x0e: /* defined by WAP forum */
- break;
- case 0x0f: /* Data Coding/Message Class */
- *alphabet_type = (smsal_dcs_enum) (dcs & 0x04);
- *msg_class = (msg_cb_class_enum) (dcs & 0x03);
- break;
- default:
- break;
- }
- return skip_char;
- } /* end of DecodeCbsDcs */
- /*****************************************************************************
- * FUNCTION
- * DeleteCBMessage
- * DESCRIPTION
- * Delete CB message
- * PARAMETERS
- * index [IN] Index
- * RETURNS
- * delete length
- *****************************************************************************/
- U8 DeleteCBMessage(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i = 0;
- U8 deleteLen = cbMsgInfo.MsgPage[index];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* first, clear the content */
- memset(cbMsgIndex.pCBMsgContent[index], 0, cbMsgInfo.MsgPage[index] * NVRAM_SMS_CB_SMS_PAGE_SIZE);
- /* second, reset the info */
- cbMsgInfo.MsgDCS[index] = 0;
- cbMsgInfo.MsgPage[index] = 0;
- /* MTK Joy 0222 */
- cbMsgInfo.MsgMI[index] = SMS_CB_UNUSED_CBMI;
- //MTK end
- //third, compute the new index
- cbMsgIndex.currCBTotal--;
- /* forth, move the content and update the info */
- if (index < (cbMsgIndex.currCBTotal))
- {
- for (i = index; i < (cbMsgIndex.currCBTotal); i++)
- {
- memcpy(
- cbMsgIndex.pCBMsgContent[i],
- cbMsgIndex.pCBMsgContent[i + 1],
- cbMsgInfo.MsgPage[i + 1] * NVRAM_SMS_CB_SMS_PAGE_SIZE);
- cbMsgInfo.MsgDCS[i] = cbMsgInfo.MsgDCS[i + 1];
- cbMsgInfo.MsgPage[i] = cbMsgInfo.MsgPage[i + 1];
- /* MTK Joy 0222 */
- cbMsgInfo.MsgMI[i] = cbMsgInfo.MsgMI[i + 1];
- /* MTK end */
- cbMsgIndex.pCBMsgContent[i + 1] =
- cbMsgIndex.pCBMsgContent[i] + (cbMsgInfo.MsgPage[i] * NVRAM_SMS_CB_SMS_PAGE_SIZE);
- }
- }
- /* fifth, clear the endings */
- cbMsgIndex.pCBMsgContent[cbMsgIndex.currCBTotal] = NULL;
- cbMsgInfo.MsgDCS[cbMsgIndex.currCBTotal] = 0;
- cbMsgInfo.MsgPage[cbMsgIndex.currCBTotal] = 0;
- /* MTK Joy 0222 */
- cbMsgInfo.MsgMI[cbMsgIndex.currCBTotal] = SMS_CB_UNUSED_CBMI;
- /* MTK end */
- if (cbMsgIndex.currCBTotal == 0)
- {
- cbMsgIndex.pCBMsgTail = (U8*) cbMsgContent[0];
- }
- else if (cbMsgIndex.currCBTotal < MAX_STORE_CB_MSG)
- {
- cbMsgIndex.pCBMsgTail =
- cbMsgIndex.pCBMsgContent[cbMsgIndex.currCBTotal - 1] + cbMsgInfo.MsgPage[cbMsgIndex.currCBTotal -
- 1] * NVRAM_SMS_CB_SMS_PAGE_SIZE;
- }
- else
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] DeleteCBMessage: total number error ---*n"));
- cbMsgIndex.pCBMsgTail = NULL;
- return 0;
- }
- memset(cbMsgIndex.pCBMsgTail, 0, deleteLen * NVRAM_SMS_CB_SMS_PAGE_SIZE);
- return deleteLen;
- }
- /*****************************************************************************
- * FUNCTION
- * AddCBMessage
- * DESCRIPTION
- * Add CB message to storage buffer
- * PARAMETERS
- * cbMI [IN] Cbmi
- * cbDCS [IN] Cb DCS
- * cbPage [IN] Cb page number
- * cbMsg [IN] Cb message pointer
- * totalLen [IN] Cb message length
- * RETURNS
- * void
- *****************************************************************************/
- void AddCBMessage(U16 cbMI, U8 cbDCS, U8 cbPage, PU8 cbMsg, U16 totalLen)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- msg_cb_lang_enum langType;
- smsal_dcs_enum alphabetType;
- msg_cb_class_enum msgClass;
- pBOOL isCompress;
- pBOOL isReserved;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((cbMsgIndex.pCBMsgTail == NULL) ||
- ((cbMsgIndex.pCBMsgTail) > ((cbMsgStart) + NVRAM_SMS_CB_SMS_PAGE_SIZE * NVRAM_SMS_CB_SMS_PAGE_NUM_TOTAL)))
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] AddCBMessage: tail address error ---*n"));
- }
- else
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] AddCBMessage: tail address ok = %d---*n",
- cbMsgIndex.pCBMsgTail));
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] AddCBMessage: currCBTotal = %d",
- cbMsgIndex.currCBTotal));
- cbMsgIndex.currCBTotal++;
- cbMsgIndex.pCBMsgContent[cbMsgIndex.currCBTotal - 1] = cbMsgIndex.pCBMsgTail;
- memcpy(cbMsgIndex.pCBMsgContent[cbMsgIndex.currCBTotal - 1], cbMsg, totalLen);
- DecodeCbsDcs(
- cbDCS,
- cbMsg[0],
- cbMsg[1],
- cbMsg[2],
- &langType,
- &alphabetType,
- &msgClass,
- &isCompress,
- &isReserved);
- switch (alphabetType)
- {
- case SMSAL_DEFAULT_DCS:
- case SMSAL_RESERVED_DCS:
- memset(
- cbMsgIndex.pCBMsgContent[cbMsgIndex.currCBTotal - 1] + totalLen,
- 0x20,
- cbPage * NVRAM_SMS_CB_SMS_PAGE_SIZE - totalLen);
- break;
- case SMSAL_8BIT_DCS:
- case SMSAL_UCS2_DCS:
- memset(
- cbMsgIndex.pCBMsgContent[cbMsgIndex.currCBTotal - 1] + totalLen,
- 0x00,
- cbPage * NVRAM_SMS_CB_SMS_PAGE_SIZE - totalLen);
- break;
- }
- cbMsgInfo.MsgDCS[cbMsgIndex.currCBTotal - 1] = cbDCS;
- cbMsgInfo.MsgPage[cbMsgIndex.currCBTotal - 1] = cbPage;
- /* MTK Joy 0222 */
- cbMsgInfo.MsgMI[cbMsgIndex.currCBTotal - 1] = cbMI;
- /* MTK end */
- if (((cbMsgIndex.pCBMsgTail) + cbPage * NVRAM_SMS_CB_SMS_PAGE_SIZE) <
- ((cbMsgStart) + NVRAM_SMS_CB_SMS_PAGE_SIZE * NVRAM_SMS_CB_SMS_PAGE_NUM_TOTAL))
- {
- (cbMsgIndex.pCBMsgTail) += (cbPage * NVRAM_SMS_CB_SMS_PAGE_SIZE);
- }
- else
- {
- cbMsgIndex.pCBMsgTail = NULL;
- }
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] AddCBMessage: tail address ok = %d---*n",
- cbMsgIndex.pCBMsgTail));
- }
- }
- /*****************************************************************************
- * FUNCTION
- * ReadCbChnlInfoFromNvram
- * DESCRIPTION
- * Read CB channel info from NVRAM, to be removed after L4 provide interface
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ReadCbChnlInfoFromNvram(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 error = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] ReadCbChnlInfoFromNvram ---*n"));
- if (ReadRecord(NVRAM_EF_SMS_CB_CHNL_LID, 1, &cbNvramStruct, NVRAM_SMS_CB_CHNL_RECORD_SIZE, &error) < 0)
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] ResetCBInfoStructs-failed ---*n"));
- }
- }
- /*****************************************************************************
- * FUNCTION
- * WriteCbChnlInfoToNvram
- * DESCRIPTION
- * Write CB channel info to NVRAM
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void WriteCbChnlInfoToNvram(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 error = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] WriteCbChnlInfoToNvram ---*n"));
- if (WriteRecord(NVRAM_EF_SMS_CB_CHNL_LID, 1, &cbNvramStruct, NVRAM_SMS_CB_CHNL_RECORD_SIZE, &error) !=
- NVRAM_SMS_CB_CHNL_RECORD_SIZE)
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] WriteCbChnlInfoToNvram-: failed (ecode%d) ---*n",
- (int)error));
- }
- }
- /*****************************************************************************
- * FUNCTION
- * ReadCBMessageInfoFromNvram
- * DESCRIPTION
- * Read CB Message info from NVRAM
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ReadCBMessageInfoFromNvram(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 error = 0;
- U16 cbTotalLen = 0;
- S8 i = 0, j = 0;
- S8 readBase = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] ReadCBMessageInfoFromNvram ---*n"));
- if (ReadRecord(NVRAM_EF_SMS_CB_SMS_INFO_LID, 1, &cbMsgInfo, NVRAM_SMS_CB_SMS_INFO_SIZE, &error) < 0)
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] ReadCBMessageInfoFromNvram-(code=%d) ---*n",
- (int)error));
- }
- cbMsgStart = (U8*) cbMsgContent[0];
- for (i = 0; i < MAX_STORE_CB_MSG; i++)
- {
- if (cbMsgInfo.MsgPage[i] == 0)
- {
- break;
- }
- for (j = readBase; (j < (readBase + cbMsgInfo.MsgPage[i])) && (j < NVRAM_SMS_CB_SMS_PAGE_NUM_TOTAL); j++)
- {
- U16 index = (U16) j + 1;
- if (ReadRecord(NVRAM_EF_SMS_CB_SMS_LID, index, cbMsgContent[j], NVRAM_SMS_CB_SMS_PAGE_SIZE, &error) < 0)
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
- "*---[CellBroadcast.c] ReadCBMessageInfoFromNvram-(code=%d) ---*n", (int)error));
- }
- }
- cbMsgIndex.pCBMsgContent[i] = cbMsgStart + cbTotalLen;
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] ReadCBMessageInfoFromNvram-address=%d ---*n",
- cbMsgIndex.pCBMsgContent[i]));
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] CB[%d] dcs=%d page=%d", i, cbMsgInfo.MsgDCS[i],
- cbMsgInfo.MsgPage[i]));
- cbTotalLen += (U16) (cbMsgInfo.MsgPage[i] * NVRAM_SMS_CB_SMS_PAGE_SIZE);
- readBase = readBase + (S8) cbMsgInfo.MsgPage[i];
- }
- cbMsgIndex.currCBTotal = i;
- if (cbTotalLen == NVRAM_SMS_CB_SMS_PAGE_SIZE * NVRAM_SMS_CB_SMS_PAGE_NUM_TOTAL)
- {
- cbMsgIndex.pCBMsgTail = NULL;
- }
- else
- {
- cbMsgIndex.pCBMsgTail = cbMsgStart + cbTotalLen;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * WriteCBMessageInfoToNvram
- * DESCRIPTION
- * Write CB message info to NVRAM
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void WriteCBMessageInfoToNvram(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 i = 0, j = 0;
- S8 writeBase = 0;
- S16 error = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] cbmsgaddress=%d", &cbMsgInfo));
- if (WriteRecord(NVRAM_EF_SMS_CB_SMS_INFO_LID, 1, &cbMsgInfo, NVRAM_SMS_CB_SMS_INFO_SIZE, &error) !=
- NVRAM_SMS_CB_SMS_INFO_SIZE)
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] WriteCBMessageInfoFromNvram-(code=%d) ---*n",
- (int)error));
- }
- for (i = 0; i < MAX_STORE_CB_MSG; i++)
- {
- if (cbMsgInfo.MsgPage[i] == 0)
- {
- break;
- }
- for (j = writeBase; (j < (writeBase + cbMsgInfo.MsgPage[i])) && (j < NVRAM_SMS_CB_SMS_PAGE_NUM_TOTAL); j++)
- {
- U16 index = (U16) j + 1;
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] cbmsgcontent=%d", cbMsgContent[i]));
- if (WriteRecord(NVRAM_EF_SMS_CB_SMS_LID, index, cbMsgContent[j], NVRAM_SMS_CB_SMS_PAGE_SIZE, &error) !=
- NVRAM_SMS_CB_SMS_PAGE_SIZE)
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
- "*---[CellBroadcast.c] WriteCBMessageInfoFromNvram-(code=%d) ---*n", (int)error));
- }
- }
- writeBase = writeBase + (S8) cbMsgInfo.MsgPage[i];
- }
- }
- /*****************************************************************************
- * FUNCTION
- * ConvertCBForDisplay
- * DESCRIPTION
- * Convert CB message for display, according to its DCS
- * PARAMETERS
- * data [IN] Message data
- * len [IN] Message length
- * format [IN] Message format
- * outLen [IN/OUT] Message output length
- * RETURNS
- * void
- *****************************************************************************/
- void ConvertCBForDisplay(U8 *data, U16 len, U8 format, U32 *outLen)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 outLength;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (len > 0)
- {
- switch (format)
- {
- case (MMI_DEFAULT_DCS):
- {
- U8 *tempData;
- tempData = OslMalloc(len);;
- ConvertGSM7BitDefaultEncodingToAscii(tempData, data, len, &outLength);
- AnsiiNToUnicodeString((PS8) dispCBMessage, (PS8) tempData, outLength);
- memset((void*)&dispCBMessage[outLength * ENCODING_LENGTH], 0, ENCODING_LENGTH);
- OslMfree(tempData);
- if (outLen != NULL)
- {
- *outLen = (U32) outLength *ENCODING_LENGTH + ENCODING_LENGTH;
- }
- }
- break;
- case (MMI_8BIT_DCS):
- AnsiiNToUnicodeString((PS8) dispCBMessage, (PS8) data, len);
- memset((void*)&dispCBMessage[len * ENCODING_LENGTH], 0, ENCODING_LENGTH);
- if (outLen != NULL)
- {
- *outLen = len * ENCODING_LENGTH + ENCODING_LENGTH;
- }
- break;
- case (MMI_UCS2_DCS):
- memset((void*)dispCBMessage, 0, len + 1 + ENCODING_LENGTH);
- memcpy(dispCBMessage, data, len);
- if (outLen != NULL)
- {
- *outLen = len + ENCODING_LENGTH;
- }
- #ifdef MMI_ON_HARDWARE_P
- {
- U16 *tempData;
- int i;
- tempData = (U16*) dispCBMessage;
- for (i = 0; i < len; i += 2)
- {
- SWAP_USHORT(tempData);
- tempData++;
- }
- }
- #endif /* MMI_ON_HARDWARE_P */
- break;
- }
- return;
- }
- else
- {
- memset((void*)dispCBMessage, 0, ENCODING_LENGTH);
- if (outLen != NULL)
- {
- *outLen = ENCODING_LENGTH;
- }
- return;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * ReadCBMessageContent
- * DESCRIPTION
- * Read CB message content for dislpay
- * PARAMETERS
- * outLen [IN/OUT] Output length
- * msgData [IN] Message data
- * msgLength [IN] Message length
- * dcs [IN] Message DCS
- * RETURNS
- * void
- *****************************************************************************/
- void ReadCBMessageContent(PU32 outLen, PU8 msgData, U16 msgLength, U8 dcs)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- msg_cb_lang_enum langType;
- smsal_dcs_enum alphabetType;
- msg_cb_class_enum msgClass;
- pBOOL isCompress;
- pBOOL isReserved;
- /* MTK add Kevin */
- U8 skipChar;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* MTK end */
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] ReadCBMessageContent ---*n"));
- /* MTK add Kevin */
- skipChar = DecodeCbsDcs(
- dcs,
- msgData[0],
- msgData[1],
- msgData[2],
- &langType,
- &alphabetType,
- &msgClass,
- &isCompress,
- &isReserved);
- /* MTK end */
- if (isCompress == TRUE || isReserved == TRUE)
- {
- DisplayPopup(
- (PU8) GetString(STR_SMS_DOES_NOT_SUPPORT),
- IMG_GLOBAL_WARNING,
- 0,
- MESSAGES_POPUP_TIME_OUT,
- (U8) WARNING_TONE);
- DeleteMessagesHistoryNodes();
- }
- else
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] alphabetType=%d ---*n", alphabetType));
- switch (alphabetType)
- {
- /* MTK add Kevin for skipping some characters containing dcs info */
- case SMSAL_DEFAULT_DCS:
- case SMSAL_RESERVED_DCS:
- ConvertCBForDisplay(msgData + skipChar, (U16) (msgLength - skipChar), SMSAL_DEFAULT_DCS, outLen);
- return;
- case SMSAL_8BIT_DCS:
- ConvertCBForDisplay(msgData + skipChar, (U16) (msgLength - skipChar), SMSAL_8BIT_DCS, outLen);
- return;
- case SMSAL_UCS2_DCS:
- ConvertCBForDisplay(msgData + skipChar, (U16) (msgLength - skipChar), SMSAL_UCS2_DCS, outLen);
- return;
- /* MTK end */
- default:
- ConvertCBForDisplay(msgData + skipChar, (U16) (msgLength - skipChar), SMSAL_DEFAULT_DCS, outLen);
- return;
- }
- }
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_get_cb_mode_req
- * DESCRIPTION
- * Get CB mode
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_get_cb_mode_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MYQUEUE Message;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Message.oslSrcId = MOD_MMI;
- Message.oslDestId = MOD_L4C;
- Message.oslMsgId = PRT_MSG_ID_MMI_SMS_GET_CB_MODE_REQ;
- Message.oslDataPtr = NULL;
- Message.oslPeerBuffPtr = NULL;
- OslMsgSendExtQueue(&Message);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_get_cb_mode_rsp_active
- * DESCRIPTION
- * Get CB mode for current status
- * PARAMETERS
- * inMsg [IN] L4 response message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_get_cb_mode_rsp_active(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_CB_GET_CB_MODE_RSP_STRUCT *msgRsp = (MMI_FRM_CB_GET_CB_MODE_RSP_STRUCT*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] GetCBServiceModeRsp ---*n"));
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_GET_CB_MODE_RSP);
- /* if incoming call ringing or alarm playing, do not show response result in case interrupt current screen */
- if (mmi_msg_check_interrupt() == TRUE)
- {
- return;
- }
- if (msgRsp->result == TRUE)
- {
- cb_info.mode = msgRsp->mode;
- memset(cb_display.mode, 0, ENCODING_LENGTH);
- if (cb_info.mode == TRUE)
- {
- pfnUnicodeStrcpy((S8*) cb_display.mode, (S8*) GetString((U16) STR_GLOBAL_ON));
- }
- else
- {
- pfnUnicodeStrcpy((S8*) cb_display.mode, (S8*) GetString((U16) STR_GLOBAL_OFF));
- }
- mmi_msg_entry_cb_main_menu();
- }
- else
- {
- DisplayPopup(
- (PU8) GetString(STR_CB_NOT_READY_YET),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_get_cb_mode_rsp_display
- * DESCRIPTION
- * Get CB mode to display channel list
- * PARAMETERS
- * inMsg [IN] L4 reponse message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_get_cb_mode_rsp_display(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_CB_GET_CB_MODE_RSP_STRUCT *msgRsp = (MMI_FRM_CB_GET_CB_MODE_RSP_STRUCT*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] GetCBServiceModeRsp ---*n"));
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_GET_CB_MODE_RSP);
- /* if incoming call ringing or alarm playing, do not show response result in case interrupt current screen */
- if (mmi_msg_check_interrupt() == TRUE)
- {
- return;
- }
- if (msgRsp->result == TRUE)
- {
- U8 i = 0;
- U8 total = 0;
- U8 addindex = msgRsp->total_mid_num;
- /* delete if apply new interface */
- ReadCbChnlInfoFromNvram();
- /* end */
- for (i = 0; i < msgRsp->total_mid_num; i++)
- {
- if (msgRsp->info.mid[i] != SMSAL_CB_UNUSED_CBMI)
- {
- U8 j = 0;
- cb_info.cbchnlentry[total].mi = msgRsp->info.mid[i];
- cb_info.cbchnlentry[total].mask = msgRsp->info.mid_mask[i];
- cb_info.cbchnlentry[total].index = i;
- /* delete if apply new interface */
- memset(cb_info.cbchnlentry[total].name, 0, MAX_CB_CHNL_NAME_LENGTH + 1);
- while ((cbNvramStruct.l4MidIndex[j] != i) && (j < SMS_CB_MAX_ENTRY))
- {
- j++;
- }
- if (j == SMS_CB_MAX_ENTRY)
- {
- memset((S8*) cb_info.cbchnlentry[total].name, 0, MAX_CB_CHNL_NAME_LENGTH);
- cb_info.cbchnlentry[total].dcs = PHB_ASCII;
- }
- else
- {
- memcpy(
- (S8*) cb_info.cbchnlentry[total].name,
- (S8*) cbNvramStruct.chnlNames[j].name,
- MAX_CB_CHNL_NAME_LENGTH);
- cb_info.cbchnlentry[total].dcs = cbNvramStruct.chnlNames[j].name_dcs;
- }
- /* end */
- total++;
- }
- else
- {
- if (addindex == msgRsp->total_mid_num)
- {
- addindex = i;
- }
- }
- }
- cb_info.totalmi = total;
- memset(&cbNvramStruct, 0xff, sizeof(msg_cb_channel_nvram_struct));
- for (i = 0; i < cb_info.totalmi; i++)
- {
- cbNvramStruct.l4MidIndex[i] = cb_info.cbchnlentry[i].index;
- cbNvramStruct.chnlNames[i].name_dcs = cb_info.cbchnlentry[i].dcs;
- memcpy(
- (S8*) cbNvramStruct.chnlNames[i].name,
- (S8*) cb_info.cbchnlentry[i].name,
- MAX_CB_CHNL_NAME_LENGTH + 1);
- }
- /* delete if apply new interface */
- WriteCbChnlInfoToNvram();
- /* end */
- switch (cb_state)
- {
- case SMS_CB_CHNL_SELECT_STATE:
- if (cb_info.totalmi == 0)
- {
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_EMPTY),
- IMG_GLOBAL_WARNING,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) WARNING_TONE);
- }
- else
- {
- mmi_msg_entry_cb_channel_select();
- }
- break;
- case SMS_CB_CHNL_EDIT_STATE:
- case SMS_CB_CHNL_DELETE_STATE:
- if (cb_info.totalmi == 0)
- {
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_EMPTY),
- IMG_GLOBAL_WARNING,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) WARNING_TONE);
- }
- else
- {
- mmi_msg_entry_cb_channel_list();
- }
- break;
- case SMS_CB_CHNL_ADD_STATE:
- if (cb_info.totalmi == msgRsp->total_mid_num)
- {
- DisplayPopup(
- (PU8) GetString(STR_SMS_CB_CHNL_FULL),
- IMG_GLOBAL_WARNING,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) WARNING_TONE);
- }
- else
- {
- cb_display.addindex = addindex;
- memset(cb_display.name, 0, (MAX_CB_CHNL_NAME_LENGTH + 1) * ENCODING_LENGTH);
- memset(cb_display.mi, 0, (MAX_CB_CHNL_NUMBER_DISPLAY_LENGTH + 1) * ENCODING_LENGTH);
- cb_display.dcs = PHB_ASCII;
- mmi_msg_entry_cb_channel_edit();
- }
- break;
- case SMS_CB_READ_MESSAGE_STATE:
- mmi_msg_entry_cb_read_message();
- break;
- default:
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*-------[CellBroadcast.c] cb_info is filled up-------*n"));
- break;
- }
- }
- else
- {
- DisplayPopup(
- (PU8) GetString(STR_CB_ERROR_MESSAGE),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_get_cb_mode_rsp_language
- * DESCRIPTION
- * Get CB mode to display CB language list
- * PARAMETERS
- * inMsg [IN] L4 response message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_get_cb_mode_rsp_language(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_CB_GET_CB_MODE_RSP_STRUCT *msgRsp = (MMI_FRM_CB_GET_CB_MODE_RSP_STRUCT*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] GetCBServiceModeRsp ---*n"));
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_GET_CB_MODE_RSP);
- /* if incoming call ringing or alarm playing, do not show response result in case interrupt current screen */
- if (mmi_msg_check_interrupt() == TRUE)
- {
- return;
- }
- if (msgRsp->result == TRUE)
- {
- U8 i = 0;
- U8 total = 0;
- U8 firstByte = 0;
- U8 secondByte = 0;
- pBOOL isCompress;
- pBOOL isReserved;
- msg_cb_lang_enum langType;
- smsal_dcs_enum alphabetType;
- msg_cb_class_enum msgClass;
- for (i = 0; i < msgRsp->total_dcs_num; i++)
- {
- if (msgRsp->info.dcs[i] != SMSAL_CB_UNUSED_DCS)
- {
- firstByte = (msgRsp->info.dcs[i] & 0xff00) >> 8;
- secondByte = (msgRsp->info.dcs[i] & 0x00ff);
- if (firstByte == 0x00)
- {
- DecodeCbsDcs(secondByte, 0, 0, 0, &langType, &alphabetType, &msgClass, &isCompress, &isReserved);
- }
- else
- {
- MMICbsDecodeLang(firstByte, secondByte, &langType);
- }
- if ((langType != MMI_CBS0_LANG_UNSPECIFIED) && (langType != MMI_CBS_INVALID))
- {
- cb_info.cblanentry[total].dcs = langType;
- cb_info.cblanentry[total].mask = msgRsp->info.dcs_mask[i];
- cb_info.cblanentry[total].index = i;
- total++;
- }
- }
- firstByte = 0;
- secondByte = 0;
- }
- cb_info.totaldcs = total;
- cb_info.dcsall = msgRsp->info.is_all_language_on;
- mmi_msg_entry_cb_language();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_set_cb_mode_req
- * DESCRIPTION
- * Set CB mode request
- * PARAMETERS
- * para [IN] Setting type flag
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_set_cb_mode_req(U8 para)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MYQUEUE Message;
- MMI_FRM_CB_SET_CB_MODE_REQ_STRUCT *msgReq;
- U8 i = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- WriteCbChnlInfoToNvram();
- Message.oslSrcId = MOD_MMI;
- Message.oslDestId = MOD_L4C;
- Message.oslMsgId = PRT_MSG_ID_MMI_SMS_SET_CB_MODE_REQ;
- msgReq = (MMI_FRM_CB_SET_CB_MODE_REQ_STRUCT*) OslConstructDataPtr(sizeof(MMI_FRM_CB_SET_CB_MODE_REQ_STRUCT));
- if ((para & SMSAL_CB_MI) == SMSAL_CB_MI)
- {
- for (i = 0; i < SMS_CB_MAX_ENTRY; i++)
- {
- msgReq->info.mid[i] = SMSAL_CB_UNUSED_CBMI;
- }
- for (i = 0; i < cb_info.totalmi; i++)
- {
- msgReq->info.mid[cb_info.cbchnlentry[i].index] = cb_info.cbchnlentry[i].mi;
- }
- }
- if (((para & SMSAL_CB_MI) == SMSAL_CB_MI) || ((para & SMSAL_CB_MI_MASK) == SMSAL_CB_MI_MASK))
- {
- for (i = 0; i < SMS_CB_MAX_ENTRY; i++)
- {
- msgReq->info.mid_mask[i] = 1;
- }
- for (i = 0; i < cb_info.totalmi; i++)
- {
- msgReq->info.mid_mask[cb_info.cbchnlentry[i].index] = cb_info.cbchnlentry[i].mask;
- }
- }
- if ((para & SMSAL_CB_DCS_MASK) == SMSAL_CB_DCS_MASK)
- {
- for (i = 0; i < SMS_CB_MAX_LANG; i++)
- {
- msgReq->info.dcs_mask[i] = 1;
- }
- for (i = 0; i < cb_info.totaldcs; i++)
- {
- msgReq->info.dcs_mask[cb_info.cblanentry[i].index] = cb_info.cblanentry[i].mask;
- }
- }
- if ((para & SMSAL_CB_ALL_LANG) == SMSAL_CB_ALL_LANG)
- {
- msgReq->info.is_all_language_on = cb_info.dcsall;
- }
- msgReq->info.para_ind = para;
- Message.oslDataPtr = (oslParaType*) msgReq;
- Message.oslPeerBuffPtr = NULL;
- OslMsgSendExtQueue(&Message);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_set_cb_mode_rsp
- * DESCRIPTION
- * Set CB mode response
- * PARAMETERS
- * inMsg [IN] L4 reponse message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_set_cb_mode_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_CB_SET_CB_MODE_RSP_STRUCT *msgRsp = (MMI_FRM_CB_SET_CB_MODE_RSP_STRUCT*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_SET_CB_MODE_RSP);
- if (msgRsp->result == TRUE)
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] SetCBServiceModeRsp-ok ---*n"));
- switch (cb_state)
- {
- case SMS_CB_DEFAULT_SETTINGS_MODE_STATE:
- if (msgRsp->result == TRUE)
- {
- RstRestoreDisplayPopup(TRUE);
- }
- else
- {
- RstRestoreDisplayPopup(FALSE);
- }
- break;
- case SMS_CB_CHNL_SELECT_STATE:
- case SMS_CB_CHNL_ADD_STATE:
- case SMS_CB_CHNL_EDIT_STATE:
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_SAVED),
- IMG_GLOBAL_ACTIVATED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) SUCCESS_TONE);
- DeleteMessagesHistoryNodes();
- break;
- case SMS_CB_CHNL_DELETE_STATE:
- if (g_msg_cntx.currHiliteIndex == cb_info.totalmi)
- {
- g_msg_cntx.currHiliteIndex--;
- }
- DisplayPopup(
- (PU8) GetString(STR_MESSAGES_DELETED_ID),
- IMG_GLOBAL_ACTIVATED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) SUCCESS_TONE);
- if (cb_info.totalmi == 0)
- {
- DeleteScreenIfPresent(SCR_ID_MSG_CB_CHANNEL_LIST);
- }
- break;
- case SMS_CB_LANGUAGE_STATE:
- if (msgRsp->result == TRUE)
- {
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_SAVED),
- IMG_GLOBAL_ACTIVATED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) SUCCESS_TONE);
- DeleteMessagesHistoryNodes();
- }
- else
- {
- DisplayPopup(
- (PU8) GetString(STR_MESSAGES_UNKNOWN_ERROR),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- DeleteMessagesHistoryNodes();
- }
- break;
- }
- }
- else
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] SetCBServiceModeRsp-failed ---*n"));
- if (cb_state == SMS_CB_DEFAULT_SETTINGS_MODE_STATE)
- {
- RstRestoreDisplayPopup(FALSE);
- }
- else
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_CB_CHANNEL_LIST);
- DisplayPopup(
- (PU8) GetString(STR_CB_ERROR_MESSAGE),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- DeleteMessagesHistoryNodes();
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_subscribe_cb_req
- * DESCRIPTION
- * Subscribe CB request
- * PARAMETERS
- * subscribe [IN] Subscribe type
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_subscribe_cb_req(U8 subscribe)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MYQUEUE Message;
- MMI_FRM_CB_SUBSCRIBE_REQ_STRUCT *msgReq;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] EnableOrDiasableCBServiceReq ---*n"));
- Message.oslSrcId = MOD_MMI;
- Message.oslDestId = MOD_L4C;
- Message.oslMsgId = PRT_MSG_ID_MMI_CB_SUBSCRIBE_REQ;
- msgReq = (MMI_FRM_CB_SUBSCRIBE_REQ_STRUCT*) OslConstructDataPtr(sizeof(MMI_FRM_CB_SUBSCRIBE_REQ_STRUCT));
- msgReq->on_off = subscribe;
- Message.oslDataPtr = (oslParaType*) msgReq;
- Message.oslPeerBuffPtr = NULL;
- OslMsgSendExtQueue(&Message);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_subscribe_cb_rsp
- * DESCRIPTION
- * Subscribe CB response
- * PARAMETERS
- * inMsg [IN] L4 reponse message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_subscribe_cb_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_CB_SUBSCRIBE_RSP_STRUCT *msgRsp = (MMI_FRM_CB_SUBSCRIBE_RSP_STRUCT*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_CB_SUBSCRIBE_RSP);
- if (msgRsp->result == TRUE)
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] mmi_msg_subscribe_cb_rsp -OK ---*n"));
- if (cb_state == SMS_CB_DEFAULT_SETTINGS_MODE_STATE)
- {
- U8 i = 0;
- for (i = 0; i < SMS_CB_MAX_ENTRY; i++)
- {
- cb_info.cbchnlentry[i].mask = 1;
- }
- for (i = 0; i < SMS_CB_MAX_LANG; i++)
- {
- cb_info.cblanentry[i].mask = 1;
- }
- cb_info.dcsall = 1;
- SetProtocolEventHandler(mmi_msg_set_cb_mode_rsp, PRT_MSG_ID_MMI_SMS_SET_CB_MODE_RSP);
- mmi_msg_set_cb_mode_req(SMSAL_CB_MI_MASK | SMSAL_CB_DCS_MASK);
- }
- else
- {
- U8 subscribe = (!cb_info.mode);
- cb_info.mode = subscribe;
- memset(cb_display.mode, 0, ENCODING_LENGTH);
- if (cb_info.mode == TRUE)
- {
- pfnUnicodeStrcpy((S8*) cb_display.mode, (S8*) GetString((U16) STR_GLOBAL_ON));
- }
- else
- {
- pfnUnicodeStrcpy((S8*) cb_display.mode, (S8*) GetString((U16) STR_GLOBAL_OFF));
- }
- mmi_msg_refresh_cb_main_menu();
- }
- }
- else
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] mmi_msg_subscribe_cb_rsp-Failed ---*n"));
- if (cb_state == SMS_CB_DEFAULT_SETTINGS_MODE_STATE)
- {
- RstRestoreDisplayPopup(FALSE);
- }
- else
- {
- DisplayPopup(
- (PU8) GetString(STR_CB_ERROR_MESSAGE),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_handle_new_cb_ind
- * DESCRIPTION
- * Handle new CB indication
- * PARAMETERS
- * inMsg [IN] L4 response message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_handle_new_cb_ind(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_CB_MSG_IND_STRUCT *CbsMsg = (MMI_FRM_CB_MSG_IND_STRUCT*) inMsg;
- U8 i = 0;
- U8 deleteIndex = 0;
- U16 inCBMI = SMS_CB_UNUSED_CBMI;
- U8 inCBDCS = 0;
- U8 inCBPage = 0;
- U8 currCBPageTotal = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] mmi_msg_handle_new_cb_ind ---*n"));
- if (IsCBMessageReadOperRequired)
- {
- IsCBMessageReadOperRequired = FALSE;
- #ifdef MMI_ON_WIN32
- cbMsgStart = (U8*) cbMsgContent[0];
- cbMsgIndex.pCBMsgTail = (U8*) cbMsgContent[0];
- #else /* MMI_ON_WIN32 */
- ReadCBMessageInfoFromNvram();
- #endif /* MMI_ON_WIN32 */
- }
- inCBMI = CbsMsg->mi;
- inCBDCS = CbsMsg->dcs;
- inCBPage = ((CbsMsg->msg_length) / NVRAM_SMS_CB_SMS_PAGE_SIZE);
- if (((CbsMsg->msg_length) % NVRAM_SMS_CB_SMS_PAGE_SIZE) != 0)
- {
- inCBPage++;
- }
- inCBPage = (inCBPage > MAX_CB_MSG_PAGE) ? MAX_CB_MSG_PAGE : inCBPage;
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] Page= %d---*n", inCBPage));
- for (i = 0; i < cbMsgIndex.currCBTotal; i++)
- {
- currCBPageTotal += cbMsgInfo.MsgPage[i];
- }
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*---[CellBroadcast.c] CurrTotalPage= %d---*n", currCBPageTotal));
- if ((currCBPageTotal + inCBPage) < NVRAM_SMS_CB_SMS_PAGE_NUM_TOTAL)
- {
- if (cbMsgIndex.currCBTotal == MAX_STORE_CB_MSG)
- {
- if (cb_display.currindex == MAX_STORE_CB_MSG - 1)
- {
- deleteIndex = 0;
- cb_display.currindex--;
- }
- else
- {
- deleteIndex = MAX_STORE_CB_MSG - 1;
- }
- DeleteCBMessage(deleteIndex);
- }
- }
- else
- {
- if (cb_display.currindex == (cbMsgIndex.currCBTotal - 1))
- {
- for (i = 0; i < cbMsgIndex.currCBTotal - 1; i++)
- {
- currCBPageTotal -= DeleteCBMessage(0);
- cb_display.currindex--;
- if ((currCBPageTotal + inCBPage) <= NVRAM_SMS_CB_SMS_PAGE_NUM_TOTAL)
- {
- break;
- }
- }
- }
- else
- {
- for (i = cbMsgIndex.currCBTotal - 1;; i--)
- {
- if ((cb_display.currindex == MAX_STORE_CB_MSG) || (i > cb_display.currindex))
- {
- currCBPageTotal -= DeleteCBMessage(i);
- if ((currCBPageTotal + inCBPage) <= NVRAM_SMS_CB_SMS_PAGE_NUM_TOTAL)
- {
- break;
- }
- }
- else if (i < cb_display.currindex)
- {
- currCBPageTotal -= DeleteCBMessage(i);
- cb_display.currindex--;
- if ((currCBPageTotal + inCBPage) <= NVRAM_SMS_CB_SMS_PAGE_NUM_TOTAL)
- {
- break;
- }
- }
- if (i == 0)
- {
- break;
- }
- }
- }
- }
- AddCBMessage(inCBMI, inCBDCS, inCBPage, CbsMsg->msg_data, CbsMsg->msg_length);
- cb_display.unread[cbMsgIndex.currCBTotal - 1] = TRUE;
- /* gs code is the first two most significant bits in the first octet */
- if ((CbsMsg->sn & 0xc000) == 0)
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*-------[CellBroadcast.c] Immediate mode-------*n"));
- cb_display.immediate[cbMsgIndex.currCBTotal - 1] = TRUE;
- }
- else
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*-------[CellBroadcast.c] Normal mode-------*n"));
- cb_display.immediate[cbMsgIndex.currCBTotal - 1] = FALSE;
- }
- mmi_msg_new_cb_ind();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_new_cb_ind
- * DESCRIPTION
- * New CB message indication
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_new_cb_ind(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- TurnOnBacklight(1);
- if (IsMMIInIdleState() || GetMessagesCurrScrnID() == SCR_ID_MSG_CB_MESSAGE_IDLE ||
- GetMessagesCurrScrnID() == SCR_ID_MSG_CB_MESSAGE_IND)
- {
- ClearKeyEvents(); /* key flussing */
- if (IsKeyPadLockState())
- {
- EntryIdleScreen();
- }
- else
- {
- #ifdef __MMI_MESSAGES_TWO_CB_MODES_DISPLAY__
- if (cb_display.immediate[cbMsgIndex.currCBTotal - 1] == TRUE)
- {
- cbMsgIndex.currCBIndex = cbMsgIndex.currCBTotal - 1;
- }
- else if (GetMessagesCurrScrnID() != SCR_ID_MSG_CB_MESSAGE_IDLE)
- {
- cbMsgIndex.currCBIndex = cbMsgIndex.currCBTotal - 1;
- }
- #else /* __MMI_MESSAGES_TWO_CB_MODES_DISPLAY__ */
- cbMsgIndex.currCBIndex = cbMsgIndex.currCBTotal - 1;
- #endif /* __MMI_MESSAGES_TWO_CB_MODES_DISPLAY__ */
- mmi_msg_entry_new_cb_ind();
- }
- }