Text mode vs PDU mode
The SIM900 module supports both text and PDU mode. Please note that some AT commands have different syntax depending on which mode is currently active.
To check which mode is currently active (0: PDU mode, 1: Text mode):
AT+CMGF?
Retrieving SMS's
You can use the CMGL command to retrieve unread, read, stored unsent, stored sent, or all messages.
If text mode is currently selected:
AT+CMGL=STAT,MODE
Parameters:
STAT:
"REC UNREAD" Received unread messages
"REC READ" Received read messages
"STO UNSENT" Stored unsent messages
"STO SENT" Stored sent messages
"ALL" All messages
MODE: (OPTIONAL)
0 Normal
1 Not change status of the specified SMS record
In other words, the following command should print all SMS messages:
AT+CMGL="ALL"
If PDU mode is currently selected:
AT+CMGL=STAT,MODE
Parameters:
STAT:
0 Received unread messages
1 Received read messages
2 Stored unsent messages
3 Stored sent messages
4 All messages
MODE: (OPTIONAL)
0 Normal
1 Not change status of the specified SMS record
In other words, the following command should print all SMS messages:
AT+CMGL=4
Example
If text mode is currently selected, and a CMGL command is issued, the following is an example of what could be expected (note there's a line break before the actual message starts).
AT+CMGL="ALL"
+CMGL: 1,"REC READ","+85291234567",,"07/05/01,08:00:15+32",145,37
It is easy to list SMS text messages.
1 : Message index
"REC READ" : Message status (it's been read before)
"+85291234567" : Source number (ie the person that sent you the sms)
"07/05/01,08:00:15+32" : Service center timestamp
145 : Character set
37 : Length of message
Refer to Section 4.2.3, page 99, of the SIM900 AT command set for more information.
External links