AT+CSMS Select Message Service
At+csms=0//SMS AT command compatible with GSM 07.05 Phase 2
At+csms=1//SMS AT command compatible with GSM 07.05 Phase
AT+CMGF Selecting Message Formats
AT+CMGF? Querying the current value
At+cmgf=0//pdu:0
At+cmgf=1//Txt:1
AT+CMGL enumerating short messages, at+cmgf=0 PDU mode
At+cmgl=0//Receive Unread
At+cmgl=1//Receive Read
at+cmgl=2//Storage not Sent
At+cmgl=3//Storage Sent
AT+CMGL=4//All messages
AT+CMGL enumerates short messages, at+cmgf=1 txt mode, which is the string before the equals sign
At+cmgl= "REC Unread"//Receive Unread
At+cmgl= "REC read"//Receive Read
At+cmgl= "STO Unsent"//Storage not Sent
At+cmgl= "STO SENT"//Storage Sent
At+cmgl= "All"//All messages
Delete Information
at+cmgd=1,4//Delete all messages that have been sent and not sent on the SIM card
at+cmgd=1,2//Delete a read SMS
If you send a text message and reply to the message +cnti: "SM", 3 this 3 represents the third piece of information you have on this card now.
At this point send at+cmgr=3 can read this text message
Send at+cmgd=3 If you want to delete this text message
Here are some of the functions of the AT+CMGD directive
at+cmgd=1,0 the message from the preferred message storage at the location 1 is deleted
at+cmgd=1,1 all READ messages from the preferred message storage is deleted
at+cmgd=1,2 all READ messages and SENT mobile originated messages is deleted
at+cmgd=1,3 all READ, SENT and unsent messages is deleted
at+cmgd=1,4 All messages is deleted
The message is prompted for the interrupt mode. In this way, when you receive the text message, the content is directly used +CMT: Prompt out, do not save card.
at+cnmi=2,2,0,0,0
Text Message Flow
at+cmgf=1\r//TXT mode
At+csca= "+8613800512500"//write Information Center number
at+cscs= "GSM" \ r//Character set
at+cmgs= "+8618913179619" \ r//write phone number
>hello//Send "HELLO"
1 A//(CTRL-Z) sent in hex
Use PDU mode to send short message flow
at+cmgf=0\r//PDU mode
at+cscs= "UCS2" \ r//Character set
at+cmgs=//is followed by all character lengths from the short Message Center
0891683108502105F0//SMS Address
11000D91683155845570F1//Phone number
000800//14
06//Length of data to send
4f60597d0021//Data
0x1A//(CTRL-Z) sent in hex
Note: When sending a text message, the SMSC address can be used instead of 00.
Like sending "Hello!" To 13554855071. The code is as follows:
At+cmgf=0\r
at+cscs= "UCS2" \ r
At+cmgs=21\r
"0011000d91683155845570f1000801064f60597d0021"
0x1A
********************************************************************************
0891683108502105f011000d91683155845570f1000801064f60597d0021
0891683108502105F0//SMS Address
11000d91683155845570f1
000800//14
06
4f60597d0021
What is PDU Mode?
It is a way to send or receive SMS messages from a mobile phone. The message body is sent by hexadecimal encoding; The PDU sends only hexadecimal characters 0-9 a-f.
Basic PDU Commands:
Read Short Message
At+cmgr:
List short messages
AT+CMGL:
Send Short Message
At+cmgs:
PDU Receive SMS Format:
+CMT:, 26
08//Length of address information
*//SMSC Address format (TON/NPI), with international format number (in front plus ' + ')
683108500145F1//SMSC address 13800510541
24//Basic parameters (TP-MTI/MMS/RP)
0D//Reply address number, a total of 13 decimal numbers (excluding 91 and ' F ')
91//Reply address format (TON/NPI)
688119139716F9//Reply to address (Tp-ra)
00//Protocol ID (TP-PID)
08//User Information encoding method (Tp-dcs)
90809281543223//Timestamp (tp-scts) 090829 18 45 23 32
06//user information Length (tp-udl)
4f60597d0021//user information (Tp-ud)
********************************************************************************/
Short Message related instructions (RPM)
Short Message related instructions
|
CSMS |
Select Information Services 0 compatible GSM07.05 Phase 2 version 4.7.0 1 compatible GSM07.05 Phase version |
At+csms=0 +csms:1,1,1
At+csms=1 +csms:1,1,1 |
Sms-mo Sms-mt SMS-CB (cell broadcast) All support |
Cnma |
New SMS Received Confirmation |
CPMS |
Preferred SMS Store SM is the SIM area, BM is the memory area, the default is SM |
At+cpms=? +cpms: (("SM", "BM"), ("SM"))
at+cpms= "SM" +cpms:3,25,3,25
at+cpms= "BM" +cpms:0,20,3,25 |
(1) Information for reading and deleting (2) Information for writing and sending
Used 1, total 1, used 2, total 2 |
Cmgf |
Set SMS Encoding method (1 text format, 0 PDU format) |
CSAs |
Stores information about CSCA and CSMP in E2prom |
CRES |
Recover relevant information from E2prom |
CSDH |
Display text Format parameters (1 for display, 0 for not shown) |
At+cdsh=1 +CMT: "+8613501154105", "01/09/12,18:04:09+32", 145,4,0,0, "+8613800100500", 145,3 Aaa
At+csdh=0 +CMT: "+8613501154105",, "01/09/12,18:04:48+32" Aaa |
The relevant information is +CMTI,+CMT,+CDS,+CMGR,+CMGL
Two examples on the left are also sending and receiving AAA for content SMS |
CNMI |
How SMS is exported |
at+cnmi=2,2,0,0,0 +CMT: "+8613501154105",, "01/09/13,11:04:09+32" Aaa
at+cnmi=2,1,0,0,0 +CMTI: "SM", 4 |
Where the 2nd bit determines whether the SMS is directly output or stored in "SM"
The left two example is also sent and received AAA for the content of SMS, for 0 does not receive |
Cmgr |
Read the information stored in "SM" |
|
At+cmgr=1+cmgr: "REC READ", "+8613501154102",, "01/08/14,10:46:47+32" X000e8
At+cmgr=4+cmgr: "REC unread", "+8613501154105",, "01/09/13,11:02:06+32" Aaa
At+cmgr=2+cmgr: "REC READ", "+8613501154105",, "01/08/23,16:32:34+32" DCS Format Error at+cmgf=0;+cmgr=2 +cmgr:1,,26 0891683108100005f0040d91683105114501f500081080326123432306004400460044 |
Read Article 1th SOURCE 13501154102
Read Article 4th SOURCE 13501154105
I encountered DCS format error when I read 2nd, and then read out the data after turning it into PDU format. SOURCE 13501154105 |
Cmgl |
List of information (+CMGL: index, type, length, content) |
at+cmgl=4+cmgl:1,1,,26 0891683108100005f0040d91683105114501f20000108041016474230658180c56c401 +cmgl:2,1,,26 0891683108100005f0040d91683105114501f500081080326123432306004400460044 +cmgl:3,1,,32 0891683108100005f0040d91683105114501f50008108032617492230c003400310032003100320033 +cmgl:4,1,,23 0891683108100005f0040d91683105114501f500001090311120602303c16010 |
Type "REC Unread" 0 "REC READ" 1 "STO Unsent" 2 "STO SENT" 3 "All" 4 |
CMGS |
SMS can be sent in text or PDU mode |
At+cmgf=1ok At+cmgs=13501154105> aaa<^z> +cmgs:204 Ok
At+cmgf=0ok At+cmgs=18 >0011000D91683105114501F500040103414141<^Z> +cmgs:205 Ok
|
Send As Text
Send As PDU mode |
Cmgw |
Write information to memory |
at+cmgw= "+8613501154105" > Aaa<^z> +cmgw:5 Ok
at+cmgw= <^Z> |
Write as Text
Write by PDU |
CMSS |
Sending information from memory |
at+cmss=5+cmss:207 Ok
+CMT:, 23 0891683108100005f0040d91683105114501f500001090316163932303c16010
at+cmss=5,+8613501154102+cmss:210 Ok |
The 5th message in the Send memory
Receive information
The 5th message can also be sent to the specified user |
CSMP |
Set text Format parameters, +CSMP: |
At+csmp? +csmp:1,167,0,0
Ok |
Where information is valid, 167 default 0-143: (vp+1) * 5 minutes 143-167:12 hours + (VP-143) * 30 minutes 168-196: (VP-166) * 1 days 197-255: (VP-192) * 1 weeks |
Cmgd |
Delete information, at+cmgd=< Index > |
Csca |
SMS Service Center Number |
|
At+csca? +csca: "+8613800100500", 145 Ok |
Beijing Short Message Service center number |
Cscb |
Select cell Broadcast Information type |
Wcbm |
Cell Broadcast Information identifiers |
WMSC |
Information status correction |
Wmgo |
Information rewriting |
GSM SMS-related at command (RPM)