10a 读短信

srv_sms_get_list_size

#include "SMSApi.h"
#include "med_utility.h"

extern unsigned short mmi_frm_sms_show_list_index[];

S8 g_sms_buffer[160] = {0};

char *ConvertString(char * str)
{
char temp;
int i;
int len = wstrlen(str);

for (i = 0; i < len ; i += 2)
{
temp = str[i];
str[i] = str[i+1];
str[i+1] = temp;
}

return str;
}
int wstrlen(char * txt)
{
int lenth=0;
unsigned char * ss=(unsigned char*)txt;
while(((*ss<<8)+*(ss+1))!=0)
{
lenth+=2;
ss+=2;
}
return lenth;
}
void my_msg_get_msg_rsp(void* data, module_type mod, U16 result)
{
//U8 type=*(U8*)data;
EMSData*pEms;
int len = 0;

GetEMSDataForView (&pEms, 0);
len = wstrlen((char *)(pEms->textBuffer))+2;
//把获取的信息复制到g_sms_buffer以备使用
if (len < 20)
{
memcpy(g_sms_buffer, pEms->textBuffer, len);
}
else
{
memcpy(g_sms_buffer, pEms->textBuffer, 20);
}
}
// type: MMI_FRM_SMS_APP_INBOX, MMI_FRM_SMS_APP_OUTBOX, MMI_FRM_SMS_APP_DRAFTS
// index: 0~0XFF
S32 my_msg_get_msg_req (U8 type, U16 req_index, E_MTPNP_AD_FILTER_RULE cur_sim)
{
int count =0;
U16 index;
/* disallow re-entering SMS application when there is a pending SMS job running in the background */
if(srv_sms_check_send_action_pending())
{
return 1;
}

#ifdef __MMI_DUAL_SIM_MASTER__
if(cur_sim == MTPNP_AD_FILTER_MASTER)
{
MTPNP_AD_SMS_Set_Filter_Rule(MTPNP_AD_FILTER_MASTER);
count =srv_sms_get_list_size(type);
}
else
{
MTPNP_AD_SMS_Set_Filter_Rule(MTPNP_AD_FILTER_SLAVE);
count = srv_sms_get_list_size(type);
}

if((count <=0)||(req_index >= count))
{
return -1;
}

MTPNP_PFAL_SMS_Set_Current_Index(req_index);
index = mmi_frm_sms_show_list_index[req_index];
#else
index = req_index;
#endif
mmi_sms_read_msg(g_sms_cntx.curr_msg_id,MMI_TRUE,my_msg_get_msg_rsp);
return 0;
}

posted @ 2011-12-02 16:24  harisucici  阅读(276)  评论(0编辑  收藏  举报