WRITING SMS MESSAGES TO MEMORY / MESSAGE STORAGE (AT+CMGW)
The AT command +CMGW (command name in text: Write Message to Memory) is used to write an SMS message to memory (i.e. message storage). The memory/message storage area to which SMS messages are written is specified by the +CPMS AT command (command line in text: Preferred Message Storage).
Syntax of the +CMGW AT Command in SMS Text Mode
In SMS text mode, the syntax of the +CMGW AT command is: (Optional parameters are enclosed in square brackets.)
Before we discuss each of the parameters, let's see an example that gives you some idea of how an actual command line should look like:
This is an example for illustrating the syntax of the +CMGW AT command in SMS text mode.
When you finish entering the SMS message body, you have to enter the
READING SMS MESSAGES FROM A MESSAGE STORAGE AREA USING AT COMMANDS (AT+CMGR, AT+CMGL)
To enable a computer / PC to read SMS messages from a message storage area, the GSM/GPRS modem or mobile phone has to support either of the AT commands +CMGR (command name in text: Read Messages) and +CMGL (command name in text: List Messages). The +CMGR AT command is used to read an SMS message at a certain location of the message storage area, while the +CMGL AT command is used to read SMS messages that have a certain status from the message storage area. The status can be "received unread", "received read", "stored unsent", "stored sent", etc. The +CMGL AT command also allows you to retrieve all SMS messages stored in the message storage area.
Following is an example for illustrating the difference between +CMGR and +CMGL. Suppose we want to use your computer / PC to read a text message from the message storage area and we know the index at which the SMS text message is located. In this case, we
should use the +CMGR AT command. Here is the command line to be typed (assume the SMS text message is stored at index 3):
The GSM/GPRS modem or mobile phone should return something like this:
+CMGR: "REC READ","+85291234567",,"07/02/18,00:12:05+32" Hello, welcome to our SMS tutorial. OK