mt2503如何使用UCS2方式发送短信
2017-11-17 10:50
531 查看
[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
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
相关文章推荐
- 装饰者模式的学习(c#) EF SaveChanges() 报错(转载) C# 四舍五入 保留两位小数(转载) DataGridView样式生成器使用说明 MSSQL如何将查询结果拼接成字符串 快递查询 C# 通过smtp直接发送邮件 C# 带参访问接口,WebClient方式 C# 发送手机短信 文件 日志 写入 与读取
- 如何使用代码调用API接口发送短信?(以SendCloud为例)
- 如何使用短信猫发送中文短信
- 如何使用云片API发送短信验证码
- 如何使用 ATK-SIM900A 模块进行中英文的短信发送
- 如何以文本方式通过彩信、短信及Email发送书签
- 如何使用Python发送带附件的邮件
- 如何使用C#在发送往client的内容上加js代码(转)
- 如何使用PHP通过SMTP发送电子邮件
- 如何通过电脑发送短信——预备役篇
- 如何使用C#在发送往client的内容上加js代码
- 关于如何使用自定义的结束消息循环的方式 (转载)
- [导入]用C#通过Nokia手机发送短信(使用Nokia SDK3.0/原创)
- 使用J2ME发送手机短信
- 如何使用links方式安装Eclipse插件
- 举个小例子说明如何使用查表这种方式
- 如何在Vista中使用MMC方式的Remote Desktops(How to use Remote Desktops through mmc console in Vista)
- 如何使用C#在发送往client的内容上加js代码(转)
- PHP中如何使用header发送头部信息
- 使用NowSMS Gateway来接收发送短信和彩信