void SendMsg(S8* content,S8* destnum)
{
mmi_frm_sms_send_struct * sendData=OslMalloc(sizeof(mmi_frm_sms_send_struct));
U16 contentNum;
U8* pContentBuffer = NULL;
memset((S8*)sendData, 0, sizeof(mmi_frm_sms_send_struct));
memset(sendData->number, 0, 21);
UnicodeToAnsii((S8*)sendData->number, (S8*)destnum);
//dcs
sendData->dcs = SMSAL_UCS2_DCS;
//content
contentNum = pfnUnicodeStrlen((PS8)content);
pContentBuffer=OslMalloc((contentNum+1)*ENCODING_LENGTH);
MMI_ASSERT(pContentBuffer != NULL);
memset((S8*)pContentBuffer, 0, ((contentNum+1)*ENCODING_LENGTH));
memcpy((S8*)pContentBuffer , (S8*)content, contentNum*ENCODING_LENGTH);
sendData->stringlength = pfnUnicodeStrlen((PS8) pContentBuffer);
sendData->string = content;
sendData->sendcheck |= MMI_FRM_SMS_SCR;
#ifdef __MMI_MULTI_SIM__
if (MTPNP_PFAL_Is_CardValid(MMI_SIM_1) == MTPNP_AD_SIMCARD_VALID)
{
MTPNP_AD_Free_Channel(MTPNP_AD_SMS_CHANNEL);
MTPNP_AD_Set_Channel(MTPNP_AD_SMS_CHANNEL, MTPNP_AD_CHANNEL_MASTER);
}
else if (MTPNP_PFAL_Is_CardValid(MMI_SIM_2) == MTPNP_AD_SIMCARD_VALID)
{
MTPNP_AD_Free_Channel(MTPNP_AD_SMS_CHANNEL);
MTPNP_AD_Set_Channel(MTPNP_AD_SMS_CHANNEL, MTPNP_AD_CHANNEL_SLAVE);
}
#else
MTPNP_AD_Free_Channel(MTPNP_AD_SMS_CHANNEL);
MTPNP_AD_Set_Channel(MTPNP_AD_SMS_CHANNEL, MTPNP_AD_CHANNEL_MASTER);
#endif
mmi_frm_sms_send_sms(NULL, MOD_MMI, sendData);
//OslMfree(newMsgContent);
OslMfree(pContentBuffer);
OslMfree(sendData);
}
短信发送的结构体:
typedef struct
{
U16 srcport;
U16 desport;
U16 replyindex;
U16 stringlength;
U8 dcs;
U8 dcs_class;
U8 profile;
U8 status;
mmi_frm_sms_action_enum sendcheck;
mmi_frm_sms_send_enum sendrequire;
U8 number[MAX_DIGITS_SMS];//号码
S8* filename;
S8* string;//内容发送指针
}mmi_frm_sms_send_struct;