22. Preferred Message Storage (AT+CPMS)

The AT command +CPMS (command name in text: Preferred Message Storage) serves several purposes. It can be used to:

1. Select the message storage area that will be used when sending, receiving, reading, writing or deleting SMS messages.

2. Find the number of messages that are currently stored in the message storage area.

3. Find the maximum number of messages that can be stored in the message storage area.


22.1. Selecting the Message Storage Areas to be Used for SMS Reading, Writing, Deleting, Sending or Receiving

To select the message storage areas to be used for SMS reading, writing, deleting, sending or receiving, you should perform a set operation with the +CPMS AT command. The syntax is: (Optional parameters are enclosed in square brackets.)


+CPMS=message_storage1[,message_storage2[,message_storage3]]


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:


AT+CPMS="ME","SM","MT"


The message_storage1 Parameter

The first parameter of the +CPMS AT command, message_storage1, specifies the message storage area that will be used when reading or deleting SMS messages. (For details about reading SMS messages, see AT commands +CMGR and +CMGL. For details about deleting SMS messages, see the AT command +CMGD.)


The message_storage2 Parameter

The second parameter of the +CPMS AT command, message_storage2, specifies the message storage area that will be used when sending SMS messages from message storage or writing SMS messages. (For details about sending SMS messages from message storage, see the AT command +CMSS. For details about writing SMS messages, see the AT command +CMGW.)


The message_storage3 Parameter

The third parameter of the +CPMS AT command, message_storage3, specifies the preferred message storage area for storing newly received SMS messages. If you use the +CNMI AT command (command name in text: New Message Indications to TE) to tell the GSM/GPRS modem or mobile phone to forward newly received SMS messages directly to the PC instead of storing them in the message storage area, you do not need to care about the message_storage3 parameter.


Values that May be Assigned to the Parameters of the +CPMS AT Command

Here are the values defined in the SMS specification that may be assigned to the parameters message_storage1, message_storage2 and message_storage3:

Note that a GSM/GPRS modem or mobile phone may not support all the above values and it may support other manufacturer specific values. To learn how to find the values supported by your GSM/GPRS modem or mobile phone, please refer to the section "Finding the Message Storage Areas Supported by a GSM/GPRS Modem or Mobile Phone".


22.2. Format of the Information Response of the +CPMS AT Command

If the GSM/GPRS modem or mobile phone executes the +CPMS set command successfully, it will return an information response to the computer / PC. The information response of the +CPMS AT command has the following format:


+CPMS: used_space1,max_space1,used_space2,max_space2,used_space3,max_space3



22.3. Finding the Message Storage Areas Supported by a GSM/GPRS Modem or Mobile Phone

Before we can use the +CPMS AT command to select the message storage areas to be used for various SMS operations, we have to know what message storage areas are supported by the GSM/GPRS modem or mobile phone. Among the six types of message storage area mentioned in the last section, "SM", "ME" and "MT" are commonly supported by GSM/GPRS modems and mobile phones. To find out the message storage areas that are supported by your GSM/GPRS modem or mobile phone, you can perform a test operation with the +CPMS AT command using the command line below:


AT+CPMS=?


If the GSM/GPRS modem or mobile phone executes the above command line successfully, it will return an information response to the computer / PC. The information response of the +CPMS AT command has the following format:


+CPMS: (storage1a,storage1b,...),(storage2a,storage2b,...),(storage3a,storage3b,...)


The first, second and third parentheses contain the values supported by the message_storage1 parameter, the message_storage2 parameter and the message_storage3 parameter respectively.


Previous Page Page 36 of 65 Next Page

Contents at a Glance (Click Here for Full Table of Contents)

Feedback Form (ExpandCollapse)

What do you think about this web page?






(Optional) Please provide us more details. For example, suppose you select option 2 above, can you tell us specifically what information is missing? You can also suggest anything that can help us improve this web page.

(Optional) Your name:

(Optional) Your email address:

Please enter again to confirm:

Due to the amount of messages we received, we may not be able to reply to all messages.

A button for going back to the top of this page