Checking if the GSM/GPRS Modem or Mobile Phone Supports the Use of AT Commands to Send, Receive and Read SMS Messages (Tutorial 19)


After testing the communication between the PC and GSM/GPRS modem/mobile phone, the next thing that you may want to do is to check if the GSM/GPRS modem or mobile phone supports the use of AT commands to send, receive and read SMS messages. Most GSM/GPRS modems support all three functions, while only some mobile phones do.


Sending SMS Messages

To find out whether a GSM/GPRS modem or mobile phone supports the sending of SMS messages through AT commands, you have to:

  1. Use the AT command +CSMS (command name in text: Select Message Service) to check whether mobile-originated SMS messages are supported.

  2. Perform test operations to check whether +CMGS (command name in text: Send Message) and/or +CMSS (command name in text: Send Message from Storage) are supported.
    (You may want to check the AT commands +CMGW [command name in text: Write Message to Memory] and +CMGD [command name in text: Delete Message] in addition as they are sometimes used together with +CMSS.)


Receiving SMS Messages and Reading SMS Messages from Message Storage

To find out whether a GSM/GPRS modem or mobile phone supports the receiving and reading of SMS messages through AT commands, you have to:

  1. Use the AT command +CSMS (command name in text: Select Message Service) to check whether mobile-terminated SMS messages are supported.

  2. Perform test operations to check whether +CNMI (command name in text: New Message Indications to TE), +CMGL (command name in text: List Messages) and/or +CMGR (command name in text: Read Message) are supported.

If the GSM/GPRS modem or mobile phone supports the +CNMI AT command, it can send a notification or directly forward the message to the PC whenever a new SMS message arrives.

If the GSM/GPRS modem or mobile phone does not support +CNMI but supports +CMGL and/or +CMGR, the PC has to poll the GSM/GPRS modem or mobile phone repeatedly in order to know if any new SMS messages have arrived.

from developershome .com