mt2503如何使用UCS2方式发送短信

[DESCRIPTION]
MT2503如何使用UCS2方式发送短信

[SOLUTION]
提供sample code如下,重点要注意的是,发送的时候记得要传的UCS2编码值要用小端发送 kal_uint8 chinese_content_buff[4]={96,79,125,89};///你好的UCS2编码值,UCS2-LIT,请 记得使用小端发送,使用大端发送会导致对方收到后显示乱码
void MMI_send_chinese_SMS_callback(srv_sms_callback_struct* callback_data)
{
kal_pROMpt_trace(MOD_SMS, "result=%d, action=%d, cause=%d\n",callback_data->result,
callback_data->action, callback_data->cause);
if (callback_data->result == MMI_TRUE)
{
/* send successfully */
}
else
{
switch(callback_data->cause)
{
case SRV_SMS_CAUSE_SEND_ABORT:
case SRV_SMS_CAUSE_NOT_READY:
case SRV_SMS_CAUSE_SEND_BUSY:
case SRV_SMS_CAUSE_MEM_FULL:
case SRV_SMS_CAUSE_MEM_INSUFFICIENT:
case SRV_SMS_CAUSE_DATA_INVALID:
case SRV_SMS_CAUSE_DATA_EXCEED:
case SRV_SMS_CAUSE_NUMBER_EMPTY:
case SRV_SMS_CAUSE_NUMBER_INVALID:
case SRV_SMS_CAUSE_SC_EMPTY:
case SRV_SMS_CAUSE_SC_INVALID:
case SRV_SMS_CAUSE_FDL_FAIL:
case SRV_SMS_CAUSE_AT_CONFLICT:
case SRV_SMS_CAUSE_OP_CONFLICT:
case SRV_SMS_CAUSE_EMAIL_NO_SPACE:
case SRV_SMS_CAUSE_UNKNOWN_ERROR:
default:
/* send failed */
break;
}
}
}
void mmi_send_chinese_sms()
{
SMS_HANDLE send_handle;
send_handle = srv_sms_get_send_handle();
if (send_handle == NULL)
{
/* can not get handle */
return;
}
if ((U16)srv_sms_is_bg_send_action_busy() == MMI_TRUE)
{
/* background sending is busy */


return;
}
/* set address number */
srv_sms_set_address(send_handle, (CHAR*)(L"18688806215"));
/* set content of DCS encoding */
srv_sms_set_content_dcs(send_handle, SRV_SMS_DCS_UCS2);
/* set content */
srv_sms_set_content(send_handle, (S8*)chinese_content_buff, 4);
/* set SIM1 */
srv_sms_set_sim_id(send_handle, SRV_SMS_SIM_1);
/* send request */
srv_sms_send_msg(send_handle, mmi_send_chinese_sms_callback, NULL);

}

资料来源:MT2503  http://bbs.16rd.com/thread-453769-1-1.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值