最近一直有些朋友们要求总结一下主流手机铃声和图片的问题,由于本人在这方面基本没有什么尝试,只能将有些朋友们发表过的东西总结一下。这些总结中有已经实现的,有些还是在摸索中的,希望大家能根据提供的资料多试试,成功后能将自己的经验与大家分享。这些总结针对的是sp与梦网短信网关之间传输的格式,至于通过其它方式发送的格式,我也不知道能不能套用。:(
nokia:
铃声和图片的格式有资料详细介绍,有兴趣的最好还是去看看他的smartmessage。
在cmpp的cmpp_submit包里,其msg_content由两部分组成,头和内容
铃声:0x6 0x5 0x4 0x15 0x81 0 0(头) + 铃声二进制内容
图片:0x6 0x5 0x4 0x15 0x82 0 00x64 0xf0 0(头) + 图片二进制
铃声和图片的编辑工具及将文本转换成二进制文件的工具,请在论坛的“资源共享”里查找
motorola铃声:(由istudy提供)
在cmpp的cmpp_submit包里,其msg_content由<-header -><-tempo value-><-musical data -> <-delimiter->checksum->组成
field binary data ascii data
-------------------------------------------------------------------------------------
header: 4c 33 35 26 -->"l35&"
tempo value: 32 20 -->"2 "
musical data: 43 2d 32 20 43 23 2d 32 20 44 2d 32 20 -->"c-2 c#-2 d-2 "
delimiter: 26 26 -->"&&"
checksum: 35 38 -->"58"
-------------------------------------------------------------------------------------
最终发送的二进制流为:4c3335263220432d322043232d3220442d322026263538
要注意的是校验位的计算,是所有musical data 异或后的值,然后拆分转换而来得,如果checksum计算不正确则手机接收后是些非法字符的普通消息。下面的文档中算法很详细。
header: l35& this is a constant string for all musical tone sms. [by using 'send as sms'
option user can send composed ringer tone to other compatible motorola phone. to
differentiate music sms from normal sms, special header is attached.]
tempo value: this is either 1 or 2 or 3 or 4 followed by a space(e.g. “2 “). default is 2.
musical data : it consists of 1 or more notes, subject to a maximum of 35 notes , the format
of which is given below.
delimiter : && this represents the end of musical notes in the tone.
checksum : two bytes. the algorithm for calculation of the checksum is given below.
step1: calculate one byte xor sum of the all the bytes of the musical data starting after
the space in the tempo value(not including space) till the && (not inclusive of &&). let
us say this is xy.
step 2: separate x and y into two bytes x0 and 0y.
step 3: take 0y and add hex 30. this becomes 3y. call this byte 1.
step 4: take x0 and shift right by 4 bits. this becomes 0x.
step 5: add hex 30 to 0x. this becomes 3x. call this byte 2.
step 6: two byte checksum is <byte 2><byte1>
simens铃声:(由hello008提供)
可能hello008还没有完全试成功,所以有兴趣的朋友还是多参见他提供的相关文档,多多测试和分析一下,成功了一定要告诉我一下喔!
在cmpp的cmpp_submit包里,其msg_content由
2f 2f 53 45 4f:头
1:版本
6b 0:数据段长度
7 11 9 17:类似序列号
6 0:第6个数据包
8 0:共8个数据包
f7 2 0 0:mid文件大小
3 6d 69 64:3mid
8:文件名长度
65 31 33 39 2e 6d 69 64:文件名
。。。:数据
ericsson铃声:
是我从网关上截取分析出来的,没有实际试过。
在cmpp的cmpp_submit包里,其msg_content由
其格式是:
binary data ascii data
---------------------------------------------------------
42 45 47 49 4e 3a 45 4d 45 4c 4f 44 59 0a -->begin:emelody+换行符(0x0a)
45 52 53 49 4f 4e 3a 31 2e 30 0a -->version:1.0+换行符(0x0a)
4d 45 4c 4f 44 59 3a数据内容0a -->melody:+内容++换行符(0x0a)
45 4e 44 3a 45 4d 45 4c 4f 44 59 -->end:emelody
-------------------------------------------------------------
大概就这么多吧,剩下的大家要么看文档要么试成功后把自己的经验共享一下。
在这里我并没有对cmpp_submit中同铃声和图片相关的几个字段如tp_udhi,msg_fmt做出说明,主要是各网关厂商对它们在处理上也不一样,如对tp_udhi,有的要求填0,有的要求填1,有的则要求填0x40。所以在调试时,最好询问一下网关的开发人员,来确定具体的值。
*******如需转载,请注明出处*************
*******asp.7i24.com/yjack*************
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器