SMSMsg.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:209k
- /*****************************************************************************
- * 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:
- * ---------
- * SMSMsg.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- *
- *
- * 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!
- *
- * 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!
- * 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!
- * removed!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *==============================================================================
- *******************************************************************************/
- #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 "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"
- #ifdef __MMI_MESSAGES_CHAT__
- #include "ChatAppGprot.h"
- #include "ChatAppDef.h"
- #endif /* __MMI_MESSAGES_CHAT__ */
- /* */
- #include "customer_ps_inc.h"
- #include "l4c2smsal_struct.h"
- #include "smsal_l4c_enum.h"
- #include "ems.h"
- /* */
- #include "Gui_ems.h"
- #include "wgui_ems.h"
- #include "GSM7BitDefaultAlphabet.h"
- /* */
- #include "CallHistoryGProts.h"
- #include "IdleAppProt.h"
- #include "SettingProfile.h"
- #include "ProfileGprots.h"
- #include "AlarmFrameworkProt.h"
- #include "PhoneBookTypes.h"
- #include "PhoneBookDef.h"
- #include "SimDetectionGexdcl.h"
- #include "SettingDefs.h"
- #include "SettingsGdcl.h"
- #include "CSP.h"
- #ifdef MMI_ON_HARDWARE_P
- #include "sim_common_enums.h"
- #endif
- /* */
- #include "wgui_categories_inputs.h"
- #include "wgui_status_icons.h"
- #include "KeyBrd.h"
- /* */
- #include "FileSystemDef.h"
- #include "FileSystemGProt.h"
- /* */
- #include "NVRAMEnum.h"
- #include "NVRAMProt.h"
- #include "NVRAMType.h"
- /* */
- #include "DateTimeGprot.h"
- #include "SMSApi.h"
- #include "SMSStruct.h"
- #include "SMSFunc.h"
- #include "app_datetime.h"
- #ifdef __MMI_UNIFIED_MESSAGE__
- #include "UnifiedMessageGProt.h"
- #endif
- #ifdef __MMI_UNIFIED_COMPOSER__
- #include "UnifiedComposerGProt.h"
- #endif
- #if defined(__MMI_MESSAGES_USE_URL__)
- #include "wap_ps_struct.h"
- #endif
- //KP Jerry modify on 2007-4-26 start
- #if defined(__MMI_CM_BLACK_LIST__) && defined(__MMI_CM_WHITE_LIST__)
- #include "ManageCallMain.h"
- #endif
- //KP Jerry modify on 2007-4-26 end
- #ifndef MMI_FRM_SMS_INVALID_INDEX
- #define MMI_FRM_SMS_INVALID_INDEX 0xffff
- #endif
- #ifndef MMI_FRM_SMS_INVALID_NUM
- #define MMI_FRM_SMS_INVALID_NUM 0xff
- #endif
- #ifndef MMI_FRM_SMS_MSG_LEN
- #define MMI_FRM_SMS_MSG_LEN 160
- #endif
- #ifndef MMI_FRM_SMS_MSG_SEQ_NUM
- #define MMI_FRM_SMS_MSG_SEQ_NUM 5
- #endif
- #ifndef MMI_FRM_SMS_ACTION_SIZE
- #define MMI_FRM_SMS_ACTION_SIZE 10
- #endif
- #define MMI_FRM_SMS_SEND_SEG 1
- static msg_profile_list_struct *profileList;
- static msg_profile_edit_struct *profileDetail;
- static msg_mailbox_edit_struct *mailboxDetail;
- #ifdef __MMI_MESSAGES_COPY__
- static mmi_frm_sms_copy_result_struct *copyResult;
- #endif
- static mmi_frm_sms_send_struct *sendSMS;
- static mmi_frm_sms_send_struct *saveSMS;
- static MYTIME sms_saved_time;
- static U16 sendResult = MMI_FRM_SMS_OK;
- static U16 readIndex;
- static mmi_frm_sms_register_struct mmi_frm_sms_interrupt_handler[MMI_FRM_SMS_ACTION_SIZE];
- static U8 mmi_frm_sms_interrupt_handler_size = 0;
- extern EMSData *GetEMSDataForView(EMSData **p, U8 force);
- extern EMSData *GetEMSDataForEdit(EMSData **p, U8 force);
- extern U8 DeInitMessagesEMSBuffer(msg_ems_data_struct *pE);
- #if ( defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- extern nsm_msg_struct g_nsm_msg_context;
- #endif
- /* Call before EMSPack */
- extern void EMS_ConvertAsciiEncodingToGSM7BitDefault(EMSData *data);
- extern void EMS_ConvertAsciiEncodingToGSM7BitDefaultWithExtended(EMSData *data);
- /* Call after EMSUnpack */
- extern void EMS_ConvertGSM7BitDefaultEncodingToAscii(EMSData *data);
- extern void EMS_ConvertGSM7BitDefaultEncodingToAsciiWithExtended(EMSData *data);
- extern MMI_BOOL g_mmi_frm_sms_change_status;
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_free_sendsms_data
- * DESCRIPTION
- * free control buffer of sendSMS and sendSMS->string
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_frm_sms_free_sendsms_data(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (sendSMS != NULL)
- {
- if (sendSMS->string != NULL)
- {
- OslMfree(sendSMS->string);
- sendSMS->string = NULL;
- }
- OslMfree(sendSMS);
- sendSMS = NULL;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_free_savesms_data
- * DESCRIPTION
- * free control buffer of saveSMS and saveSMS->string
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_frm_sms_free_savesms_data(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (saveSMS != NULL)
- {
- if (saveSMS->string != NULL)
- {
- OslMfree(saveSMS->string);
- saveSMS->string = NULL;
- }
- OslMfree(saveSMS);
- saveSMS = NULL;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_send_message
- * DESCRIPTION
- * Common function for sending message
- * PARAMETERS
- * MOD_SRC [IN] Source module
- * MOD_DEST [IN] Destination module
- * MSG_SAP [IN] Message SAP
- * MSG_ID [IN] Message ID
- * LOCAL [IN] Local parameter
- * PEER [IN] Peer buffer
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_send_message(
- module_type MOD_SRC,
- module_type MOD_DEST,
- U8 MSG_SAP,
- const U16 MSG_ID,
- void *LOCAL,
- void *PEER)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MYQUEUE Message;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Message.oslSrcId = MOD_SRC;
- Message.oslDestId = MOD_DEST;
- Message.oslMsgId = MSG_ID;
- Message.oslDataPtr = LOCAL;
- Message.oslPeerBuffPtr = PEER;
- OslMsgSendExtQueue(&Message);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_reg_interrupt_handler
- * DESCRIPTION
- * Register interrupt handle
- * PARAMETERS
- * mod [IN] Module type
- * msgid [IN] Message id
- * callback [IN] Callback of interrupt
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_reg_interrupt_handler(module_type mod, U16 msgid, PsFuncPtrU16 callback)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_frm_sms_interrupt_handler[mmi_frm_sms_interrupt_handler_size].molude = mod;
- mmi_frm_sms_interrupt_handler[mmi_frm_sms_interrupt_handler_size].msgid = msgid;
- mmi_frm_sms_interrupt_handler[mmi_frm_sms_interrupt_handler_size].callback = callback;
- mmi_frm_sms_interrupt_handler_size++;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_ready_ind
- * DESCRIPTION
- * Handle ready indication
- * PARAMETERS
- * dummy [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_ready_ind(void *dummy)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_frm_sms_cntx.mmi_frm_sms_ready = TRUE;
- mmi_frm_sms_get_profile_list(NULL, MOD_MMI);
- #ifdef __MMI_MESSAGES_SINGLE_DELIVERY_REPORT__
- mmi_frm_sms_get_common_settings(NULL, MOD_MMI);
- #endif
- mmi_msg_pre_entry_cb_channel_bootup();
- while (i < mmi_frm_sms_interrupt_handler_size)
- {
- if (mmi_frm_sms_interrupt_handler[i].msgid == PRT_MSG_ID_MMI_SMS_READY_IND)
- {
- mmi_frm_sms_interrupt_handler[i].callback(NULL, MOD_MMI, MMI_FRM_SMS_OK);
- }
- i++;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_startup_read_req
- * DESCRIPTION
- * SMS startup read request
- * PARAMETERS
- * dummy [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_startup_read_req(void *dummy)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_frm_sms_send_message(MOD_MMI, MOD_L4C, 0, PRT_MSG_ID_MMI_SMS_STARTUP_READ_NEXT_REQ, NULL, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_startup_read_ind
- * DESCRIPTION
- * Handle SMS startup read indication
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_startup_read_ind(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_STARTUP_READ_MSG_IND_STRUCT *msgInd = (MMI_FRM_SMS_STARTUP_READ_MSG_IND_STRUCT*) inMsg;
- mmi_frm_sms_msgbox_struct *entry = OslMalloc(sizeof(mmi_frm_sms_msgbox_struct));
- U8 sendreq = (msgInd->startup_seq_num == 0) ? 1 : 0;
- U8 seg = (msgInd->concat_info & 0xff000000) >> 24;
- U8 thisseg = ((seg % g_frm_sms_cntx.mmi_frm_sms_msg_seg_size) == 0) ?
- g_frm_sms_cntx.mmi_frm_sms_msg_seg_size : (seg % g_frm_sms_cntx.mmi_frm_sms_msg_seg_size);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset((S8*) entry, 0, sizeof(mmi_frm_sms_msgbox_struct));
- if (msgInd->startup_seq_num == 0)
- {
- sendreq = TRUE;
- }
- mmi_frm_sms_convert_startup_read_to_entry((MMI_FRM_SMS_STARTUP_READ_MSG_IND_STRUCT*) msgInd, entry);
- mmi_frm_sms_add_sms_to_msgbox(entry, msgInd->index, thisseg);
- OslMfree(entry);
- if (sendreq)
- {
- mmi_frm_sms_startup_read_req(NULL);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_startup_finish_ind
- * DESCRIPTION
- * Handle SMS startup finish indication
- * PARAMETERS
- * dummy [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_startup_finish_ind(void *dummy)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_STARTUP_READ_MSG_IND);
- mmi_frm_sms_create_sms_list();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_startup_begin_ind
- * DESCRIPTION
- * Handle SMS startup begin indication
- * PARAMETERS
- * dummy [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_startup_begin_ind(void *dummy)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* init msgbox in case of sim refresh */
- mmi_frm_sms_init_msgbox();
- SetProtocolEventHandler(mmi_frm_sms_startup_read_ind, PRT_MSG_ID_MMI_SMS_STARTUP_READ_MSG_IND);
- SetProtocolEventHandler(mmi_frm_sms_startup_finish_ind, PRT_MSG_ID_MMI_SMS_STARTUP_FINISH_IND);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_status_report_ind
- * DESCRIPTION
- * Handle status report
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_status_report_ind(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_STATUS_REPORT_IND_STRUCT *msgInd = (MMI_FRM_SMS_STATUS_REPORT_IND_STRUCT*) inMsg;
- U8 i = 0;
- #ifdef __MMI_MESSAGES_SINGLE_DELIVERY_REPORT__
- U8 msg_ref = msgInd->mr;
- U16 delivery_report_awaited_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* check if mr is in delivery report awaited list */
- delivery_report_awaited_index = mmi_frm_sms_get_delivery_report_index_by_mr(msg_ref);
- /* mr is in delivery report awaited list */
- if (delivery_report_awaited_index != MMI_FRM_SMS_ACTION_SIZE)
- {
- mmi_frm_sms_set_delivery_report_awaited_check(delivery_report_awaited_index, msg_ref, msgInd->st);
- if (mmi_frm_sms_check_delivery_report_awaited_complete(delivery_report_awaited_index))
- {
- msgInd->st = mmi_frm_sms_get_delivery_report_awaited_result(delivery_report_awaited_index);
- mmi_frm_sms_remove_delivery_report_awaited(delivery_report_awaited_index);
- mmi_frm_sms_convert_time_stamp(msgInd->dt, msgInd->dt);
- while (i < mmi_frm_sms_interrupt_handler_size)
- {
- if (mmi_frm_sms_interrupt_handler[i].msgid == PRT_MSG_ID_MMI_SMS_STATUS_REPORT_IND)
- {
- mmi_frm_sms_interrupt_handler[i].callback(inMsg, MOD_MMI, MMI_FRM_SMS_OK);
- break;
- }
- i++;
- }
- }
- }
- /* Also indicate user if the mr is not in delivery report awaited list */
- /* For the case that the sending maybe aborted but actually the SMS is sent */
- else
- {
- mmi_frm_sms_convert_time_stamp(msgInd->dt, msgInd->dt);
- while (i < mmi_frm_sms_interrupt_handler_size)
- {
- if (mmi_frm_sms_interrupt_handler[i].msgid == PRT_MSG_ID_MMI_SMS_STATUS_REPORT_IND)
- {
- mmi_frm_sms_interrupt_handler[i].callback(inMsg, MOD_MMI, MMI_FRM_SMS_OK);
- break;
- }
- i++;
- }
- }
- #else /* __MMI_MESSAGES_SINGLE_DELIVERY_REPORT__ */
- mmi_frm_sms_convert_time_stamp(msgInd->dt, msgInd->dt);
- while (i < mmi_frm_sms_interrupt_handler_size)
- {
- if (mmi_frm_sms_interrupt_handler[i].msgid == PRT_MSG_ID_MMI_SMS_STATUS_REPORT_IND)
- {
- mmi_frm_sms_interrupt_handler[i].callback(inMsg, MOD_MMI, MMI_FRM_SMS_OK);
- break;
- }
- i++;
- }
- #endif /* __MMI_MESSAGES_SINGLE_DELIVERY_REPORT__ */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_msg_waiting_ind
- * DESCRIPTION
- * Handle message waiting indication
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_msg_waiting_ind(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (i < mmi_frm_sms_interrupt_handler_size)
- {
- if (mmi_frm_sms_interrupt_handler[i].msgid == PRT_MSG_ID_MMI_SMS_MSG_WAITING_IND)
- {
- mmi_frm_sms_interrupt_handler[i].callback(inMsg, MOD_MMI, MMI_FRM_SMS_OK);
- break;
- }
- i++;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_mem_full_ind
- * DESCRIPTION
- * Handle memory full indication
- * PARAMETERS
- * inMsg [?]
- * dummy(?) [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_mem_full_ind(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (i < mmi_frm_sms_interrupt_handler_size)
- {
- if (mmi_frm_sms_interrupt_handler[i].msgid == PRT_MSG_ID_MMI_SMS_MEM_FULL_IND)
- {
- mmi_frm_sms_interrupt_handler[i].callback(inMsg, MOD_MMI, MMI_FRM_SMS_OK);
- break;
- }
- i++;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_mem_exceed_ind
- * DESCRIPTION
- * Handle memory exceed indication
- * PARAMETERS
- * inMsg [?]
- * dummy(?) [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_mem_exceed_ind(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (i < mmi_frm_sms_interrupt_handler_size)
- {
- if (mmi_frm_sms_interrupt_handler[i].msgid == PRT_MSG_ID_MMI_SMS_MEM_EXCEED_IND)
- {
- mmi_frm_sms_interrupt_handler[i].callback(inMsg, MOD_MMI, MMI_FRM_SMS_OK);
- break;
- }
- i++;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_mem_avai_ind
- * DESCRIPTION
- * Handle memory available indication
- * PARAMETERS
- * inMsg [?]
- * dummy(?) [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_mem_avai_ind(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (i < mmi_frm_sms_interrupt_handler_size)
- {
- if (mmi_frm_sms_interrupt_handler[i].msgid == PRT_MSG_ID_MMI_SMS_MEM_AVAILABLE_IND)
- {
- mmi_frm_sms_interrupt_handler[i].callback(inMsg, MOD_MMI, MMI_FRM_SMS_OK);
- break;
- }
- i++;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_new_msg_ind
- * DESCRIPTION
- * Callback new message indication
- * PARAMETERS
- * index [IN] New SMS index
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_new_msg_ind(U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- U16 *data = OslMalloc(sizeof(U16));
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *data = index;
- while (i < mmi_frm_sms_interrupt_handler_size)
- {
- if (mmi_frm_sms_interrupt_handler[i].msgid == PRT_MSG_ID_MMI_SMS_DELIVER_MSG_IND)
- {
- mmi_frm_sms_interrupt_handler[i].callback((void*)data, MOD_MMI, MMI_FRM_SMS_OK);
- break;
- }
- i++;
- }
- OslMfree(data);
- }
- //KP Jerry add on 2007-4-26 start
- #if defined(__MMI_CM_BLACK_LIST__) && defined(__MMI_CM_WHITE_LIST__)
- void mmi_frm_sms_remove_smsInBList_from_msgbox(U8 *data)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *index_bitmap = (U8*) data;
- U16 index = mmi_frm_sms_get_index(0, index_bitmap);
-
- kal_prompt_trace( MOD_SMS, " index =%d***********n",index);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (index != MMI_FRM_SMS_INVALID_INDEX)
- {
- mmi_frm_sms_remove_sms_entry(index);
- index++;
- index = mmi_frm_sms_get_index(index, index_bitmap);
- }
- return;
- }
- void mmi_frm_sms_delete_smsInBList_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_DEL_MSG_RSP_STRUCT *msgRsp = (MMI_FRM_SMS_DEL_MSG_RSP_STRUCT*) inMsg;
- U16 result = MMI_FRM_SMS_ERROR;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- kal_prompt_trace( MOD_SMS, " FirewallList_InvailFlag ==TRUE 2222n");
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_DEL_MSG_RSP);
- if (msgRsp->result == TRUE)
- {
- kal_prompt_trace( MOD_SMS, " FirewallList_InvailFlag ==TRUE 3333n");
- result = MMI_FRM_SMS_OK;
- mmi_frm_sms_remove_smsInBList_from_msgbox(msgRsp->del_bitmap);
- }
- mmi_frm_sms_callback_action(NULL, result);
- }
- void mmi_frm_sms_delete_smsInBList_req(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_DEL_MSG_REQ_STRUCT *msgReq;
- MMI_FRM_SMS_DELIVER_MSG_IND_STRUCT *msgInd = (MMI_FRM_SMS_DELIVER_MSG_IND_STRUCT*) inMsg;
- U8 *index = (U8*) inMsg;
-
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- msgReq = (MMI_FRM_SMS_DEL_MSG_REQ_STRUCT*) OslConstructDataPtr(sizeof(*msgReq));
- msgReq->del_flag = SMSAL_DEL_INDEXED_MSG;
- kal_prompt_trace( MOD_SMS, " msgReq->index1 =%dn",msgReq->index);
- msgReq->index = msgInd->index;
- // memcpy((S8*) msgReq->del_bitmap, (S8*) index, 480);
- // kal_prompt_trace( MOD_SMS, " msgReq->del_bitmap=%sn",msgReq->del_bitmap);
- kal_prompt_trace( MOD_SMS, " msgReq->del_flag =%dn",msgReq->del_flag);
- kal_prompt_trace( MOD_SMS, " msgReq->index2 =%dn",msgReq->index);
- SetProtocolEventHandler(mmi_frm_sms_delete_smsInBList_rsp, PRT_MSG_ID_MMI_SMS_DEL_MSG_RSP);
- // SetProtocolEventHandler(NULL, PRT_MSG_ID_MMI_SMS_DEL_MSG_RSP);
- mmi_frm_sms_send_message(MOD_MMI, MOD_L4C, 0, PRT_MSG_ID_MMI_SMS_DEL_MSG_REQ, (oslParaType*) msgReq, NULL);
- OslMfree(inMsg);
- }
- #endif
- //KP Jerry add on 2007-4-26 end
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_new_sms_ind
- * DESCRIPTION
- * Handle new SMS indication
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- //KP Jerry add on 2007-4-26 start
- #if defined(__MMI_CM_BLACK_LIST__) && defined(__MMI_CM_WHITE_LIST__)
- BOOL SMS_DeleteFlag = 0;
- U16 SMS_DeleteIndex = 0;
- #endif
- //KP Jerry add on 2007-4-26 end
- void mmi_frm_sms_new_sms_ind(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- //KP Jerry add on 2007-4-26 start
- #if defined(__MMI_CM_BLACK_LIST__) && defined(__MMI_CM_WHITE_LIST__)
- U32 newNumber ;
- #endif
- //KP Jerry add on 2007-4-26 end
- MMI_FRM_SMS_DELIVER_MSG_IND_STRUCT *msgInd = (MMI_FRM_SMS_DELIVER_MSG_IND_STRUCT*) inMsg;
- mmi_frm_sms_deliver_msg_struct *data = OslMalloc(sizeof(mmi_frm_sms_deliver_msg_struct));
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- //KP Jerry add on 2007-4-26 start
- #if defined(__MMI_CM_BLACK_LIST__) && defined(__MMI_CM_WHITE_LIST__)
- newNumber = mmi_phb_util_convert_number_to_int(msgInd->oa_number.number);
- if(Sms_GetNumFromFirewallList_InvailFlag(newNumber))
- {
- Set_Firewall_SmsDeleteFlag(TRUE);
- Set_Firewall_SmsDeleteIndex(msgInd->index);
- CHISTIncRecvdSMS();
- mmi_frm_sms_convert_new_sms(msgInd, data);
- /* put to awaited list last entry, from now on only process new data as awaited list last entry */
- mmi_frm_sms_add_new_sms(data, msgInd->no_msg_data, msgInd->msg_data);
- //mmi_frm_sms_set_bitmap(msgInd->index,msgInd->oa_number.number);
- mmi_msg_delete_msg_req(MMI_FRM_SMS_APP_INBOX, msgInd->index);
- OslMfree(data);
- return;
- }
- else
- Set_Firewall_SmsDeleteFlag(FALSE);
- #endif
- //KP Jerry add on 2007-4-26 end
- CHISTIncRecvdSMS();
- /* convert L4 data to MMI data */
- mmi_frm_sms_convert_new_sms(msgInd, data);
- /* put to awaited list last entry, from now on only process new data as awaited list last entry */
- mmi_frm_sms_add_new_sms(data, msgInd->no_msg_data, msgInd->msg_data);
- /* process new sms data */
- mmi_frm_sms_new_sms();
- OslMfree(data);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_new_data_ind
- * DESCRIPTION
- * Handle new SMS with port number indication
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_new_data_ind(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_APP_DATA_IND_STRUCT *msgInd = (MMI_FRM_SMS_APP_DATA_IND_STRUCT*) inMsg;
- mmi_frm_sms_deliver_data_struct *data = OslMalloc(sizeof(mmi_frm_sms_deliver_data_struct));
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* convert L4 data to MMI data */
- mmi_frm_sms_convert_new_data(msgInd, data);
- /* put to awaited list last entry, from now on only process new data as awaited list last entry */
- mmi_frm_sms_add_new_data(data, msgInd->message_len, msgInd->msg_data);
- /* process new sms data */
- mmi_frm_sms_new_data();
- OslMfree(data);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_reg_port_rsp
- * DESCRIPTION
- * Register port response
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_reg_port_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_REG_PORT_NUM_RSP_STRUCT *msgRsp = (MMI_FRM_SMS_REG_PORT_NUM_RSP_STRUCT*) inMsg;
- U16 result = MMI_FRM_SMS_ERROR;
- U16 cause = msgRsp->cause;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_REG_PORT_NUM_RSP);
- if (msgRsp->result == TRUE)
- {
- result = MMI_FRM_SMS_OK;
- }
- mmi_frm_sms_callback_action((void*)&cause, result);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_reg_port_req
- * DESCRIPTION
- * Register port request
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_reg_port_req(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_REG_PORT_NUM_REQ_STRUCT *msgReq;
- mmi_sms_reg_port_num_req_struct *data = (mmi_sms_reg_port_num_req_struct*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- msgReq = (MMI_FRM_SMS_REG_PORT_NUM_REQ_STRUCT*) OslConstructDataPtr(sizeof(*msgReq));
- msgReq->enable = data->enable;
- msgReq->mod_id = data->mod_id;
- msgReq->port_num = data->port_num;
- SetProtocolEventHandler(mmi_frm_sms_reg_port_rsp, PRT_MSG_ID_MMI_SMS_REG_PORT_NUM_RSP);
- mmi_frm_sms_send_message(MOD_MMI, MOD_L4C, 0, PRT_MSG_ID_MMI_SMS_REG_PORT_NUM_REQ, (oslParaType*) msgReq, NULL);
- OslMfree(inMsg);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_sc_addr_rsp
- * DESCRIPTION
- * Get SC address response
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_get_sc_addr_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_GET_PROFILE_PARAMS_RSP_STRUCT *msgRsp = (MMI_FRM_SMS_GET_PROFILE_PARAMS_RSP_STRUCT*) inMsg;
- U16 result = MMI_FRM_SMS_ERROR;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_GET_PROFILE_PARAMS_RSP);
- if (msgRsp->result == TRUE)
- {
- result = MMI_FRM_SMS_OK;
- if (msgRsp->sc_addr.length == 0)
- {
- if (sendSMS->sendcheck & MMI_FRM_SMS_NOT_ALLOW_EMPTY_SC)
- {
- mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_SC_EMPTY);
- mmi_frm_sms_free_sendsms_data();
- }
- else
- {
- mmi_frm_sms_entry_sc();
- }
- }
- else
- {
- sendSMS->sendcheck |= MMI_FRM_SMS_SC;
- mmi_frm_sms_send_sms_req();
- }
- }
- else
- {
- mmi_frm_sms_callback_action(NULL, result);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_get_sc_addr_req
- * DESCRIPTION
- * Get SC address request
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_get_sc_addr_req(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_GET_PROFILE_PARAMS_REQ_STRUCT *msgReq;
- U8 index = *(U8*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- msgReq = (MMI_FRM_SMS_GET_PROFILE_PARAMS_REQ_STRUCT*) OslConstructDataPtr(sizeof(*msgReq));
- msgReq->profile_no = index;
- SetProtocolEventHandler(mmi_frm_sms_get_sc_addr_rsp, PRT_MSG_ID_MMI_SMS_GET_PROFILE_PARAMS_RSP);
- mmi_frm_sms_send_message(
- MOD_MMI,
- MOD_L4C,
- 0,
- PRT_MSG_ID_MMI_SMS_GET_PROFILE_PARAMS_REQ,
- (oslParaType*) msgReq,
- NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_set_sc_addr_rsp
- * DESCRIPTION
- * Set SC address response
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_set_sc_addr_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_SET_PROFILE_PARAMS_RSP_STRUCT *msgRsp = (MMI_FRM_SMS_SET_PROFILE_PARAMS_RSP_STRUCT*) inMsg;
- U16 result = MMI_FRM_SMS_ERROR;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_SET_PROFILE_PARAMS_RSP);
- if (msgRsp->result == TRUE)
- {
- result = MMI_FRM_SMS_OK;
- /* sending screen is displayed by SMS framework */
- if ((sendSMS->sendcheck & MMI_FRM_SMS_SCR) != MMI_FRM_SMS_SCR)
- {
- DisplayPopupCallBack(
- (PU8) GetString(STR_GLOBAL_SAVED),
- IMG_GLOBAL_ACTIVATED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) SUCCESS_TONE,
- mmi_frm_sms_send_sms_req);
- }
- else /* sending screen is displayed by applications */
- {
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_SAVED),
- IMG_GLOBAL_ACTIVATED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) SUCCESS_TONE);
- StartTimer(
- MESSAGES_CONTINUE_SEND_SMS_PROCESS_TIMER_ID,
- MESSAGES_POPUP_TIME_OUT,
- mmi_frm_sms_send_sms_req);
- }
- DeleteScreenIfPresent(SCR_ID_MSG_SC_NUMBER);
- sendSMS->sendcheck |= MMI_FRM_SMS_SC;
- }
- else
- {
- DisplayPopup(
- (PU8) GetString(STR_MESSAGES_UNKNOWN_ERROR),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- DeleteScreenIfPresent(SCR_ID_MSG_SC_NUMBER);
- mmi_frm_sms_callback_action(NULL, result);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_set_sc_addr_req
- * DESCRIPTION
- * Set SC address request
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_set_sc_addr_req(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_SET_PROFILE_PARAMS_REQ_STRUCT *msgReq;
- msg_profile_edit_struct *profile = (msg_profile_edit_struct*) inMsg;
- S8 scAddress[MAX_DIGITS_SMS * ENCODING_LENGTH];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- msgReq = (MMI_FRM_SMS_SET_PROFILE_PARAMS_REQ_STRUCT*) OslConstructDataPtr(sizeof(*msgReq));
- memset(scAddress, 0, MAX_DIGITS_SMS * ENCODING_LENGTH);
- UnicodeNToAnsii((PS8) scAddress, (PS8) profile->scAddress, MAX_DIGITS_SMS * ENCODING_LENGTH);
- msgReq->profile_no = profile->profileIndex;
- if (scAddress[0] == '+')
- {
- msgReq->sc_addr.type = CSMCC_INTERNATIONAL_ADDR;
- msgReq->sc_addr.length = (strlen(scAddress) > MAX_DIGITS_SMS) ? (MAX_DIGITS_SMS - 1) : (strlen(scAddress) - 1);
- memcpy(msgReq->sc_addr.number, scAddress + 1, msgReq->sc_addr.length);
- }
- else
- {
- msgReq->sc_addr.type = CSMCC_DEFAULT_ADDR_TYPE;
- msgReq->sc_addr.length =
- (strlen(scAddress) > (MAX_DIGITS_SMS - 1)) ? (MAX_DIGITS_SMS - 1) : (strlen(scAddress));
- memcpy(msgReq->sc_addr.number, scAddress, msgReq->sc_addr.length);
- }
- memset(&msgReq->sc_addr.number[msgReq->sc_addr.length], 0, 1);
- msgReq->para_ind = SMSAL_PARA_SCA;
- SetProtocolEventHandler(mmi_frm_sms_set_sc_addr_rsp, PRT_MSG_ID_MMI_SMS_SET_PROFILE_PARAMS_RSP);
- mmi_frm_sms_send_message(
- MOD_MMI,
- MOD_L4C,
- 0,
- PRT_MSG_ID_MMI_SMS_SET_PROFILE_PARAMS_REQ,
- (oslParaType*) msgReq,
- NULL);
- }
- #ifdef _CHECK_FDL_BY_MMI_
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_check_fdl_rsp
- * DESCRIPTION
- * Check FDL response
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_check_fdl_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_FDN_CHECK_RSP_STRUCT *msgRsp = (MMI_FRM_SMS_FDN_CHECK_RSP_STRUCT*) inMsg;
- U16 result = MMI_FRM_SMS_ERROR;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_FDN_CHECK_RSP);
- if ((msgRsp->result) == TRUE)
- {
- result = MMI_FRM_SMS_OK;
- sendSMS->sendcheck |= MMI_FRM_SMS_FDL;
- mmi_frm_sms_send_sms_req();
- }
- else
- {
- mmi_frm_sms_callback_action(NULL, result);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_check_fdl_req
- * DESCRIPTION
- * Check FDL request
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_check_fdl_req(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_FDN_CHECK_REQ_STRUCT *msgReq;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- msgReq = (MMI_FRM_SMS_FDN_CHECK_REQ_STRUCT*) OslConstructDataPtr(sizeof(*msgReq));
- SetProtocolEventHandler(mmi_frm_sms_check_fdl_rsp, PRT_MSG_ID_MMI_SMS_FDN_CHECK_RSP);
- mmi_frm_sms_send_message(MOD_MMI, MOD_L4C, 0, PRT_MSG_ID_MMI_SMS_FDN_CHECK_REQ, (oslParaType*) msgReq, NULL);
- OslMfree(inMsg);
- }
- #endif /* _CHECK_FDL_BY_MMI_ */
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_abort_sms_rsp
- * DESCRIPTION
- * Abort SMS response
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_abort_sms_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_SEND_ABORT_FINISH_IND_STRUCT *msgRsp = (MMI_FRM_SMS_SEND_ABORT_FINISH_IND_STRUCT*) inMsg;
- U16 result = MMI_FRM_SMS_ERROR;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_SEND_ABORT_FINISH_IND);
- g_frm_sms_cntx.is_aborting = MMI_FALSE;
- if (msgRsp->result == TRUE)
- {
- result = MMI_FRM_SMS_OK;
- }
- mmi_frm_sms_free_sendsms_data();
- mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_ABORT);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_abort_sms_ind
- * DESCRIPTION
- * Handle abort indication
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_abort_sms_ind(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_SEND_MSG_RSP);
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_SEND_ABORT_START_IND);
- mmi_frm_sms_entry_abort();
- SetProtocolEventHandler(mmi_frm_sms_abort_sms_rsp, PRT_MSG_ID_MMI_SMS_SEND_ABORT_FINISH_IND);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_abort_sms_req
- * DESCRIPTION
- * Abort SMS request
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_abort_sms_req(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_frm_sms_abort_sms_ind(NULL);
- g_frm_sms_cntx.is_aborting = MMI_TRUE;
- mmi_frm_sms_send_message(MOD_MMI, MOD_L4C, 0, PRT_MSG_ID_MMI_SMS_ABORT_REQ, NULL, NULL);
- }
- #ifdef __MMI_UNIFIED_MESSAGE__
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_callback_abort_sms_by_end_key
- * DESCRIPTION
- * Abort SMS by end key callback
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_callback_abort_sms_by_end_key(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *number = OslMalloc(MAX_DIGITS_SMS);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset((S8*) number, 0, MAX_DIGITS_SMS);
- memcpy((S8*) number, (S8*) sendSMS->number, MAX_DIGITS_SMS);
- mmi_frm_sms_callback_action(number, MMI_FRM_SMS_END_FROM_SENDING);
- OslMfree(number);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_abort_sms_by_end_key_rsp
- * DESCRIPTION
- * Abort SMS by end key response
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_abort_sms_by_end_key_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* MMI_FRM_SMS_SEND_ABORT_FINISH_IND_STRUCT *msgRsp = (MMI_FRM_SMS_SEND_ABORT_FINISH_IND_STRUCT*)inMsg; */
- g_frm_sms_cntx.is_aborting = MMI_FALSE;
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_SEND_ABORT_FINISH_IND);
- mmi_frm_sms_free_sendsms_data();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_abort_sms_req_by_end_key
- * DESCRIPTION
- * Abort SMS request without processing screen
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_abort_sms_req_by_end_key(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_SEND_MSG_RSP);
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_SEND_ABORT_START_IND);
- SetProtocolEventHandler(mmi_frm_sms_abort_sms_by_end_key_rsp, PRT_MSG_ID_MMI_SMS_SEND_ABORT_FINISH_IND);
- g_frm_sms_cntx.is_aborting = MMI_TRUE;
- mmi_frm_sms_send_message(MOD_MMI, MOD_L4C, 0, PRT_MSG_ID_MMI_SMS_ABORT_REQ, NULL, NULL);
- }
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_abort_sms_callback
- * DESCRIPTION
- * Abort SMS callback
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_abort_sms_callback(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_frm_sms_cntx.is_aborting = MMI_FALSE;
- mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_ABORT);
- mmi_frm_sms_free_sendsms_data();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_abort_sms_dummy_rsp
- * DESCRIPTION
- * Abort SMS dummy response
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_abort_sms_dummy_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* MMI_FRM_SMS_SEND_ABORT_FINISH_IND_STRUCT *msgRsp = (MMI_FRM_SMS_SEND_ABORT_FINISH_IND_STRUCT*)inMsg; */
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_SEND_ABORT_FINISH_IND);
- g_frm_sms_cntx.is_aborting = MMI_FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_abort_sending_sms_req
- * DESCRIPTION
- * Abort Sending SMS request
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_abort_sending_sms_req(mmi_frm_sms_abort_enum type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_SEND_MSG_RSP);
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_SEND_ABORT_START_IND);
-
- g_frm_sms_cntx.is_aborting = MMI_TRUE;
- if (type == MMI_FRM_SMS_ABORT_WITH_FINISH_IND)
- {
- SetProtocolEventHandler(mmi_frm_sms_abort_sms_rsp, PRT_MSG_ID_MMI_SMS_SEND_ABORT_FINISH_IND);
- mmi_frm_sms_send_message(MOD_MMI, MOD_L4C, 0, PRT_MSG_ID_MMI_SMS_ABORT_REQ, NULL, NULL);
- }
- else if (type == MMI_FRM_SMS_ABORT_WITHOUT_FINISH_IND)
- {
- SetProtocolEventHandler(mmi_frm_sms_abort_sms_dummy_rsp, PRT_MSG_ID_MMI_SMS_SEND_ABORT_FINISH_IND);
- mmi_frm_sms_send_message(MOD_MMI, MOD_L4C, 0, PRT_MSG_ID_MMI_SMS_ABORT_REQ, NULL, NULL);
- mmi_frm_sms_abort_sms_callback();
- }
- else
- {
- MMI_ASSERT(0);
- }
- }
- /* loop handle */
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_send_sms_rsp
- * DESCRIPTION
- * Send SMS response
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_send_sms_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_SEND_MSG_RSP_STRUCT *msgRsp = (MMI_FRM_SMS_SEND_MSG_RSP_STRUCT*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PendingSaveSendData.presentSegments--;
- if ((msgRsp->result) == TRUE)
- {
- CHISTIncSentSMS();
- }
- else
- {
- sendResult = MMI_FRM_SMS_ERROR;
- }
- #ifdef __MMI_MESSAGES_SINGLE_DELIVERY_REPORT__
- if (g_frm_sms_cntx.mmi_frm_sms_delivery_report_setting)
- {
- mmi_frm_sms_check_delivery_report_awaited(msgRsp);
- }
- #endif /* __MMI_MESSAGES_SINGLE_DELIVERY_REPORT__ */
- /* send SMS: pack and send the following segment, inMsg keeps the sent index */
- if (PendingSaveSendData.nextSegment < PendingSaveSendData.totalSegments)
- {
- mmi_frm_sms_send_sms_seg();
- }
- if (PendingSaveSendData.presentSegments == 0)
- {
- /* not always; use a flag to check */
- U8 *number = OslMalloc(MAX_DIGITS_SMS);
- memset((S8*) number, 0, MAX_DIGITS_SMS);
- memcpy((S8*) number, (S8*) sendSMS->number, MAX_DIGITS_SMS);
- if (((sendSMS->sendrequire & MMI_FRM_SMS_SAVE) == 0) &&
- ((sendSMS->sendrequire & MMI_FRM_SMS_SAVE_AFTER_FAIL) == 0))
- {
- ReleaseEMSEditBuffer();
- }
- mmi_frm_sms_free_sendsms_data();
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_SEND_MSG_RSP);
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_SEND_ABORT_START_IND);
- /* no more to send or send fail: returns the result */
- mmi_frm_sms_callback_action((void*)number, sendResult);
- OslMfree(number);
- }
- }
- extern void MoveCursorToPosition(EMSData *data, EMSPosition *dst);
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_pack_sms
- * DESCRIPTION
- * Pack SMS before send/save
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- U16 mmi_frm_sms_pack_sms(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EMSData *pEMS = GetEMSDataForEdit(0, 0);
- EMSPosition SavedPosition = pEMS->CurrentPosition;
- U16 i;
- U16 result;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(PendingSaveSendData.TPUD, 0, sizeof(PendingSaveSendData.TPUD));
- #if defined(MMI_ON_WIN32) && ( defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- g_frm_sms_cntx.mmi_frm_sms_msg_seg_size = 4;
- #endif /* defined(MMI_ON_WIN32) && ( defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */
- for (i = 0; i < g_frm_sms_cntx.mmi_frm_sms_msg_seg_size; i++)
- {
- PendingSaveSendData.TPUD_udhi[i] = 0;
- PendingSaveSendData.TPUDLen[i] = 0;
- PendingSaveSendData.TPUD_p[i] = &PendingSaveSendData.TPUD[i * MMI_FRM_SMS_MSG_LEN];
- }
- if (pEMS->dcs == SMSAL_DEFAULT_DCS || pEMS->dcs == SMSAL_UCS2_DCS)
- {
- #ifdef MMI_ON_HARDWARE_P
- if (check_sim_card_status() == TEST_SIM_PRESENCE)
- {
- EMS_ConvertAsciiEncodingToGSM7BitDefault(pEMS);
- }
- else
- #endif /* MMI_ON_HARDWARE_P */
- EMS_ConvertAsciiEncodingToGSM7BitDefaultWithExtended(pEMS);
- }
- result = EMSPack(
- pEMS,
- 1,
- &PendingSaveSendData.totalSegments,
- PendingSaveSendData.TPUD_p,
- PendingSaveSendData.TPUDLen);
- if (pEMS->dcs == SMSAL_DEFAULT_DCS || pEMS->dcs == SMSAL_UCS2_DCS)
- {
- #ifdef MMI_ON_HARDWARE_P
- if (check_sim_card_status() == TEST_SIM_PRESENCE)
- {
- EMS_ConvertGSM7BitDefaultEncodingToAscii(pEMS);
- }
- else
- #endif /* MMI_ON_HARDWARE_P */
- EMS_ConvertGSM7BitDefaultEncodingToAsciiWithExtended(pEMS);
- }
- MoveCursorToPosition(pEMS, &SavedPosition);
- if (sendSMS != NULL) /* in sending procedure */
- {
- PendingSaveSendData.phNumber = (S8*) sendSMS->number;
- }
- else if (saveSMS != NULL) /* in saving procedure */
- {
- PendingSaveSendData.phNumber = (S8*) saveSMS->number;
- }
- else
- {
- MMI_ASSERT(sendSMS != NULL || saveSMS != NULL);
- }
- PendingSaveSendData.udhi = pEMS->udhi;
- PendingSaveSendData.dcs = pEMS->ps_dcs;
- return result;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_unpack_sms
- * DESCRIPTION
- * Unpack SMS after read/receive
- * PARAMETERS
- * dcs [IN] Dcs
- * fo [IN] Fo
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_unpack_sms(U8 dcs, U8 fo, U8 ori_dcs)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- EMSData *pEMSdata;
- U8 UDHI;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_MESSAGES_USE_URL__
- GetEMSDataForView(&pEMSdata, 0);
- memset(pEMSdata->textBuffer, 0x00, pEMSdata->textLength); /* Remove previous message content */
- #endif /* __MMI_MESSAGES_USE_URL__ */
- GetEMSDataForView(&pEMSdata, 1);
- if (PendingSaveSendData.totalSegments == 1)
- {
- UDHI = GetUDHIBit(fo);
- }
- else
- {
- UDHI = KAL_TRUE;
- for (i = 0; i < PendingSaveSendData.totalSegments; i++)
- {
- if (PendingSaveSendData.TPUD_udhi[i] == KAL_FALSE)
- {
- PendingSaveSendData.TPUD_p[i] = NULL;
- }
- }
- }
- if ((EMSSetDCS(pEMSdata, dcs) == EMS_OK) &&
- (EMSUnPack(pEMSdata, UDHI, PendingSaveSendData.totalSegments, PendingSaveSendData.TPUD_p,
- PendingSaveSendData.TPUDLen) == EMS_OK) &&
- (EMSSetOriDCS(pEMSdata, ori_dcs) == EMS_OK))
- {
- }
- else
- {
- GetEMSDataForView(&pEMSdata, 1);
- if (PendingSaveSendData.totalSegments == 1)
- {
- UDHI = KAL_FALSE;
- }
- else
- {
- UDHI = KAL_TRUE;
- }
- for (i = 0; i < PendingSaveSendData.totalSegments; i++)
- {
- PendingSaveSendData.TPUD_p[i] = NULL;
- PendingSaveSendData.TPUDLen[i] = 0;
- }
- EMSSetDCS(pEMSdata, SMSAL_DEFAULT_DCS);
- EMSUnPack(
- pEMSdata,
- UDHI,
- PendingSaveSendData.totalSegments,
- PendingSaveSendData.TPUD_p,
- PendingSaveSendData.TPUDLen);
- }
- if (pEMSdata->dcs == SMSAL_DEFAULT_DCS || pEMSdata->dcs == SMSAL_UCS2_DCS)
- {
- #ifdef MMI_ON_HARDWARE_P
- if (check_sim_card_status() == TEST_SIM_PRESENCE)
- {
- EMS_ConvertGSM7BitDefaultEncodingToAscii(pEMSdata);
- }
- else
- #endif /* MMI_ON_HARDWARE_P */
- EMS_ConvertGSM7BitDefaultEncodingToAsciiWithExtended(pEMSdata);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_send_sms_seg
- * DESCRIPTION
- * Send SMS segment
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_send_sms_seg(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_SEND_MSG_REQ_STRUCT *sendSms;
- S8 *addr = (S8*) sendSMS->number;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- sendSms = (MMI_FRM_SMS_SEND_MSG_REQ_STRUCT*) OslConstructDataPtr(sizeof(*sendSms));
- sendSms->dcs = PendingSaveSendData.dcs;
- sendSms->udhi = PendingSaveSendData.udhi;
- sendSms->length = PendingSaveSendData.TPUDLen[PendingSaveSendData.nextSegment];
- memset(sendSms->msg, 0, SMSAL_MAX_MSG_LEN);
- //KP Jerry add for third sevice on 2007-03-26 start
- #ifdef __KONG_NET_SP__
- if(pfnUnicodeStrlen(g_msg_cntx.dfmsg)>0)
- {
- UnicodeToAnsii((S8*)sendSms->msg, (S8*)g_msg_cntx.dfmsg);
- sendSms->msg[(U8)pfnUnicodeStrlen(g_msg_cntx.dfmsg)] = ' ';
- sendSms->length = pfnUnicodeStrlen(g_msg_cntx.dfmsg);
- memset(g_msg_cntx.dfmsg,0,sizeof(g_msg_cntx.dfmsg));
- }
- else
- #endif
- //KP Jerry add for third sevice on 2007-03-26 end
- memcpy(
- sendSms->msg,
- PendingSaveSendData.TPUD_p[PendingSaveSendData.nextSegment],
- PendingSaveSendData.TPUDLen[PendingSaveSendData.nextSegment]);
- sendSms->profile = sendSMS->profile;
- sendSms->para = 0;
- sendSms->reply_index = MMI_FRM_SMS_INVALID_INDEX;
- if ((sendSMS->sendrequire & MMI_FRM_SMS_REPLY) == MMI_FRM_SMS_REPLY)
- {
- U8 *replyaddr = mmi_frm_sms_get_sms_address(MMI_FRM_SMS_INBOX, sendSMS->replyindex);
- U16 l4_index[MMI_SMS_MAX_MSG_SEG];
- U8 i = 0;
- memset((S8*) sendSMS->number, 0, MAX_DIGITS_SMS);
- memcpy((S8*) sendSMS->number, (S8*) replyaddr, strlen((S8*) replyaddr));
- mmi_frm_sms_get_sms_index(MMI_FRM_SMS_INBOX, sendSMS->replyindex, l4_index);
- while (i < g_frm_sms_cntx.mmi_frm_sms_msg_seg_size)
- {
- if (l4_index[i] != MMI_FRM_SMS_INVALID_INDEX)
- {
- sendSms->reply_index = l4_index[i];
- break;
- }
- i++;
- }
- }
- if (sendSMS->number[0] == '+')
- {
- sendSms->dest.type = CSMCC_INTERNATIONAL_ADDR;
- addr++;
- }
- else
- {
- sendSms->dest.type = CSMCC_DEFAULT_ADDR_TYPE;
- }
- memset((S8*) sendSms->dest.number, 0, MAX_CC_ADDR_LEN);
- memcpy((S8*) sendSms->dest.number, (S8*) addr, strlen((S8*) addr));
- sendSms->dest.length = strlen((S8*) addr);
- sendSms->seq_num = PendingSaveSendData.nextSegment;
- /* set to 0 only in the last segment of the last message */
- if (((PendingSaveSendData.nextSegment + 1) < PendingSaveSendData.totalSegments) ||
- ((g_msg_cntx.msg_send_info.CurrSendSmsNumbers + 1) < g_msg_cntx.msg_send_info.TotalSendSmsNumbers))
- {
- sendSms->mms_mode = 1;
- }
- else
- {
- sendSms->mms_mode = 0;
- }
- mmi_frm_sms_send_message(MOD_MMI, MOD_L4C, 0, PRT_MSG_ID_MMI_SMS_SEND_MSG_REQ, (oslParaType*) sendSms, NULL);
- PendingSaveSendData.nextSegment++;
- PendingSaveSendData.presentSegments++;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_pre_send_sms
- * DESCRIPTION
- * Pre-send SMS: copy useful data and set flags
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_pre_send_sms(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_frm_sms_send_struct *sendData = (mmi_frm_sms_send_struct*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #if defined(MMI_ON_WIN32) && (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- g_frm_sms_cntx.mmi_frm_sms_ready = 1; /* Just for testing */
- #endif
- if (mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_NOBOX) == MMI_FRM_SMS_INVALID_INDEX ||
- g_frm_sms_cntx.is_aborting )/* The response of the abort is not received. */
- {
- mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_NOTREADY);
- if (sendData->string != NULL)
- {
- OslMfree(sendData->string);
- sendData->string = NULL;
- }
- OslMfree(sendData);
- return;
- }
- mmi_frm_sms_free_sendsms_data();
- sendSMS = OslMalloc(sizeof(mmi_frm_sms_send_struct));
- memcpy((S8*) sendSMS, (S8*) sendData, sizeof(mmi_frm_sms_send_struct));
- OslMfree(sendData);
- mmi_frm_sms_send_sms_req();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_entry_number_done
- * DESCRIPTION
- * After input number, keep send process
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_entry_number_done(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 len = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UnicodeToAnsii((S8*) sendSMS->number, (S8*) g_frm_sms_cntx.mmi_frm_sms_number);
- len = strlen((S8*) sendSMS->number) <
- sizeof(sendSMS->number) ? strlen((S8*) sendSMS->number) : sizeof(sendSMS->number);
- if (len == 0)
- {
- DisplayPopup(
- (PU8) GetString(STR_SMS_NUM_CANNOT_BE_EMPTY),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- else if (mmi_frm_sms_check_dst_number(sendSMS->number, len) == KAL_FALSE)
- {
- DisplayPopup(
- (PU8) GetString(STR_ID_PHB_NUM_INVALID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- else
- {
- mmi_frm_sms_send_sms_req();
- }
- }
- extern EMSTATUS EMSSetMsgClass(EMSData *emsData, kal_uint8 msg_class);
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_send_sms_req
- * DESCRIPTION
- * Send SMS request: check sc, number and copy content for send
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_send_sms_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /* MOD_MMI only, other module skips */
- EMSData *pEMS;
- U8 i, j;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #if defined(MMI_ON_WIN32) && (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- sendSMS->sendcheck = 1;
- #endif
- /* check SC: get SC address, inMsg keeps the flag */
- if ((sendSMS->sendcheck & MMI_FRM_SMS_SC) != MMI_FRM_SMS_SC)
- {
- S16 errorCode = 0;
- S8 nvramActiveProfileIndex = 0;
- ReadValue(NVRAM_SMS_ACTIVE_PROFILE_INDEX, &nvramActiveProfileIndex, DS_BYTE, &errorCode);
- mmi_frm_sms_get_sc_addr_req(&nvramActiveProfileIndex);
- sendSMS->profile = nvramActiveProfileIndex;
- return;
- }
- /* check DA: show input screen, inMsg keeps the number */
- if ((sendSMS->sendcheck & MMI_FRM_SMS_DA) != MMI_FRM_SMS_DA)
- {
- memset((S8*) g_frm_sms_cntx.mmi_frm_sms_number, 0, MAX_DIGITS_SMS);
- if ((sendSMS->sendrequire & MMI_FRM_SMS_NUM_SCR) == MMI_FRM_SMS_NUM_SCR)
- {
- AnsiiToUnicodeString((S8*) g_frm_sms_cntx.mmi_frm_sms_number, (S8*) sendSMS->number);
- mmi_frm_sms_entry_number();
- sendSMS->sendrequire &= ~MMI_FRM_SMS_NUM_SCR;
- return;
- }
- else if ((strlen((S8*) sendSMS->number) == 0) && ((sendSMS->sendrequire & MMI_FRM_SMS_REPLY) == 0))
- {
- if (GetCurrScrnId() != SCR_ID_MSG_NUMBER)
- {
- mmi_frm_sms_entry_number();
- }
- return;
- }
- sendSMS->sendcheck |= MMI_FRM_SMS_DA;
- }
- /* check validity of DA */
- {
- U8 len = strlen((S8*) sendSMS->number) <
- sizeof(sendSMS->number) ? strlen((S8*) sendSMS->number) : sizeof(sendSMS->number);
- /* some digit is not numeric */
- if (mmi_frm_sms_check_dst_number(sendSMS->number, len) == KAL_FALSE)
- {
- mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_NUMINVALID);
- mmi_frm_sms_free_sendsms_data();
- return;
- }
- }
- /* check FDL: when FDN on */
- #ifdef _CHECK_FDL_BY_MMI_
- if ((sendSMS->sendcheck & MMI_FRM_SMS_FDL) != MMI_FRM_SMS_FDL)
- {
- if (gSecuritySetupContext.FdlStatus)
- {
- U8 *msg = OslMalloc(strlen((S8*) sendSMS->number));
- memcpy((S8*) msg, (S8*) sendSMS->number, strlen((S8*) sendSMS->number));
- mmi_frm_sms_check_fdl_req(msg);
- return;
- }
- sendSMS->sendcheck |= MMI_FRM_SMS_FDL;
- }
- #endif /* _CHECK_FDL_BY_MMI_ */
- {
- S8 *textbuf = NULL;
- S8 *textbufucs2 = NULL;
- U16 textlen = 0;
- U16 result = 0;
- history temphistory;
- if (sendSMS->filename != NULL)
- {
- S32 errorCode = 0;
- FILE_HANDLE emsObjectFilePtr;
- emsObjectFilePtr = pfopen((U8*) sendSMS->filename, PFS_READ);
- /* the file exists without error */
- if (!pfOpenError(emsObjectFilePtr))
- {
- textlen = (U16) GetFSFileSize(emsObjectFilePtr);
- /* the file size is 0 */
- if (textlen == 0)
- {
- pfclose(emsObjectFilePtr);
- mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_DATAEMPTY);
- mmi_frm_sms_free_sendsms_data();
- return;
- }
- if (sendSMS->dcs == SMSAL_8BIT_DCS)
- {
- /* the file is too large. */
- if (textlen > (MMI_FRM_SMS_MSG_LEN * MMI_SMS_MAX_MSG_SEG) ||
- textlen > ((MMI_FRM_SMS_MAX_CONTROL_BUFFER_SIZE / ENCODING_LENGTH) - 1))
- {
- pfclose(emsObjectFilePtr);
- mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_DATAEXCEED);
- mmi_frm_sms_free_sendsms_data();
- return;
- }
- /* the file size is allowed */
- textbuf = OslMalloc(textlen + 1);
- pfread(textbuf, 1, textlen, emsObjectFilePtr, &errorCode);
- pfclose(emsObjectFilePtr);
- /* the file content is corrupted */
- if (pfError(errorCode))
- {
- mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_DATAINVALID);
- OslMfree(textbuf);
- mmi_frm_sms_free_sendsms_data();
- return;
- }
- /* the file content is allowed */
- textbufucs2 = OslMalloc((textlen + 1) * ENCODING_LENGTH);
- AnsiiNToUnicodeString(textbufucs2, textbuf, textlen);
- memset(textbufucs2 + textlen * ENCODING_LENGTH, 0, ENCODING_LENGTH);
- OslMfree(textbuf);
- }
- /* UCS2 and DEFAULT DCS */
- else
- {
- /* the file is too large. */
- if (textlen > (MMI_FRM_SMS_MSG_LEN * MMI_SMS_MAX_MSG_SEG) ||
- textlen > (MMI_FRM_SMS_MAX_CONTROL_BUFFER_SIZE - ENCODING_LENGTH))
- {
- pfclose(emsObjectFilePtr);
- mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_DATAEXCEED);
- mmi_frm_sms_free_sendsms_data();
- return;
- }
- /* the file size is allowed */
- textbuf = OslMalloc(textlen + ENCODING_LENGTH);
- pfread(textbuf, 1, textlen, emsObjectFilePtr, &errorCode);
- pfclose(emsObjectFilePtr);
- /* the file content is corrupted */
- if (pfError(errorCode))
- {
- mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_DATAINVALID);
- OslMfree(textbuf);
- mmi_frm_sms_free_sendsms_data();
- return;
- }
- /* the file content is allowed */
- textbufucs2 = OslMalloc((textlen + ENCODING_LENGTH));
- memset(textbufucs2, 0, (textlen + ENCODING_LENGTH));
- memcpy(textbufucs2, textbuf, textlen);
- OslMfree(textbuf);
- }
- }
- else
- {
- mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_DATAINVALID);
- mmi_frm_sms_free_sendsms_data();
- return;
- }
- }
- else if (sendSMS->string != NULL && sendSMS->stringlength > 0)
- {
- textbufucs2 = OslMalloc((sendSMS->stringlength) * ENCODING_LENGTH);
- memset((S8*) textbufucs2, 0, ((sendSMS->stringlength) * ENCODING_LENGTH));
- memcpy(textbufucs2, sendSMS->string, ((sendSMS->stringlength) * ENCODING_LENGTH));
- }
- if (textbufucs2)
- {
- EMSTATUS EMSSetPortResult = EMS_OK;
- EMSTATUS EMSSetClassResult = EMS_OK;
- ReleaseEMSEditBuffer();
- pEMS = GetEMSDataForEdit(0, 1);
- #ifdef MMI_ON_HARDWARE_P
- if ((sendSMS->sendrequire & MMI_FRM_SMS_PORT) == MMI_FRM_SMS_PORT)
- {
- EMSSetPortResult = EMSSetPortNum(pEMS, sendSMS->srcport, sendSMS->desport);
- }
- if ((sendSMS->sendrequire & MMI_FRM_SMS_CLASS) == MMI_FRM_SMS_CLASS)
- {
- EMSSetClassResult = EMSSetMsgClass(pEMS, sendSMS->dcs_class);
- }
- if ((EMSSetPortResult != EMS_OK) || (EMSSetClassResult != EMS_OK))
- {
- mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_ERROR);
- mmi_frm_sms_free_sendsms_data();
- OslMfree(textbufucs2);
- return;
- }
- #endif /* MMI_ON_HARDWARE_P */
- if (sendSMS->filename != NULL)
- {
- result = AppendEMSString(
- INPUT_TYPE_ALPHANUMERIC_SENTENCECASE,
- pEMS,
- (U8*) textbufucs2,
- sendSMS->dcs,
- temphistory.guiBuffer);
- }
- else if (sendSMS->string != NULL)
- {
- EMSSetDCS(pEMS, sendSMS->dcs);
- result = AddString(pEMS, (U8*) textbufucs2, sendSMS->stringlength, NULL);
- }
- OslMfree(textbufucs2);
- if ((sendSMS->filename != NULL && result == 0) || (sendSMS->string != NULL && result != EMS_OK))
- {
- mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_DATAEXCEED);
- mmi_frm_sms_free_sendsms_data();
- return;
- }
- }
- result = mmi_frm_sms_pack_sms();
- if (result != EMS_OK)
- {
- mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_DATAINVALID);
- mmi_frm_sms_free_sendsms_data();
- return;
- }
- SetProtocolEventHandler(mmi_frm_sms_send_sms_rsp, PRT_MSG_ID_MMI_SMS_SEND_MSG_RSP);
- SetProtocolEventHandler(mmi_frm_sms_abort_sms_ind, PRT_MSG_ID_MMI_SMS_SEND_ABORT_START_IND);
- if ((sendSMS->sendcheck & MMI_FRM_SMS_SCR) != MMI_FRM_SMS_SCR)
- {
- mmi_frm_sms_entry_send();
- }
- j = (PendingSaveSendData.totalSegments >= MMI_FRM_SMS_SEND_SEG) ? MMI_FRM_SMS_SEND_SEG : 1;
- PendingSaveSendData.nextSegment = 0;
- PendingSaveSendData.presentSegments = 0;
- sendResult = MMI_FRM_SMS_OK;
- for (i = 0; i < j; i++)
- {
- mmi_frm_sms_send_sms_seg();
- }
- }
- }
- extern U8 GetRefFromNVRAM(void);
- /* loop handle */
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_save_sms_rsp
- * DESCRIPTION
- * Save SMS response
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_save_sms_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_SET_MSG_RSP_STRUCT *msgRsp = (MMI_FRM_SMS_SET_MSG_RSP_STRUCT*) inMsg;
- U16 msgbox_index = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ClearProtocolEventHandler(PRT_MSG_ID_MMI_SMS_SET_MSG_RSP);
- if (msgRsp->result == TRUE)
- {
- mmi_frm_sms_msgbox_struct *entry = OslMalloc(sizeof(mmi_frm_sms_msgbox_struct));
- U16 ref = (U16) GetRefFromNVRAM();
- memset((S8*) entry, 0, sizeof(mmi_frm_sms_msgbox_struct));
- ref = (ref > 0) ? (ref - 1) : MMI_FRM_SMS_INVALID_NUM;
- mmi_frm_sms_convert_mo_to_entry(
- saveSMS,
- entry,
- msgRsp->index,
- msgRsp->status,
- PendingSaveSendData.totalSegments,
- ref,
- msgRsp->storage_type,
- &sms_saved_time);
- #ifdef __MMI_UNIFIED_MESSAGE__
- /* Only save content for the first segment */
- if (PendingSaveSendData.nextSegment == 1)
- {
- U8 *content = OslMalloc(mmi_msg_get_max_content_size() * ENCODING_LENGTH);
- EMSData *pEMS = NULL;
- U32 content_size = 0;
- pEMS = GetEMSDataForEdit(0, 0);
- if (pEMS->dcs == SMSAL_UCS2_DCS)
- {
- content_size =
- ((mmi_msg_get_max_content_size() - 1) <
- (pEMS->textLength / 2)) ? (mmi_msg_get_max_content_size() - 1) : (pEMS->textLength / 2);
- memset(entry->content, 0, sizeof(entry->content));
- memset(content, 0, mmi_msg_get_max_content_size() * ENCODING_LENGTH);
- pfnUnicodeStrncpy((S8*) content, (S8*) pEMS->textBuffer, content_size);
- }
- else
- {
- U32 handled_content_size = mmi_msg_get_max_content_size() * 2 * ENCODING_LENGTH;
- U8 *handled_content = OslMalloc(handled_content_size);
- U32 handled_content_len = 0;
- U16 ori_content_size =
- ((mmi_msg_get_max_content_size() - 1) <
- (pEMS->textLength / 2)) ? (mmi_msg_get_max_content_size() - 1) : (pEMS->textLength / 2);
- memset(handled_content, 0, handled_content_size);
- mmi_frm_sms_remove_escape_symbol_for_extension_char
- ((U16*)handled_content,
- (U16*)pEMS->textBuffer,
- (U16) (ori_content_size));
- handled_content_len = pfnUnicodeStrlen((S8*)handled_content);
- content_size =
- ((mmi_msg_get_max_content_size() - 1) <
- (handled_content_len)) ? (mmi_msg_get_max_content_size() - 1) : (handled_content_len);
- memset(entry->content, 0, sizeof(entry->content));
- memset(content, 0, mmi_msg_get_max_content_size() * ENCODING_LENGTH);
- pfnUnicodeStrncpy((S8*) content, (S8*) handled_content, content_size);
- }
- if (pfnUnicodeStrlen((S8*) content))
- {
- mmi_frm_sms_add_content_to_entry(entry, content);
- }
- OslMfree(content);
- }
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- msgbox_index = mmi_frm_sms_add_sms_to_msgbox(entry, msgRsp->index, PendingSaveSendData.presentSegments);
- OslMfree(entry);
- if (PendingSaveSendData.nextSegment < PendingSaveSendData.totalSegments)
- {
- mmi_frm_sms_save_sms_seg();
- }
- else
- {
- ReleaseEMSEditBuffer();
- #ifdef __MMI_UNIFIED_MESSAGE__
- if (saveSMS->sendrequire & MMI_FRM_SMS_SAVE_MODIFY_HIGHLIGHT)
- {
- U8 type;
- U16 list_index;
- BOOL msg_box_match = KAL_FALSE;
- mmi_frm_sms_get_list_index(&type, &list_index, msgbox_index);
- switch (type)
- {
- case MMI_FRM_SMS_INBOX:
- {
- if (mmi_um_get_current_msg_box_type() == UM_MSG_BOX_TYPE_INBOX)
- {
- msg_box_match = KAL_TRUE;
- }
- break;
- }
- case MMI_FRM_SMS_OUTBOX:
- {
- if (mmi_um_get_current_msg_box_type() == UM_MSG_BOX_TYPE_SENT)
- {
- msg_box_match = KAL_TRUE;
- }
- break;
- }
- case MMI_FRM_SMS_DRAFTS:
- {
- if (strlen((S8*) entry->number))
- {
- if (mmi_um_get_current_msg_box_type() == UM_MSG_BOX_TYPE_UNSENT)
- {
- msg_box_match = KAL_TRUE;
- }
- }
- else
- {
- if (mmi_um_get_current_msg_box_type() == UM_MSG_BOX_TYPE_DRAFT)
- {
- msg_box_match = KAL_TRUE;
- }
- }
- break;
- }
- }
- if (msg_box_match)
- {
- if (list_index <= g_msg_cntx.currBoxIndex)
- {
- g_msg_cntx.currBoxIndex++;
- }
- }
- }
- if (saveSMS->sendrequire & MMI_FRM_SMS_SAVE_HIGHLIGHT_NEW_MSG_IND)
- {
- mmi_frm_sms_highlight_ind(MMI_FRM_SMS_NOBOX, msgbox_index);
- }
- if (saveSMS->sendrequire & MMI_FRM_SMS_SAVE_HIGHLIGHT_ORIGINAL_MSG_IND)
- {
- U8 type = mmi_um_get_current_msg_box_type();
- switch (type)
- {
- case UM_MSG_BOX_TYPE_INBOX:
- {
- mmi_frm_sms_highlight_ind(MMI_FRM_SMS_INBOX, (U16)g_msg_cntx.currBoxIndex);
- break;
- }
- case UM_MSG_BOX_TYPE_UNSENT:
- {
- mmi_frm_sms_highlight_ind(MMI_FRM_SMS_UNSENT, (U16)g_msg_cntx.currBoxIndex);
- break;
- }
- case UM_MSG_BOX_TYPE_SENT:
- {
- mmi_frm_sms_highlight_ind(MMI_FRM_SMS_OUTBOX, (U16)g_msg_cntx.currBoxIndex);
- break;
- }
- case UM_MSG_BOX_TYPE_DRAFT:
- {
- mmi_frm_sms_highlight_ind(MMI_FRM_SMS_DRAFTS, (U16)g_msg_cntx.currBoxIndex);
- break;
- }
- }
- }
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- /* no more to send or send fail: returns the result */
- mmi_frm_sms_callback_action(&(saveSMS->status), MMI_FRM_SMS_OK);
- mmi_frm_sms_free_savesms_data();
- }
- }
- else
- {
- mmi_frm_sms_callback_action(&(saveSMS->status), MMI_FRM_SMS_MEMFULL);
- mmi_frm_sms_free_savesms_data();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_save_sms_seg
- * DESCRIPTION
- * Save SMS segment
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_save_sms_seg(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_SET_MSG_REQ_STRUCT *saveSms;
- S8 *addr = (S8*) saveSMS->number;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- saveSms = (MMI_FRM_SMS_SET_MSG_REQ_STRUCT*) OslConstructDataPtr(sizeof(*saveSms));
- /* memset((S8*)saveSms, 0, sizeof(MMI_FRM_SMS_SET_MSG_REQ_STRUCT)); */
- saveSms->status = saveSMS->status;
- if (addr[0] == '+')
- {
- saveSms->dest.type = CSMCC_INTERNATIONAL_ADDR;
- addr++;
- }
- else
- {
- saveSms->dest.type = CSMCC_DEFAULT_ADDR_TYPE;
- }
- memset((S8*) saveSms->dest.number, 0, MAX_CC_ADDR_LEN);
- memcpy((S8*) saveSms->dest.number, (S8*) addr, strlen((S8*) addr));
- saveSms->dest.length = strlen((S8*) addr);
- saveSms->profile = saveSMS->profile; /* active profile number.. */
- saveSms->para = 0;
- saveSms->udhi = PendingSaveSendData.udhi;
- saveSms->dcs = PendingSaveSendData.dcs;
- saveSms->length = PendingSaveSendData.TPUDLen[PendingSaveSendData.nextSegment];
- saveSms->index = MMI_FRM_SMS_INVALID_INDEX;
- mmi_frm_sms_convert_mytime(saveSms->scts, &sms_saved_time);
- memset(saveSms->msg, 0, SMSAL_MAX_MSG_LEN);
- memcpy(
- saveSms->msg,
- PendingSaveSendData.TPUD_p[PendingSaveSendData.nextSegment],
- PendingSaveSendData.TPUDLen[PendingSaveSendData.nextSegment]);
- SetProtocolEventHandler(mmi_frm_sms_save_sms_rsp, PRT_MSG_ID_MMI_SMS_SET_MSG_RSP);
- mmi_frm_sms_send_message(MOD_MMI, MOD_L4C, 0, PRT_MSG_ID_MMI_SMS_SET_MSG_REQ, (oslParaType*) saveSms, NULL);
- PendingSaveSendData.nextSegment++;
- PendingSaveSendData.presentSegments++;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_sms_save_sms_req
- * DESCRIPTION
- * Save SMS request
- * PARAMETERS
- * inMsg [IN] Input message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_sms_save_sms_req(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 *textbuf = NULL;
- S8 *textbufucs2 = NULL;
- U16 textlen = 0;
- U16 result = 0;
- history temphistory;
- EMSData *pEMS;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* do not replace saveSMS by sendSMS because sendSMS structure may be cleared by abort rsp */
- mmi_frm_sms_free_savesms_data();
- saveSMS = OslMalloc(sizeof(mmi_frm_sms_send_struct));
- memcpy((S8*) saveSMS, (S8*) inMsg, sizeof(mmi_frm_sms_send_struct));
- OslMfree(inMsg);
- if (saveSMS->filename != NULL)
- {
- S32 errorCode = 0;
- FILE_HANDLE emsObjectFilePtr;
- emsObjectFilePtr = pfopen((U8*) saveSMS->filename, PFS_READ);
- /* the file exists without error */
- if (!pfOpenError(emsObjectFilePtr))
- {
- textlen = (U16) GetFSFileSize(emsObjectFilePtr);
- /* the file size is 0 */
- if (textlen == 0)
- {
- pfclose(emsObjectFilePtr);
- mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_DATAEMPTY);
- mmi_frm_sms_free_savesms_data();
- return;
- }
- if (saveSMS->dcs == SMSAL_8BIT_DCS)
- {
- /* the file is too large. */
- if (textlen > (MMI_FRM_SMS_MSG_LEN * MMI_SMS_MAX_MSG_SEG / ENCODING_LENGTH) ||
- textlen > ((MMI_FRM_SMS_MAX_CONTROL_BUFFER_SIZE / ENCODING_LENGTH) - 1))
- {
- pfclose(emsObjectFilePtr);
- mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_DATAEXCEED);
- mmi_frm_sms_free_savesms_data();
- return;
- }
- /* the file size is allowed */
- textbuf = OslMalloc(textlen + 1);
- pfread(textbuf, 1, textlen, emsObjectFilePtr, &errorCode);
- pfclose(emsObjectFilePtr);
- /* the file content is corrupted */
- if (pfError(errorCode))
- {
- mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_DATAINVALID);
- OslMfree(textbuf);
- mmi_frm_sms_free_savesms_data();
- return;
- }
- /* the file content is allowed */
- textbufucs2 = OslMalloc((textlen + 1) * ENCODING_LENGTH);
- AnsiiNToUnicodeString(textbufucs2, textbuf, textlen);
- memset(textbufucs2 + textlen * ENCODING_LENGTH, 0, ENCODING_LENGTH);
- OslMfree(textbuf);
- }
- /* UCS2 and DEFAULT DCS */
- else
- {
- /* the file is too large. */
- if (textlen > (MMI_FRM_SMS_MSG_LEN * MMI_SMS_MAX_MSG_SEG) ||
- textlen > (MMI_FRM_SMS_MAX_CONTROL_BUFFER_SIZE - ENCODING_LENGTH))
- {
- pfclose(emsObjectFilePtr);
- mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_DATAEXCEED);
- mmi_frm_sms_free_savesms_data();
- return;
- }
- /* the file size is allowed */
- textbuf = OslMalloc(textlen + ENCODING_LENGTH);
- pfread(textbuf, 1, textlen, emsObjectFilePtr, &errorCode);
- pfclose(emsObjectFilePtr);
- /* the file content is corrupted */
- if (pfError(errorCode))
- {
- mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_DATAINVALID);
- OslMfree(textbuf);
- mmi_frm_sms_free_savesms_data();
- return;
- }
- /* the file content is allowed */
- textbufucs2 = OslMalloc((textlen + ENCODING_LENGTH));
- memset(textbufucs2, 0, (textlen + ENCODING_LENGTH));
- memcpy(textbufucs2, textbuf, textlen);
- OslMfree(textbuf);