文章目录
一. 电话号码处理1.1 短信中心号码的处理1.2 收件人号码处理
二. 短信内容处理2.1 UTF-8 转 Unicode2.2 Hex 转 String
三. 最终汇总3.1 PDU格式拼接3.2 函数 pdu_encod()
四. 模块头文件 PDU.h
一. 电话号码处理
1.1 短信中心号码的处理
实现:
int Processing_center_number(char *center_number)
{
int i;
char temp;
char head[20] = "0891"; //08: length 91: globalization
if(!center_number)
{
printf("Invalid input\n");
return -1;
}
/* Drop the ‘+’ sign, add ‘F’, and swap the parity bits */
strcpy(center_number,¢er_number[1]);
strcat(center_number,"F");
for(i = 0; i Unicode , LSB */
int utf8_to_unicode(char* utf8_buf,char* unic_buf)
{
if(!utf8_buf)
{
printf("Invalid parameter\n");
return -1;
}
char *temp = unic_buf;
char b1,b2,b3,b4; //b1: high data bit b4: low data bits
while(*utf8_buf)
{
if(*utf8_buf > 0x00 && *utf8_buf > 2) & 0x07;
temp++;
*temp = (b1 |