互芯平台短信发送实现

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;


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值