Android SMS PDU

Source: Internet
Author: User
7-bit encoding: Send common ASCII characters; 8-bit encoding: usually used to send data messages; ucs2 encoding: used to send Unicode characters.

Generally, the PDU code consists of 13 items, namely, a B c d e f g h I j k l m. The meaning of these 13 items are as follows:

A: The length of the SMS center address, two hexadecimal digits (1 byte ). B: The number type of the SMS center, which is a two-digit hexadecimal number. C: the number of the short message center. The length of B + C is determined by the data in. D: File Header byte, which is a two-digit hexadecimal number. E: Information type, two-digit hexadecimal number. F: the length of the called number, which is a two-digit hexadecimal number. G: name of the called number type. It is a two-digit hexadecimal number. The value is the same as that of B. H: The called number. The length is determined by the data in F. I: Protocol identifier, two-digit hexadecimal number. J: data encoding scheme, two-digit hexadecimal number. K: validity period, two-digit hexadecimal number. L: User Data Length, two-digit hexadecimal number. M: The length of user data is determined by the data in L. The ucs2 encoding is used in J, which is a Unicode Character in Chinese and English.

The PDU protocol is described as follows:

PDU encoding protocol Example 1: Send: the SMSC number is + 8613800250500, the peer number is 13693092030, and the message content is "Hello !". The PDU string sent from the mobile phone can be 08 91 68 31 08 20 05 05 F0 11 00 0d 91 68 31 96 03 29 30 F0 00 00 06 C8 32 9B FD 0e 01., specific analysis: Segmented description 08 SMSC address information consists of 8 8 8-bit bytes (including 91) 91 SMSC address format (ton/NPI) sent with an international format number (plus '+' in front) 68 31 08 20 05 F0 SMSC address 8613800250500, fill 'F' into an even number of 11 basic parameters (TP-MTI/VFP, TP-VP with relative format 00 Message Reference value (TP-MR) 00D number of destination address numbers total 13 decimal numbers (excluding 91 and 'F') 91 destination address format (ton/NPI) with an international number (plus '+' above) 68 31 96 03 29 30 F0 Destination Address (TP-DA) 8613693092030, fill' F' makes up an even number of 00 protocol identification (TP-PID) is a common GSM type, point-to-point mode 00 user information encoding (TP-DCS) 7-Bit Coding 00 validity period (TP-VP) 5 minutes 06 user information length (TP-UDL) actual length 6 bytes C8 32 9B FD 0e 01 user information (TP-UD) "Hello!" Example 2 receive: the SMSC number is + 8613800250500, the peer number is 13693092030, and the message content is "Hello !". The PDU string received by the mobile phone can be 08 91 68 31 08 20 05 05 F0 84 0d 91 68 31 96 03 29 30 F0 00 08 30 30 21 80 63 54 80 06 4f 60 59 7D 00 21 standard, specific analysis: The description of segments indicates that the length of the 08 address information is 8 bytes (including 91). 91. The SMSC address format (ton/NPI) is an international number (plus '+' at the Front ') 68 31 08 20 05 F0 SMSC address 8613800250500, fill 'F' to make an even number of 84 basic parameters (TP-MTI/MMS/RP) receive, no more messages, there are 13 decimal numbers (excluding 91 and 'F') in the number of 0d reply addresses. 91 reply address format (ton/NPI) with an international number (in front of the plus '+') 68 31 96 03 29 30 F0 reply address (TP-RA) 8613693092030, fill 'F' Even Number of 00 protocol identification (TP-PID) is common GSM type, point-to-point mode 08 user information encoding mode (TP-DCS) ucs2 encoding 30 30 21 80 63 54 80 timestamp (TP-SCTS) 08:36:45 + 8 Time Zone 06 User Info length (TP-UDL) actual length 6 bytes 4f 60 59 7d 00 21 User Info (TP-UD) "Hello!" If the maximum bit (TP-RP) of the basic parameter is 0, there are no three segments that reply to the address. This is often the case for short messages sent from the Internet. Note that the expression of the number and time does not follow the normal order, and the odd number must be supplemented into an even number with 'F.

In PDU mode, three encoding methods can be used to encode the sent content: 7-bit, 8-bit, and ucs2. 7-bit encoding is used to send Common ASCII characters. It encodes a string of 7-bit characters (the highest bit is 0) into 8-bit data, each 8 characters can be "COMPRESSED" into 7; 8-bit encoding is usually used to send data messages, such as slices and ringtones; while ucs2 encoding is used to send Unicode characters. The maximum size of the user information (TP-UD) segment of the PDU string is 140 bytes, so the maximum number of characters of short messages that can be sent in these three encoding modes is 160, 140, and 70, respectively. Here, an English letter, a Chinese character, and a Data byte are regarded as a character.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.