At command to develop the Wavecom text message sending Program)

Source: Internet
Author: User

Http://www.cnblogs.com/ryanShowTime/archive/2010/11/30/1892162.html

At command development Wavecom SMS sending program

The following link is a cool man to the mobile phone sms pdu format reference manual English translation of the link address: http://xinos.cn/smspdu/manual.shtml#_Toc86589166

 

During this time, the company should require the development of the Wavecom text message sending software, so we use the AT command for development. Here we will post some problems encountered in the process and hope to help you.

 

When using AT commands to develop the Wavecom SMS sending program, there are several modes, such as PDU mode and text mode. There are many posts available on the Internet, so I won't talk about them here,

I use the PDU mode to send text messages. When using the PDU mode, the most important thing is the PDU mode encoding format!

The following is the encoding format of the copied PDU mode:

 

This article uses an example to describe the entire process of sending a PDU text message using the AT command. If I want to send the following text message:
Receiving number: + 8613602433649
Text message content: Happy work!
SMS center number: + 8613800200500

1. Handling of SMS center numbers: represented by the string ADDR
1. Remove the number + from the SMS center to check whether the length is an even number. If not, add F
That is, ADDR = "+ 8613800200500"
=> ADDR = "8613800200500f"
2. Exchange odd and even digits.
=> ADDR = "683104200005f0"
3. Adding 91,91 to the front of the SMS center number indicates internationalization.
=> ADDR = "916830000200005f0"
4. Calculate the length of the ADDR, and divide the result into 2 hexadecimal strings, 16/2 = 8 => "08"
=> ADDR = "08916830000200005f0"

2. Mobile phone number processing: Use the string phone
1. Remove the phone number + to check whether the length is an even number. If not, add F
That is, phone = "+ 8613602433649"
=> Phone = "8613602433649f"
2. Exchange odd and even numbers of mobile phone numbers.
=> Phone = "683106423366f9"

3. Partial Short Message Processing: represented by the string msg
1. Convert the conversion string to Unicode Code, for example, "Work well !" The Unicode code of is 5de54f5c61095febff01,
(For the conversion functions, see the appendix at the end)
2. Divide Msg Length by 2 and retain two hexadecimal numbers, namely 5de54f5c61095febff01 = 20/2 => "0a", and add msg
=> MSG = "0a5de54f5c61095febff01"

Iv. Combination
1. Add the character string 11000d91 (1100: fixed, 0d: the length of the mobile phone number. If it is not a plus sign, it is expressed in hexadecimal format. If it is 91, it is sent to the mobile phone, sent to PHS 81 ),
That is, phone = "11000d91" + phone
=> 11000d91683106423366f9
2. After the mobile phone number is added with 000800 and the short message content just now, 000800 can also be written to death.
That is, phone = phone + "000800" + msg
11000d91683106423108f9 + 000800 + 0a5de54f5c61095febff01
=> Phone = 11000d91683106423108f90008000a5de54f5c61095febff01
3. Divide the phone length by 2 and format it into two decimal digits.
That is, 11000d91683106423108f90008000a5de54f5c61095febff01 => 50 bits/2 => 25

5. the content to be sent is
At + cmgf = 0 <press enter>
OK
At + cmgs = 25 <press enter>
> ADDR + phone <Ctrl + Z send>

6. If the returned result is not an error, congratulations, the message has been sent successfully. ^_^

 

When using this encoding format to send text messages, I encountered a small problem. After a long tangle, "00" must be added before the phone value, so the result is 0011000d91683106423366f90008000a5de54f5c61095febff01,

However, when at + cmgs = 25, the calculation of the value 25 cannot be counted as the first two "00.

So if your string has a total length of 52 characters, but when you enter at + cmgs = ?? It should be 26 in this place, but it cannot be counted as the first two "00", so it is written as 25,

 

I don't know if I understand it. I hope it will help you. Although it is a small place, if the two "00" don't understand it, it will always be an error.

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.