How to send SMS by GSM modem in PDU mode?

半世苍凉 提交于 2019-12-01 06:54:42

问题


I want to send SMSs in PDU mode. I have checked the spec for my modem, and it supports PDU mode.

I have developed a PDU encoder and decoder, but now I do not know how to send data to my modem. I tried these AT commands:

AT

AT+CMGF=0

after sending these commands I sent the PDU data like this:

AT+CMGW="16079189390500410011000C918939050000000000AA02E834" 

I have checked the correctness of this PDU using this online tool :

http://www.twit88.com/home/utility/sms-pdu-encode-decode

but after sending it via the AT command, the modem hangs.

Is this the right way to send SMS PDUs? I searched on Google and can not find useful information.


回答1:


First of all, to send sms when modem is in pdu mode, you must send these commands: AT+CMGS=<length> <CR>, where length is (length of PDU binary string - 2) / 2. When '>' symbol appears you must send your pdu and ctrl+z character (char.ConvertFromUtf32(26)).

Here are some resources that may be useful: http://www.developershome.com/sms/ SMS Tutorial http://www.diafaan.com/sms-tutorials/gsm-modem-tutorial/online-sms-deliver-pdu-decoder/ another online pdu decoder (but your link is better in my opinion) http://www.fccps.cz/img.asp?attid=24590 AT commands guide (for wavecom, but there is no difference)

Last advice - use any telnet client to connect and test your modem and see how it responds




回答2:


length of PDU string = ( PDUlength - 2 - ServiceCentreNumber length ) / 2

ServiceCentreNumber length is first byte of PDU string. (2 Hex char = 8 bit)

Command for send sms in PDU mode:

send:AT+CMGF=0                 //recieved "\r\nOK\r\n"
send:AT+CMGS=<length>          //recieved "\r\n> "
send:<pdu string><char(26)>    //recieved "\r\n+CMGS: 59\r\n\r\nOK\r\n"

Another variant is to use instead +CMGS command +CMGW to write msg to memory (code same above) and then use +CMSS to send the message from memory.



来源:https://stackoverflow.com/questions/18489717/how-to-send-sms-by-gsm-modem-in-pdu-mode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!