关于获取电话本的问题!

edrftgyh 2003-10-09 09:06:43
我用 AT+CPBR=1 命令取电话本内容,用的是UCS2格式返回的值,最后一部分应该就是电话13693257494所对应的姓名(此姓名为“李林”),请问如何对这一段进行解析呢?
+CPBR: 1,"13693257494",129,"4E67970739333235373439342B2B2B2B2B2B2B2B2B2B2B2B2B2B
2B0D0402567490020155C80C81957CB469133C0C0003000000000000000000000000000000020121
001B000000000000020000FF0004A20D0113E83589B4F5D0C8544FD4887490020155DC19E8"
...全文
97 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
alon21 2003-10-10
  • 打赏
  • 举报
回复
AT+CPBR Read current phonebook entries
Test command
AT+CPBR=?
Response
TA returns location range supported by the current storage as a compound value
and the maximum length of <number> and <text> fields.
Note:
If SIM storage is selected, the length may not be available. If storage does not
offer format information, the format list should be empty parentheses.
+CPBR: (list of supported <index>s), <nlength>, <tlength> OK
If error is related to ME functionality:
+CME ERROR: <err>
Parameter
<index> supported range of location numbers (maximum number de-
pends on storage type)
<nlength> max. length of phone number, normally 20, for a small num-
ber of locations 40
<tlength> max. length of text assigned to phone number (depending on
storage type 16 - 18 characters including blanks)

Execute command
AT+CPBR=<ind
ex1>[,<index2>]
Response
TA returns phonebook entries in location number range <index1> ... <index2>
from the current phonebook memory storage selected with +CPBS. If <index2> is
left out, only location <index1> is returned.
+CPBR: <index1>, <number>, <type>, <text>[<CR><LF>+CPBR: .....+CPBR: <in-
dex2>, <number>, <type>, <text>] OK
If error is related to ME functionality:
+CME ERROR
Parameter
<index1> location number where reading starts
<index2> location number where reading ends
<number> phone number
<type> type of address octet in integer format; 145 when dialling string
includes international access code character “+”, otherwise 129.
<text> string type field of maximum length <tlength>. Character set as
specified with +CSCS.

Example 1. First, run the Test command to find out the maximum range of entries stored
in the active phonebook:
AT+CPBR=?
TA returns the supported values in the format: +CPBR: (1-100),20,17 where
100 is the supported range of location numbers, 20 is the length of the phone
number and 17 is the maximum length of the text associated text.
2. Now, run the Execute command to display the phonebook entries sorted by
location numbers.
AT+CPBR =1,100
+CPBR 1,"+999999",145,"Charlie"
+CPBR: 2,"+777777",145,"Bill"
+CPBR: 3,"+888888",145,"Arthur" .........
wdllove 2003-10-10
  • 打赏
  • 举报
回复
得解一下码,得把ucs解成acsii码,并显示出来!
你查一下很的资料!
alon21 2003-10-10
  • 打赏
  • 举报
回复
[分享]西门子手机端口通讯指令
http://www.cnjm.net/cgi-bin/lbcjm/view.cgi?forum=7&topic=254
wdllove 2003-10-10
  • 打赏
  • 举报
回复
你用什么手机为什么我用388根本不支持cpbr这个命令?
AT+CPBR=?

+CPBR: (101-355),020,014
这样能行


AT+CPBR=1

+CME ERROR: 003
这样就出错了,不知道什么原因!
mfc168 2003-10-10
  • 打赏
  • 举报
回复
是加密的
mct1025 2003-10-10
  • 打赏
  • 举报
回复
电话本内容 的格式是什么?
我找了很多网站都没有找到

"4E"->"E4",是代表信息长度?好像不对
姓名只有两个字,怎么会返回这么长的数据

搞不懂,up
alon21 2003-10-10
  • 打赏
  • 举报
回复
再转一篇 解决 Unicode 到 GB 的编码问题 的文章

------------------
老是有人发信要我解决 Unicode 到 GB 的编码问题,我在此贴代码算了,免得再找我

程序在FressBSD/Linux上调试通过,Windows 用户只要修改几个变量类型和头文件即可

说明:函数名称
int strUnicode2GB(char *strSourcer, char *strDest,int n)

