|
楼主 |
发表于 2010-1-1 08:59:05
|
显示全部楼层
短信发送实例
// 短信群发
ReleaseEMSEditBuffer();
pEMS = (EMSData*)GetEMSDataForEdit (0, 1);
ASSERT(pEMS != NULL);
result = AppendEMSString (IMM_INPUT_TYPE_SENTENCE, pEMS, (U8*)sSosSMSContent, SMSAL_UCS2_DCS, NULL);
for (i = 0; i < MAX_SEND_TO_MANY_ITEMS; i++)
{
memset(g_msg_cntx.msg_send_info.PhbNumber, 0, sizeof(g_msg_cntx.msg_send_info.PhbNumber));
}
for (i = 0; i < MAX_SOS_NUMBER; i++)
{
if(UCS2Strlen((S8*)gSOSNumList) != 0)
{
memcpy(g_msg_cntx.msg_send_info.PhbNumber, gSOSNumList, sizeof(gSOSNumList));
}
}
mmi_msg_send_msg_to_many();
单个短信发送
ReleaseEMSEditBuffer();
pEMS = (EMSData*)GetEMSDataForEdit (0, 1);
ASSERT(pEMS != NULL);
g_msg_cntx.sendSaveStatus = SEND_SAVE_NIL;
memset (g_msg_cntx.smsPhoneNumber, 0, sizeof(g_msg_cntx.smsPhoneNumber));
mmi_ucs2cpy(g_msg_cntx.smsPhoneNumber, (S8 *)smsPhoneNum);
PendingSaveSendData.totalSegments=1;
PendingSaveSendData.mti=SMSAL_MTI_SUBMIT;//MS->SC
memset(PendingSaveSendData.TPUD, 0,sizeof(PendingSaveSendData.TPUD));
for (i=1; i<mmi_msg_get_seg_num(); i++)
{
PendingSaveSendData.TPUDLen=0;
PendingSaveSendData.TPUD_p=NULL;
PendingSaveSendData.l4index=SMS_INVALID_INDEX;
PendingSaveSendData.TPUD_udhi= FALSE;
}
g_msg_cntx.sendMessageCase = SEND_CASE_SEND_ONLY;
result = AppendEMSString (IMM_INPUT_TYPE_SENTENCE, pEMS, (U8*)sSosSMSContent, SMSAL_UCS2_DCS, NULL);
if(result)
{
mmi_frm_sms_send_struct * sendData=OslMalloc(sizeof(mmi_frm_sms_send_struct));
char Number[MAX_DIGITS_SMS];
char* pNumber = (char*)Number;
int numlen = 0;
ASSERT(sendData != NULL)
memset(Number, 0, sizeof(Number));
numlen = mmi_ucs2_to_asc((S8 *)Number, (S8 *)smsPhoneNum);
numlen = strlen(pNumber) > MAX_DIGITS_SMS ? MAX_DIGITS_SMS : strlen(pNumber);
memset((S8*)sendData, 0, sizeof(mmi_frm_sms_send_struct));
memset(sendData->number, 0, MAX_DIGITS_SMS);
memcpy(sendData->number, pNumber,numlen);
mmi_frm_sms_send_sms(SosSmsSendResponse, MOD_MMI, sendData);
OslMfree(sendData);
}//begin send message,but not sure send successfully
void SosSmsSendResponse(void* number, module_type mod, U16 result)
{
U16 currentSCRID ;
U8 data;
S16 error;
currentSCRID = GetActiveScreenId();
mmi_frm_sms_delete_screen_history();
if((currentSCRID == SCR_ID_MSG_SENDING) || (currentSCRID == SCR_ID_MSG_PROCESSING))
GoBackHistory();
switch(result)
{
case MMI_FRM_SMS_OK:
//write value of user use state
AlmEnableSPOF();
break;
default:
AlmEnableSPOF();
break;
}
memset(g_msg_cntx.smsPhoneNumber, 0, sizeof(g_msg_cntx.smsPhoneNumber));
} |
|