发送OTA书签的sms的格式

类别:软件工程 点击:0 评论:0 推荐:

发送OTA书签的sms的格式

首先需要写一个bookmark的xml文件,这个格式可以去nokia网站下载。下面是一个例子:
<?xml version="1.0"?>
<!DOCTYPE CHARACTERISTIC-LIST PUBLIC "" "characteristic_list.dtd">
<CHARACTERISTIC-LIST>
     <CHARACTERISTIC TYPE="BOOKMARK">
          <PARM NAME="NAME" VALUE="bookmark name"/>
          <PARM NAME="URL" VALUE="http://www.bookmark.com"/>
     </CHARACTERISTIC>
</CHARACTERISTIC-LIST>


尽量让name和url短点,这样编码后可以放到一条短消息里面,而不需要把一个设置拆分成多个短消息体。大致的一个封装是把xml文件转成wbxml,然后再在外面封装WSP层,最外面是WDP层。

WDP的一般格式是“0B0504C34FC002000304xxyy”,其中xx就是整个数据包的总片断数目,而yy表示当前片断是第几个片断。举个例子,一个简单的bookmark全部放在一个sms中这样xx=01,yy=01。
下面是每个byte的意思:

# 0B | User-Data-Header (UDHL) Length = 11 bytes
# 05 | UDH IE identifier: Port numbers                        
# 04 | UDH port number IE length                             
# C3 | Destination port (high)                                     
# 4F | Destination port (low)                                     
# C0 | Originating port (high)                 
# 02 | Originating port (low)                   
# 00 | UDH IE identifier: SAR                 
# 03 | UDH SAR IE length                      
# 04 | Datagram ref no.                        
#
# Two variable bytes, intentionally missing from WDP header, user must
# calculate and add at send time.
#
# xx | Total number of segments in datagram    
# yy | Segment count                            

bookmark的WSP层的格式一般是"01062D1F2A6170706C69636174696F6E2F782D7761702D70726F762E62726F777365722D626F6F6B6D61726B730081EA"
每个byte的具体意思是:

# 01 | Transaction ID /                         
# 06 | PDU type (push)                          
# xx | Header length (content type headers)     
# 1F | Value length quote length greater than 30
# 2A | Value length (value name not used)       
# xx | Mimetype encoded, variable bytes          | application/x-wap-prov.browser-{bookmarks | settings}
# 00 | Null termination of content type string   |
# 81 | Charset                                   | Well known PARM. (short integer)
# EA | UTF-8 (using short integer)              
最里层就是WBXML了,首先必须有个xml的头"01016A00"

# 01 | Version                                   | WBXML 1.1
# 01 | Unknown public identifier         |
# 6A | Charset                                   | UTF-8
# 00 | String table length                      |

至于其他的具体编码可以去http://www.forum.nokia.com查看OTA_settings_general_7_0.pdf这个文档,里面很详细的描述了每一个XML元素对应的十六进制。最后注意一点,发送的时候要按8bit格式的发送,而不是7bit格式。

本文地址:http://com.8s8s.com/it/it34519.htm