协议地址:WAP195
网络字节顺序:big-endian。
为什么要加0x40?
- When an element contains content (text nodes or child elements) but no attributes, you add a numeric value of 0x40to the byte code
- When the element contains one or more attributes but no content, add 0x80to the element byte code
- When the element contains both an attribute and content, add 0xC0 to the element bye code.
封装数据
Opaque Data
opaque = OPAQUE length *byte
其中,QPAQUE一个字节表示,内容是0xc3. length根据内容的字节长度确定,不包含标示位和长度位。
长度算法
length = data.getBytes().length.
length into 7bit bytes .Assume bytes.length = N
bytes[0] += 0x80;
bytes[1] += 0x80;
……
bytes[n-1] += 0x80;