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. Below are the SMS AT commands affected:
+CMGS (Send Message)
+CMSS (Send Message from Storage)
+CMGR (Read Message)
+CMGL (List Messages)
+CMGW (Write Message to Memory)
+CNMA (New Message Acknowledgement to ME/TA)
+CMGC (Send Command)
The syntax of the unsolicited result codes below also depends on the mode in which the GSM/GPRS modem or mobile phone is operating:
+CMT (Used to forward received SMS messages to the computer / PC.)
+CBM (Used to forward received cell broadcast messages to the computer / PC.)
+CDS (Used to forward received status reports to the computer / PC.)
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 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 you 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:
AT+CMGS="+85291234567"
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:
AT+CMGS=42
Defined Values for Certain Parameters
When the GSM/GPRS modem or mobile phone is operating in different modes, the defined values for certain parameters are different. Usually string values are defined for text mode while numeric values are defined for PDU mode. For example, the +CMGL AT command is used to list SMS messages stored in message storage. It takes one parameter that specifies the status of the SMS messages to be retrieved. The following table lists the defined values for the parameter in text mode and PDU mode:
Message status | Defined values in text mode | Defined values in PDU mode |
---|---|---|
Received unread | "REC UNREAD" | 0 |
Received read | "REC READ" | 1 |
Stored unsent | "STO UNSENT" | 2 |
Stored sent | "STO SENT" | 3 |
All messages | "ALL" | 4 |
Suppose you would like to list all SMS messages from message storage. If the GSM/GPRS modem or mobile phone is operating in SMS text mode, you should assign the string value "ALL" to the +CMGL AT command, like this:
AT+CMGL="ALL"
In SMS PDU mode, the numeric value 4 should be assigned to the +CMGL AT command instead:
AT+CMGL=4
Input/Output Format of SMS Messages Used by SMS AT Commands
When the GSM/GPRS modem or mobile phone is operating in different modes, the input/output format of SMS messages used by SMS AT commands is different. In SMS text mode, headers and body of SMS messages are inputted/outputted as separate parameters/fields. In SMS PDU mode, TPDUs (Transport Protocol Data Units) in hexadecimal format are inputted and outputted. Headers and body of SMS messages are encoded in the TPDUs.
Here is an example for illustration. To send the SMS message "It is easy to send text messages." to the mobile phone number +85291234567, the following command line should be used in SMS text mode. As you can see below, the destination phone number header and message body are provided to the +CMGS AT command as separate parameters.
AT+CMGS="+85291234567"
To send the same SMS text message in SMS PDU mode, the following command line should be used instead. The message body, destination phone number header and some other headers are encoded in the hexadecimal sequence.
AT+CMGS=42
Ease of Use
As you can see in the previous example, it is easier to use AT commands in SMS text mode. You do not have to learn about the structure of different types of TPDUs in the bit level and the encoding and decoding of the hexadecimal sequence.
Supported Features of SMS Messaging
Although it is easier to use AT commands in SMS text mode, it supports fewer features of SMS messaging than SMS PDU mode. This is because you do not have complete control over the header values and message body in SMS text mode. Some tasks, although can be done in text mode, require the programmer to have knowledge about PDU mode and TPDU. For example, to request a status report from SMSC in SMS text mode, you have to set bit 5 of the first octet of the SMS-SUBMIT TPDU to 1 by the AT command +CSMP (command name in text: Set Text Mode Parameters). Similar tasks include setting the message validity period and sending a flash SMS message that immediately pops up on the phone screen when it arrives at the destination.
Level of Support
SMS PDU mode is more commonly supported by GSM/GPRS modems and mobile phones than SMS text mode.
from developershome .com