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:
SM.
It refers to the message storage area on the SIM card.
ME.
It refers to the message storage area on the GSM/GPRS modem or
mobile phone. Usually its storage space is larger than that of the
message storage area on the SIM card.
MT.
It refers to all message storage areas associated with the GSM/GPRS
modem or mobile phone. For example, suppose a mobile phone can
access two message storage areas: "SM" and "ME".
The "MT" message storage area refers to the "SM"
message storage area and the "ME" message storage area
combined together.
BM.
It refers to the broadcast message storage area. It is used to store
cell broadcast messages.
SR.
It refers to the status report message storage area. It is used to
store status reports.
TA.
It refers to the terminal adaptor message storage area.
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
used_space1
is the number of messages currently stored in the message storage
area specified by the message_storage1
parameter.
max_space1
is the maximum number of messages that can be stored in the message
storage area specified by the message_storage1
parameter.
used_space2
is the number of messages currently stored in the message storage
area specified by the message_storage2
parameter.
max_space2
is the maximum number of messages that can be stored in the message
storage area specified by the message_storage2 parameter.
used_space3
is the number of messages currently stored in the message storage
area specified by the message_storage3
parameter.
max_space3
is the maximum number of messages that can be stored in the message
storage area specified by the message_storage3
parameter.
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.
Feedback Form (ExpandCollapse)
|
|