3

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?

hlovdal
  • 26,565
  • 10
  • 94
  • 165
user1024858
  • 129
  • 3
  • 5
  • 11

1 Answers1

8

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))

Community
  • 1
  • 1
hlovdal
  • 26,565
  • 10
  • 94
  • 165