Currently, send short messages commonly used text and PDU (Protocol Data Unit, protocol units) mode. Using text mode to send and receive SMS code is simple, easy to implement, but the biggest drawback is not to send and receive Chinese text messages, and PDU mode not only supports Chinese text messages, but also can send English text messages. PDU mode SMS can be encoded using 3 kinds of encoding: 7-bit, 8-bit and UCS2. 7-bit encoding is used to send normal ASCII characters, 8-bit encoding is typically used to send data messages, UCS2 encoding is used to send Unicode characters. The general PDU code consists of a B C D E F G H I J K L m 13.
A: Message Center address length, 2 hexadecimal digits (1 bytes).
B: SMS Center number type, 2 digit hexadecimal number.
C: SMS Center number, the length of the b+c will be determined by the data in a.
D: File header Byte, 2-bit hexadecimal number.
E: Information type, 2-digit hexadecimal number.
F: Called number length, 2 hexadecimal digits.
G: Called number type, 2 hexadecimal digits, value same as B.
H: Called number, length is determined by the data in F.
I: Protocol ID, 2-bit hexadecimal number.
J: Data encoding scheme, 2-bit hexadecimal number.
K: Valid, 2-digit hexadecimal number.
L: User data length, 2 hexadecimal digits.
M: User data, whose length is determined by the data in L. J is set to use UCS2 encoding, here is the Unicode character in English and Chinese.
A simple description of PDU encoding protocol
Example 1 Send: Smsc number is +8613800250500, the other number is 13693092030, the message content is "hello!". The PDU string issued from the phone can be
As of F0, 0D, F0, 01, 9B FD 0E. (C8), and
Comparative specification, specific analysis:
Paragraph meaning description
SMSC Address information has a total of 8 eight-bit bytes (including 91)
SMSC address Format (TON/NPI) with international format number (plus ' + ' in front)
F0 smsc Address 8613800250500, fill ' F ' into an even number
11 Basic parameters (TP-MTI/VFP) sent, TP-VP in relative format
00 Message base value (TP-MR) 0
0D Destination Address number total 13 decimal digits (excluding 91 and ' F ')
91 Destination Address format (TON/NPI) with international format number (in front plus ' + ')
F0 Target Address (tp-da) 8613693092030, fill ' F ' into an even number
00 Protocol identification (TP-PID) is a common GSM type
00 User Information encoding Method (Tp-dcs) 7-bit encoding
00 Validity period (TP-VP) 5 minutes
06 User Information Length (TP-UDL) actual length 6 bytes
C8 9B FD 0E 01 user information (Tp-ud) "hello!"
Transfer from bbs.sendsms.cn
Chinese text message code (i)