19.2. Checking if
the AT Commands Required for Sending, Receiving and Reading SMS
Messages are Supported
The
next thing to do is to check if the AT commands required for sending,
receiving and reading SMS messages are supported by the mobile phone
or GSM/GPRS modem. As pointed out earlier in this SMS tutorial, you
can check if a certain AT command is supported by performing a test
operation. Simply execute an AT command with "=?" attached
at its end. For example, "AT+CMGS=?".
Before
we begin the check, let's go through an overview of the AT commands
that are required for sending, receiving and reading SMS messages.
You will learn which AT commands should be checked and get a general
idea about when these AT commands should be used.
19.2.1. Overview of
the AT Commands Required
For
Sending SMS Messages
To
send SMS messages via AT commands, the GSM/GPRS modem or mobile phone
has to support either +CMGS (command name in text: Send Message) or
+CMSS (command name in text: Send Message from Storage). You may also
find +CMGW (command name in text: Write Message to Memory) and +CMGD
(command name in text: Delete Message) useful, since they are
sometimes used together with +CMSS. +CMSS is used to send an SMS
message located in the message storage area. If an SMS message does
not exist in the message storage area, you must first use the AT
command +CMGW to write the SMS message to the message storage area
before you can use the AT command +CMSS to send the SMS message to
the SMSC. After message submission, you may use the AT command +CMGD
to delete the SMS message to free some space from the message storage
area.
For
Receiving and Reading SMS Messages
To
receive and read SMS messages via AT commands, the GSM/GPRS modem or
mobile phone has to support the AT command +CNMI (command name in
text: New Message Indications to TE. TE stands for Terminal
Equipment, which is the equipment that controls the GSM/GPRS modem or
mobile phone. For example, a PC / computer), +CMGL (command name in
text: List Messages), or +CMGR (command name in text: Read Messages).
The
AT command +CNMI is used to specify how newly arrived SMS messages
should be handled. You can tell the GSM/GPRS modem or mobile phone
either to forward newly arrived SMS messages directly to the PC, or
to save them in message storage and then notify the PC about their
locations in message storage.
The
AT command +CMGL is used to read all SMS messages that have a certain
status (e.g. "received unread", "received read",
etc) from the message storage area, while the AT command +CMGR is
used to read the SMS message saved at a certain location of the
message storage area.
19.2.2. Beginning
the Check
Now
that you've learned the AT commands required for outbound and inbound
SMS messaging are +CMGS, +CMSS, +CNMI, +CMGL and +CMGR. You can begin
the check by performing a test operation with each of the AT
commands. For example, you can execute the command line "AT+CMGS=?"
to check whether +CMGS is supported, like this:
AT+CMGS=? OK
The
final result code "OK" indicates the AT command +CMGS is
supported. If the GSM/GPRS modem or mobile phone returns the final
result code "ERROR", it means the command is not supported.
A
quicker way is to copy and paste the following command line to the
terminal program and execute it:
AT+CMGS=?;+CMSS=?;+CNMI=?;+CMGL=?;+CMGR=?
As
an example, here shows the response returned from my Nokia 6021 to
HyperTerminal after the execution of above command line:
AT+CMGS=?;+CMSS=?;+CNMI=?;+CMGL=?;+CMGR=? +CNMI:
(0-2),(0-3),(0,2,3),(0-2),(0,1)
+CMGL: (0-4)
OK
The
return of the final result code "OK" indicates all AT
commands under test are supported. If the final result code "ERROR"
is returned, it means one or more AT commands are not supported.
|
Feedback Form (ExpandCollapse)
|
|