SIMRefresh.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:14k
源码类别:
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:
- * ---------
- * SIMRefresh.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * SIM application toolkit related functions
- *
- * Author:
- * -------
- * -------
- *
- *==============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *==============================================================================
- *******************************************************************************/
- #include "stdC.h"
- #include "L4Dr1.h"
- #include "L4Dr.h"
- #include "MMI_features.h"
- #include "FrameworkStruct.h"
- #include"KeyBrd.h"
- #include "SATDefs.h"
- #include "SATStruct.h"
- #include "SATGProts.h"
- #include "SATProts.h"
- #include "ProtocolEvents.h"
- #include "TimerEvents.h"
- #include "CallManagementStruct.h"
- #include "CallManagementGprot.h"
- #include "GSM7BitDefaultAlphabet.h"
- #include "CommonScreens.h"
- #include "NVRAMType.h"
- #include "NVRAMProt.h"
- #include "NVRAMEnum.h"
- #include "SSCStringHandle.h"
- #include "gdi_include.h"
- #include "lcd_sw_rnd.h"
- #include "QueueGprot.h"
- #include "BootUp.h"
- #include "PowerOnChargerProt.h"
- #include "SimDetectionDef.h"
- #include "SimDetectionGexdcl.h"
- #include "SimDetectionGprot.h"
- #include "sat_def.h"
- /*****************************************************************************
- * FUNCTION
- * mmi_sat_get_msisdn_data_handler
- * DESCRIPTION
- * Get MSISDN data response handler
- * PARAMETERS
- * info [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_sat_get_msisdn_data_handler(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_smu_read_sim_rsp_struct *msisdn_data;
- mmi_cphs_mmi_info_ind_struct cphs_mmi_info;
- U8 i, alpha_len, bcd_len;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- msisdn_data = (mmi_smu_read_sim_rsp_struct*) info;
- ClearProtocolEventHandler(PRT_MMI_SMU_READ_SIM_RSP);
- if (msisdn_data->result.flag == 0)
- {
- memset((void*)&cphs_mmi_info, 0, sizeof(mmi_cphs_mmi_info_ind_struct));
- cphs_mmi_info.no_msisdn = 1;
- if (msisdn_data->data[0] >= 0x80 && msisdn_data->data[0] <= 0x82)
- {
- for (alpha_len = 0; *(msisdn_data->data + 1 + alpha_len) != 0xFF; alpha_len++);
- cphs_mmi_info.msisdn[0].alpha_id_size = alpha_len;
- cphs_mmi_info.msisdn[0].alpha_id_dcs = MMI_UCS2_DCS + msisdn_data->data[0] - 0x80;
- memcpy(cphs_mmi_info.msisdn[0].alpha_id, msisdn_data->data + 1, alpha_len);
- }
- else
- {
- for (alpha_len = 0; *(msisdn_data->data + alpha_len) != 0xFF; alpha_len++);
- cphs_mmi_info.msisdn[0].alpha_id_size = alpha_len;
- cphs_mmi_info.msisdn[0].alpha_id_dcs = MMI_DEFAULT_DCS;
- memcpy(cphs_mmi_info.msisdn[0].alpha_id, msisdn_data->data, alpha_len);
- }
- cphs_mmi_info.msisdn[0].alpha_id[alpha_len] = 0;
- cphs_mmi_info.msisdn[0].ton_npi = *(msisdn_data->data + msisdn_data->length - 13);
- for (bcd_len = 0; *(msisdn_data->data + msisdn_data->length - 12 + bcd_len) != 0xFF; bcd_len++);
- cphs_mmi_info.msisdn[0].digit_size = bcd_len * 2;
- for (i = 0; i < bcd_len; i++)
- {
- cphs_mmi_info.msisdn[0].digit[i * 2] = 0x30 + (*(msisdn_data->data + msisdn_data->length - 12 + i) & 0x0F);
- cphs_mmi_info.msisdn[0].digit[i * 2 + 1] = 0x30 + ((*(msisdn_data->data + msisdn_data->length - 12 + i) & 0xF0) >> 4);
- }
- ServiceIndicationStringDisplay((void*)&cphs_mmi_info);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_sat_get_msisdn_data
- * DESCRIPTION
- * Get MSISDN data request
- * PARAMETERS
- * msisdn_record_size [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_sat_get_msisdn_data(U16 msisdn_record_size)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MYQUEUE Message;
- mmi_smu_read_sim_req_struct *dataPtr;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetProtocolEventHandler(mmi_sat_get_msisdn_data_handler, PRT_MMI_SMU_READ_SIM_RSP);
- Message.oslSrcId = MOD_MMI;
- Message.oslDestId = MOD_L4C;
- Message.oslMsgId = PRT_MMI_SMU_READ_SIM_REQ;
- dataPtr = (mmi_smu_read_sim_req_struct*) OslConstructDataPtr(sizeof(mmi_smu_read_sim_req_struct));
- dataPtr->file_idx = (U8) FILE_MSISDN_IDX;
- dataPtr->para = 1;
- dataPtr->length = msisdn_record_size;
- Message.oslDataPtr = (oslParaType*) dataPtr;
- Message.oslPeerBuffPtr = NULL;
- OslMsgSendExtQueue(&Message);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_sat_get_msisdn_info_handler
- * DESCRIPTION
- * Get MSISDN info response handler
- * PARAMETERS
- * info [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_sat_get_msisdn_info_handler(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_smu_read_file_info_rsp_struct *msisdn_info;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- msisdn_info = (mmi_smu_read_file_info_rsp_struct*) (info);
- ClearProtocolEventHandler(PRT_MMI_SMU_READ_FILE_INFO_RSP);
- if (msisdn_info->result.flag == 0)
- {
- mmi_sat_get_msisdn_data((U16) (msisdn_info->file_size / msisdn_info->num_of_rec));
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_sat_get_msisdn_info
- * DESCRIPTION
- * Get MSISDN info request
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_sat_get_msisdn_info(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MYQUEUE Message;
- mmi_smu_read_file_info_req_struct *dataPtr;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetProtocolEventHandler(mmi_sat_get_msisdn_info_handler, PRT_MMI_SMU_READ_FILE_INFO_RSP);
- Message.oslSrcId = MOD_MMI;
- Message.oslDestId = MOD_L4C;
- Message.oslMsgId = PRT_MMI_SMU_READ_FILE_INFO_REQ;
- dataPtr = (mmi_smu_read_file_info_req_struct*) OslConstructDataPtr(sizeof(mmi_smu_read_file_info_req_struct));
- dataPtr->file_idx = (U8) FILE_MSISDN_IDX;
- Message.oslDataPtr = (oslParaType*) dataPtr;
- Message.oslPeerBuffPtr = NULL;
- OslMsgSendExtQueue(&Message);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_sat_get_spn_data_handler
- * DESCRIPTION
- * Get SPN data response handler
- * PARAMETERS
- * info [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_sat_get_spn_data_handler(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_smu_read_sim_rsp_struct *spn_data;
- U16 alpha_len;
- U8 *convertedData;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- spn_data = (mmi_smu_read_sim_rsp_struct*) info;
- ClearProtocolEventHandler(PRT_MMI_SMU_READ_SIM_RSP);
- if (spn_data->result.flag == 0)
- {
- if (spn_data->data[1] != 0)
- {
- gSpnValid = 1;
- g_pwr_context.RequireRPLMN = spn_data->data[0] & 0x01;
- if (spn_data->data[1] >= 0x80 && spn_data->data[1] <= 0x82)
- {
- for (alpha_len = 0; *(spn_data->data + 2 + alpha_len) != 0xFF; alpha_len++);
- convertedData = CovertStringForPlatform(
- spn_data->data + 2,
- alpha_len,
- (U8) (MMI_UCS2_DCS + spn_data->data[1] - 0x80),
- NULL);
- }
- else
- {
- for (alpha_len = 0; *(spn_data->data + 1 + alpha_len) != 0xFF; alpha_len++);
- convertedData = CovertStringForPlatform(
- spn_data->data + 1,
- alpha_len,
- MMI_DEFAULT_DCS,
- NULL);
- }
- pfnUnicodeStrcpy((PS8) gServProvderName, (PS8) convertedData);
- OslMfree(convertedData);
- if (g_idle_context.IsOnIdleScreen)
- {
- EntryIdleScreen();
- }
- }
- else
- {
- gSpnValid = 0;
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_sat_get_spn_data
- * DESCRIPTION
- * Get SPN data request
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_sat_get_spn_data(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MYQUEUE Message;
- mmi_smu_read_sim_req_struct *dataPtr;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetProtocolEventHandler(mmi_sat_get_spn_data_handler, PRT_MMI_SMU_READ_SIM_RSP);
- Message.oslSrcId = MOD_MMI;
- Message.oslDestId = MOD_L4C;
- Message.oslMsgId = PRT_MMI_SMU_READ_SIM_REQ;
- dataPtr = (mmi_smu_read_sim_req_struct*) OslConstructDataPtr(sizeof(mmi_smu_read_sim_req_struct));
- dataPtr->file_idx = (U8) FILE_SPN_IDX;
- dataPtr->para = 0;
- dataPtr->length = 0x11;
- Message.oslDataPtr = (oslParaType*) dataPtr;
- Message.oslPeerBuffPtr = NULL;
- OslMsgSendExtQueue(&Message);
- }