Suppose we want to send the text message "Sending text messages is easy." from a computer / PC to the mobile phone number 91234567 using the +CMGS AT command in SMS text mode. Here is the command line to be used:
To send the same text message using the +CMSS AT command, first we have to use the AT command +CMGW (command name in text: Write Message to Memory) to write the text message to the message storage area. In SMS text mode, the command line should be:
DELETING SMS MESSAGES FROM MESSAGE STORAGE (AT+CMGD)
The AT command +CMGD (command name in text: Delete Message) is used to delete SMS message(s) from message storage. The message storage area from which SMS messages are
deleted is specified by the +CPMS AT command (command name in text: Preferred Message Storage).
Demonstrating How to Use the +CMGD AT Command to Delete SMS Text Messages
Now let's see an example that demonstrates how to use the +CMGD AT command to delete an SMS text message from the message storage area. Suppose we have written an SMS text message to the message storage area by the +CMGW AT command like this:
AT+CMGW="+85291234567" > A simple demo of SMS text messaging. +CMGW: 1 OK
The information response of the +CMGW AT command tells us that the SMS text message is stored in the memory location at index 1. To delete the SMS text message, specify 1 to the index parameter of the +CMGD AT command, like this:
(Important note: Make sure you are writing text messages to and deleting text messages from the same message storage area. If not, we may delete the wrong text message.
The final result code OK indicates the SMS text message "A simple demo of SMS text messaging." was deleted successfully. If the operation fails, the final result code returned will either be ERROR or +CMS ERROR.
SMS TEXT MODE & PDU MODE
OPERATING MODE: SMS TEXT MODE AND SMS PDU MODE
The SMS specification has defined two modes in which a GSM/GPRS modem or mobile phone can operate. They are called SMS text mode and SMS PDU mode. (PDU stands for Protocol Data Unit.) The mode that a GSM/GPRS modem or mobile phone is operating in determines the syntax of some SMS AT commands and the format of the responses returned after execution. These two AT commands are useful to you only if SMS text mode is used:
• +CSMP (Set Text Mode Parameters)
• +CSDH (Show Text Mode Parameters)
Comparison of SMS Text Mode and SMS PDU Mode
Below we compare SMS text mode and SMS PDU mode from various aspects. The comparison should help you to learn the differences between these two modes and decide which mode should be used by your SMS messaging application.
Syntax of SMS AT Commands and Responses
When the GSM/GPRS modem or mobile phone is operating in different modes, the syntax of certain SMS AT commands and the responses returned after command execution is different. Here's an example for illustration. Let's say we would like to send the SMS message "It is easy to send text messages." to the mobile phone number +85291234567. In SMS text mode, this is the command line that you should enter:
However, if the GSM/GPRS modem or mobile phone is operating in SMS PDU mode, executing the above command line will cause an error to occur. This is because the syntax of the +CMGS AT command is different in SMS PDU mode. To do the same task, the following command line should be used instead: