Coding an SMS generally requires the following information:
TP_Data_Coding_SchemeTP_UD encoding method
TP_Destination_Address counterpart number
TP_Message_Reference reference number
TP_Status_Report_Request status report
TP_User_Data user information
TP_Validity_Priod validity period
ServiceCenterNumber SMS center number
Therefore , the above attributes exist in the encoder, and the processing code is added to the Set, which will The readable information is converted into the corresponding hexadecimal information.
Of particular note is the TP_User_Data property, which automatically sets TP_UDL based on the user data encoding. For pure English encoding, TP_UDL is the number of all characters; for Unicode encoding, since a character is represented by two bytes, TP_UDL is the number of all characters * 2. Pay attention to check the length of TP_User_Data. For SMS, the length of the encoded TP_UD cannot exceed 140 bytes. That is to say, 160 characters in English (140/7*8) and 70 characters in Chinese.
The encoding of TP_UD is also described in the decoder, and will not be repeated here.
I also designed several enumeration variables:
ENUM_TP_DCS encoding method
ENUM_TP_SRI status report
ENUM_TP_VALID_PERIOD validity period
ENUM_TP_VPF validity period format
These enumeration variables can simplify input, but also facilitate future expansion.
When the above content is set, basically a short message shelf will come out. At this time, GetSMSPDUCode is called for combination, and a complete PDU code is formed by simply splicing the hexadecimal.
Transferred from bbs.sendsms.cn
PDU encoding--SMS encoding
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=327073875&siteId=291194637
Recommended
Ranking