(9) SMS part - PDU introduction and its format
PDU is the core of most mobile phone SMS communications, only a few mobile phones only support Text mode (such as the author's MOTO C330). The PDU mode can provide powerful features compared to the Text mode, but its encoding is difficult than TEXT mode. No matter which mode, we can manage the send, receive, delete and other management of SMS through the AT command control terminal. The following mainly introduces the composition and coding decoding of the PDU.
Composition of PDU
PDU is from "0"
-9
"
And "A-F" composition. On the surface, it seems to be a set of 16-based numbers.
The following will be given an example of sending and receiving.
1, a PDU string sent by the phone:
0891683108200805f011190d9168318902848f40008ff108fd
9662F
4E0067616D4B8BD577ED4FE
Compared with the 3GPP protocol: (binary code from left to right is high -> low)
SMS center address field
08 address length: 8 bytes, including the subsequent 91
91 Address Type: 10010001 Bit7: 1. Always 1 BITS 6, 5, 4: Type-of-Number: 001, represents the INTERNATION NUMBER. It is also the number before the number " ". Note: When some special numbers are interoperable, such as interworking of mobile phones and small-livestones, here cannot be set to 001, but set to 000, do not " " before the number, otherwise it cannot be received.
BITS 3, 2, 1: Numbering-Plan-Identification: General default 0001, indicating the type of phone number.
683108200805F
0 SMS Center Number: One byte reversed, 8613800280500, if the length is odd, you need to add "F" to supplement
FIRSTOCTET field
11 Contains TP-MTI (2BIT), TP-RD (1bit), TP-VPF (2BIT), TP-RP (1bit), TP-UDHI (1bit), TP-SRR (1bit)
Binary representation: 0 0 0 10 0 01
TP-MTI: 01
TP-Message-Type-Indicator (Message Type Indicator)
Bit1, 0: 01 Indicates SMS-Submit Type TP-RD: 0
TP-REECT-DUPLICATES (Whether to reject the same repetition message)
Bit2: 0 Indicates that the short message center accepts unproved messages with the same TP-MR.
TP-VPF: 10
TP-VALIDITY-Period-Format (Validity Format)
Bit4, 3: 10 indicates the use of relative format.
TP-SRR: 0
TP-STATUS-Report-Request
Bit5: 0 indicates that the status report is not used.
TP-UDHI: 0 TP-User-Data-Header-Indicator (User Data Skill) Bit6: 0 Indicates this is an SMS message, no user data head. EMS messages need to be set.
TP-RP: 0 TP-Reply-path (Reply Path) bit7: 0 Indicates that the reply path is not set. Message reference value TP-MR
19 TP-Message-Reference
Metail number field
0D91683188902848F4
Its structure is similar to the SMS center number field, and will not be described again.
Protocol identifier TP-PID
00 tp-protocol-identifier (upper protocol indication), typically set to 00, indicating normal GSM, point-to-point encoding method TP-DCS
08 TP-DATA-CODING-SCHEME (Data Coding Setting) indicates the encoding method of the TP-UD. 08 represents a Unicode method. 00 is 7bit encoding
Validity TP-VP
FF TP-VALIDITY-Period. Ff represents the largest.
User Data Length TP-UDL
10 TP-User-Data-Length (User Data Length)
0x10 length. Note that the user length definition in different codes is different.
User Data TP-UD
8FD
9662F
4E0067616D4B8BD577ED4FE TP-user-data Chinese "This is a test SMS" Unicode encoding
2, PDU string received by mobile phone
0891683108200805F0040D91683188902848F4000850208151754500108FD
9662F
4E0067616D4B8BD577ED4FE1
SMS center address field
0891683108200805f0: 861380280500
FIRSTOCTET
04
Second credit code: 00000100
TP-MTI: 00
TP-MMS (TP-more-message-to-send): 1 SMS center does not have more messaging
TP-SRI: 0
TP-UDHI: 0
TP-RP: 0
Sender number
0D91683188902848F4: 8613880982844
Agreement identifies 00 TP-DCS point-to-point
Encoding
08 TP-DCS Unicode encoding
SMS center timestamp 50208151754500 TP-SCTS byte reverse 05/02/18 15:57:45 The last 00 represents the time zone, here is 0
User data length
10 TP-DHL
User data
8FD
9662F
4E0067616D4B8BD577ED4FE1 TP-UD
Chinese "this is a Test SMS" Unicode Code