SMS AT commands - how can i identify when a new SMS message is received, and which index number the message is stored under.

I know that "AT+CPMS" checks the message storage space, so i can use this to determine when a new message has arrived - but i do not know which index number the SMS is stored at.

I have to use "AT+CMGR=x" (where x is the index number) to check every possible message index.

"AT+CMGF" will list all messages - but takes far to long (typically about 20 seconds).

How can i identify which index number a new SMS message is stored at.
mnewettAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

FismanCommented:
Firstly the exact behaviour depends on the hardware you are using. Which modem are you using?

The easiest way is to enable incoming message notifications bys using AT+CNMI=?,? you should have a look at the specifications to determine which parameters you need. I use AT+CNMI=3,(1-3) depending what I need [(1-3) meaning 1, 2 or 3].

This will give you a unsolicited responce +CMTI <mem>,<index> for new messages.

The only other way is to get the list of messages AT+CMGL (I assume this is what you meant by CMGF in your question as CMGF sets the message format). You would use AT+CMGL=<type>

There are no other short ways to get the new messages which are standard GSM 07.07 commands. There may be proprietary commands from your modem manufacturer but since the SIM processor is not very fast at finding messages it will always be slow.

Have you tried playing around with the message storage location? If you store messages on the modem instead of on the SIM it should perform much better. You can do this using AT+CPMS
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Networking Hardware-Other

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.