user1024858
user1024858

Reputation: 129

Trouble reading messages with AT+CMGL="ALL"

I'm programming a modem using AT commands. When I execute AT+CMGL="ALL", sometimes, it does not return anything. At other times, it returns the list of messages.

Could you tell me why?

Upvotes: 3

Views: 13070

Answers (1)

hlovdal
hlovdal

Reputation: 28228

It depends on whether the phone is configured to PDU mode or text mode. The 27.005 standard says:

<stat> integer type in PDU mode (default 0), or string type in text mode (default
"REC UNREAD"); indicates the status of message in memory; defined values:
       0 "REC UNREAD"   received unread message (i.e. new message)
       1 "REC READ"     received read message
       2 "STO UNSENT"   stored unsent message (only applicable to SMs)
       3 "STO SENT"     stored sent message (only applicable to SMs)
       4 "ALL"          all messages (only applicable to +CMGL command)

So you should run

AT+CMGF=1
AT+CMGL="ALL"

(Possibly also AT+CPMS to be sure of which storage you are reading from (notice that you probably want to specify both <mem1> and <mem2))

Upvotes: 8

Related Questions