/**
* 一个扩展包wappush包是这么构成的
* WDP + WSP + SI/SL
* 如果长度超常(短信一个包的Content不要超过140)
* 就要分解成
* 就要分解成
* WDP1 + (WSP+SI/SL)的part 1
* WDP2 + (WSP+SI/SL)的part 2
* ...
* WDPN + (WSP+SI/SL)的part N
* WDP2 + (WSP+SI/SL)的part 2
* ...
* WDPN + (WSP+SI/SL)的part N
* 如单包
* WDP: 06 05 04 0B 84 23 F0
* WSP: ...
* SI/SL:...
* WDP: 06 05 04 0B 84 23 F0
* WSP: ...
* SI/SL:...
* 双包是
* 第1包
* WDP: 0B 05 04 0B 84 23 F0 00 03 01 02 01
* Part1: ...
* 第1包
* WDP: 0B 05 04 0B 84 23 F0 00 03 01 02 01
* Part1: ...
* // 00 - UDH IE Tag
* // 03 - UDH SAR IE Length
* // 01 - Reference
* // 02 - Total Packet
* // 01 - Current Packet
* // 03 - UDH SAR IE Length
* // 01 - Reference
* // 02 - Total Packet
* // 01 - Current Packet
* 第2包
* WDP: 0B 05 04 0B 84 23 F0 00 03 01 02 02
* Part2:...
*
*
*/
* WDP: 0B 05 04 0B 84 23 F0 00 03 01 02 02
* Part2:...
*
*
*/
public static byte[] genPacketX(String title, String url)
{
byte[] Title = null;
try {
Title = title.getBytes("UTF-8");
} catch (java.io.UnsupportedEncodingException e) {
Title = title.getBytes();
}
byte[] Url = null;
if(url.toLowerCase().startsWith("http://") )
url=url.substring(7);
Url = url.getBytes();
url=url.substring(7);
Url = url.getBytes();
byte[] result = new byte[35 + Title.length + Url.length];
int i = 0;
int i = 0;
//UDH//7 bytes WDP header
result[i++] = 0x06;
result[i++] = 0x05;
result[i++] = 0x04;
result[i++] = 0x0b;
result[i++] = (byte) 0x84;
result[i++] = 0x23;
result[i++] = (byte) 0xf0;
result[i++] = 0x06;
result[i++] = 0x05;
result[i++] = 0x04;
result[i++] = 0x0b;
result[i++] = (byte) 0x84;
result[i++] = 0x23;
result[i++] = (byte) 0xf0;
//PDU
result[i++] = 0x01; // push-id
result[i++] = 0x06; // pdu = push
result[i++] = 0x0a; // headlen=10
result[i++] = 0x03; // cert ??
result[i++] = (byte) 0xae; // application/vnd.wap.sic
result[i++] = (byte) 0x81; // charset
result[i++] = (byte) 0xea; // utf-8
result[i++] = (byte) 0xaf;
result[i++] = (byte) 0x82;
result[i++] = (byte) 0x8d; //
result[i++] = (byte) 0xae;
result[i++] = 0x01; // push-id
result[i++] = 0x06; // pdu = push
result[i++] = 0x0a; // headlen=10
result[i++] = 0x03; // cert ??
result[i++] = (byte) 0xae; // application/vnd.wap.sic
result[i++] = (byte) 0x81; // charset
result[i++] = (byte) 0xea; // utf-8
result[i++] = (byte) 0xaf;
result[i++] = (byte) 0x82;
result[i++] = (byte) 0x8d; //
result[i++] = (byte) 0xae;
result[i++] = (byte) (Url.length + 159);
result[i++] = (byte) 0x87;
result[i++] = (byte) 0x87;
//SI part
result[i++] = 0x02;
result[i++] = 0x05; //-//WAPFORUM//DTD SI 1.0//EN
result[i++] = 0x6A; //UTF-8
result[i++] = 0x00; //字符串结束
result[i++] = 0x45; //<si>
result[i++] = (byte) 0xC6; //<indication
result[i++] = 0x08; //<action=signal-high>
result[i++] = 0x0C; //href="http://
result[i++] = 0x03; //字符串开始
result[i++] = 0x02;
result[i++] = 0x05; //-//WAPFORUM//DTD SI 1.0//EN
result[i++] = 0x6A; //UTF-8
result[i++] = 0x00; //字符串结束
result[i++] = 0x45; //<si>
result[i++] = (byte) 0xC6; //<indication
result[i++] = 0x08; //<action=signal-high>
result[i++] = 0x0C; //href="http://
result[i++] = 0x03; //字符串开始
for (int j = 0; j < Url.length;) {
result[i++] = Url[j++];
} //实际地址
result[i++] = 0x00; //字符串结束
// result[i++] = 0x0A; //created=
//result[i++] = (byte)0xC3; //'时间
// result[i++] = 0x07; //时间字节数
//result[i++] = ; //YYYYMMDDHHMMSSstartTime
// result[i++] = 0x10; //si_expires=
// result[i++] = (byte)0xC3; //时间
// result[i++] = 0x07; //时间字节数
//result[i++] = ; //YYYYMMDDHHMMSS
result[i++] = 0x01; //>
result[i++] = 0x03; //字符串开始endTime
for (int j = 0; j < Title.length;) {
result[i++] = Title[j++];
result[i++] = Url[j++];
} //实际地址
result[i++] = 0x00; //字符串结束
// result[i++] = 0x0A; //created=
//result[i++] = (byte)0xC3; //'时间
// result[i++] = 0x07; //时间字节数
//result[i++] = ; //YYYYMMDDHHMMSSstartTime
// result[i++] = 0x10; //si_expires=
// result[i++] = (byte)0xC3; //时间
// result[i++] = 0x07; //时间字节数
//result[i++] = ; //YYYYMMDDHHMMSS
result[i++] = 0x01; //>
result[i++] = 0x03; //字符串开始endTime
for (int j = 0; j < Title.length;) {
result[i++] = Title[j++];
}
result[i++] = 0x00; //字符串结束
result[i++] = 0x01; //</indication>"
result[i++] = 0x01; //'</si>
return result;
result[i++] = 0x01; //</indication>"
result[i++] = 0x01; //'</si>
return result;
}