转换Unicde字符串到GB码,返回汉字数
输入( Unicode 源串,GB2312/ASCII混合编码串,Unicode字节数 必须是偶数!!!)


#include <sys/types.h>

const unsigned short int Unicode_GB2312[][2] =
{

/*Unicode ,GB||ASCII ,MEMO*/
0x0000,0x0040,/* 0 COMMERCIAL AT @ */
0x0001,0x00A3,/* 1 POUND SIGN £ */
0x0002,0x0024,/* 2 DOLLAR SIGN $ */
0x0003,0x00A5,/* 3 YEN SIGN ¥ */
0x0004,0x00E8,/* 4 LATIN SMALL LETTER E WITH GRAVE è */

.............
.............
码表太长了 请尽量通过 Google 查询,多的是
或者通过 stevenkoh@sohu.com 向我索取

0xFF5C,0xA3FC,/* '|' -> 65372 */
0xFF5D,0xA3FD,/* '}' -> 65373 */
0xFF5E,0xA1AB,/* '~' -> 65374 */
0xFFE0,0xA1E9,/* '¢' -> 65504 */
0xFFE1,0xA1EA,/* '£' -> 65505 */
0xFFE3,0xA3FE,/* ' ̄' -> 65507 */
0xFFE5,0xA3A4,/* '¥' -> 65509 */


};

u_int16_t Unicode2GBcode(u_int16_t iUnicode)
{
int i,j,n;

switch (iUnicode){
case 0x0002:
return 0x24;
break;
case 0x000a:
return 0xa;
break;
case 0x000d:
return 0xd;
break;
case 0x0040:
return 0xA1;
break;
}

if ((iUnicode>=0x20&&iUnicode<=0x5a)||(iUnicode>=0x61&&iUnicode<=0x7a)) return iUnicode;


for (i=0,j=0,n=sizeof(Unicode_GB2312)/sizeof(Unicode_GB2312[0])-1;n>0;n>>=1,++j){

if(Unicode_GB2312[i][0]==iUnicode) return Unicode_GB2312[i][1];

if (j>1){
if(Unicode_GB2312[i-1][0]==iUnicode) return Unicode_GB2312[i-1][1];
if(Unicode_GB2312[i+1][0]==iUnicode) return Unicode_GB2312[i+1][1];
}

if (Unicode_GB2312[i][0]<iUnicode) i=i+n;
else i=i-n;
}

if(Unicode_GB2312[i][0]==iUnicode) return Unicode_GB2312[i][1];
if(Unicode_GB2312[i-1][0]==iUnicode) return Unicode_GB2312[i-1][1];
if(Unicode_GB2312[i+1][0]==iUnicode) return Unicode_GB2312[i+1][1];

return 0; //转换不成功
}


/*转换Unicde字符串到GB码,返回汉字数*/
int strUnicode2GB(const char *strSourcer,const char *strDest,int n)
{
char cTmp;
u_int16_t hz,tmphz;

char *pSrc;
char *pDest;

int i;


for (i=0,pSrc=strSourcer,pDest=strDest;n>0;n-=2,pSrc+=2,++i,++pDest){

hz=0;
hz=*pSrc<<8|(*(pSrc+1)&0x00FF);
tmphz=Unicode2GBcode(hz);

if (!tmphz||tmphz>0x7F&&tmphz<0xFF){
*pDest='.';
continue;
}
else if (tmphz>0x00&&tmphz<=0x7F){
cTmp=tmphz;
*pDest=cTmp;
}
else{
cTmp=tmphz;
*pDest=(tmphz>>=8);
++pDest;
*pDest=cTmp;
}
}

*pDest='\0';
return i;

}

希望您对大家有帮助!至于GB->Unicode,我想就算了,反正网关可以支持的。
=================================

GB和USC2相互转换的码表,C结构的


http://skybird.9s9s.com/upload/upfile/20021212857430GB2UNICODE.zip

edrftgyh 2003-10-09
  • 打赏
  • 举报
回复
上面所列的是AT+CPBR=1的命令的返回值!
mct1025 2003-10-09
  • 打赏
  • 举报
回复
mark
dzqsuper 2003-10-09
  • 打赏
  • 举报
回复
你这个是什么意思呀
真是听不懂哦

16,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