|
发表于 2010-12-6 15:31:17
|
显示全部楼层
直接讀取sim卡文件EF_iccid:
MMI這邊要想讀寫SIM文件,需要向L4C(SIM2則向L4C_2)發送message:PRT_MMI_SMU_READ_SIM_REQ(寫:PRT_MMI_SMU_WRITE_SIM_REQ)。
讀取SIM卡文件的方法請參考SATSendReadSimFileReq:在MMI發送"Read" 請求消息
下面是一个实例:
void mmi_lmc_get_iccid_rsp(void *info)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
mmi_smu_read_sim_rsp_struct *iccid_data;
kal_uint8 iccid[21];
U8 i;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
iccid_data = (mmi_smu_read_sim_rsp_struct*) info;
ClearProtocolEventHandler(MSG_ID_MMI_SMU_READ_SIM_RSP);
if (iccid_data->result.flag == L4C_SUCCESS)
{
kal_prompt_trace(MOD_MMI, "Read iccid success!");
for (i = 0; i < iccid_data->length; i++)
{
iccid[i * 2] = 0x30 + (*(iccid_data->data + i) & 0x0F);
iccid[i * 2 + 1] = 0x30 + ((*(iccid_data->data + i) & 0xF0) >> 4);
}
iccid[20] = 0;
kal_prompt_trace(MOD_MMI, "ICCID:%s", iccid);
}
else
{
kal_prompt_trace(MOD_MMI, "read iccid fail!");
}
}
void mmi_lmc_get_iccid_req(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
MYQUEUE Message;
mmi_smu_read_sim_req_struct *dataPtr;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
SetProtocolEventHandler(mmi_lmc_get_iccid_rsp, MSG_ID_MMI_SMU_READ_SIM_RSP);
Message.oslSrcId = MOD_MMI;
Message.oslDestId = MOD_L4C;
Message.oslMsgId = MSG_ID_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_ICCID_IDX;
dataPtr->para = 0;
dataPtr->length = 0x0a;
Message.oslDataPtr = (oslParaType*) dataPtr;
Message.oslPeerBuffPtr = NULL;
OslMsgSendExtQueue(&Message);
}
注 : 如果获取卡2的信息,发送消息的函数用SetslaveProtocolEventHandler和ClearSlaveProtocolEventHandler
另外卡2需要发送给MOD_L4C_2 |
|