25.11. Example Demonstrating How to Use the +CMSS AT Command to Send Text Messages from a Message Storage Area (SMS Text Mode and SMS PDU Mode)
Now let's see a more detailed example that demonstrates how to use the +CMSS AT command to send text messages from a message storage area and how the +CMSS AT command should be used together with other AT commands. Since the syntax of the +CMSS AT command is the same in both SMS text mode and SMS PDU mode, the information provided below applies to both modes.
Selecting the Message Storage Area to Write Text Messages to and Send Text Messages from
First, use the +CPMS AT command (command name in text: Preferred Message Storage) to select the message storage area to write text messages to (+CMGW AT command) and send text messages from (+CMSS AT command). For example, to use the message storage area in the SIM card for writing and sending SMS text messages, assign the string value "SM" to the second parameter of the +CPMS AT command, like this:
The first parameter of the +CPMS AT command is used to select the message storage area for reading and deleting SMS messages. It has no use to us here. So, it does not matter what value is assigned to the first parameter.
Now press the Enter key on the keyboard and you should see something similar to this:
Detailed information about the +CPMS AT command is available in the "Preferred Message Storage (AT+CPMS)" section of this SMS tutorial.
Setting the SMSC Number to be Used to Send SMS Text Messages
Second, use the AT command +CSCA (command name in text: Service Centre Address) to set the SMSC number to be used to send SMS text messages. Usually the default setting is correct and you do not need to make any changes. Below demonstrates how to use the +CSCA AT command to set "+85290000000" as the SMSC number:
Detailed information about the +CSCA AT command can be found in the "Setting or Reading the Service Center Address / SMSC Address (AT+CSCA)" section of this SMS tutorial.
Writing Text Messages
Third, use the +CMGW AT command (command line in text: Write Message to Memory) to write the text message to message storage. Suppose the recipient mobile phone number is +85291234567. If the GSM/GPRS modem or mobile phone is operating in SMS text mode, you should enter something like this in the terminal program and press the Enter key of the keyboard:
The GSM/GPRS modem or mobile phone will return a prompt, as shown below:
Now enter the body of the SMS text message "It is easy to send text messages." and press Ctrl+z on the keyboard to finish. You should see something like this in the terminal program:
> It is easy to send text messages.
The value 3 in the +CMGW information response is the index that specifies the location where the text message is stored in the message storage area. Later, we have to use this index to tell the +CMSS AT command which text message should be sent.
If the GSM/GPRS modem or mobile phone is operating in SMS PDU mode, here's what you should type and see in the terminal program:
For further details the +CMGW AT command, please refer to the earlier section "Writing SMS Messages to Memory / Message Storage (AT+CMGW)" of this SMS tutorial.
Sending Text Messages from Message Storage
Fourth, specify the index "3" to the +CMSS AT command to send the text message out:
"20" is the message reference number allocated by the GSM/GPRS modem or mobile phone to the text message. The final result code OK indicates the text message was sent to the SMSC successfully. If the execution of the AT command +CMSS fails, the GSM/GPRS modem or mobile phone will return either the final result code ERROR or +CMS ERROR.
In the above example, the address parameter of the AT command +CMSS is omitted. Thus, the mobile phone number stored with the SMS text message (i.e. +85291234567) will be used as the destination address. Suppose you want to send the text message to another mobile phone number, say +85298765432, you should assign "+85298765432" to the address parameter of +CMSS, as shown below:
|Previous Page||Page 54 of 65||Next Page|
- 1. Introduction to SMS Messaging
- 2. What Makes SMS Messaging So Successful Worldwide?
- 3. Example Applications of SMS Messaging
- 4. What is an SMS Center / SMSC?
- 5. Basic Concepts of SMS Technology
- 6. Intra-operator SMS Messages
- 7. Inter-operator SMS Messages
- 8. International SMS Messages
- 9. What is an SMS Gateway?
- 10. How to Send SMS Messages from a Computer / PC?
- 11. How to Receive SMS Messages Using a Computer / PC?
- 12. Introduction to GSM / GPRS Wireless Modems
- 13. How to Use Microsoft HyperTerminal to Send AT Commands to a Mobile Phone or GSM/GPRS Modem?
- 14. Introduction to AT Commands
- 15. General Syntax of Extended AT Commands
- 16. Result Codes of AT Commands
- 17. AT Command Operations: Test, Set, Read and Execution
- 18. Testing the Communication between the PC and GSM/GPRS Modem or Mobile Phone
- 19. Checking if the GSM/GPRS Modem or Mobile Phone Supports the Use of AT Commands to Send, Receive and Read SMS Messages
- 20. Operating Mode: SMS Text Mode and SMS PDU Mode
- 21. Setting or Reading the Service Center Address / SMSC Address (AT+CSCA)
- 22. Preferred Message Storage (AT+CPMS)
- 23. Writing SMS Messages to Memory / Message Storage (AT+CMGW)
- 24. Deleting SMS Messages from Message Storage (AT+CMGD)
- 25. Sending SMS Messages from a Computer / PC Using AT Commands (AT+CMGS, AT+CMSS)
- 26. Reading SMS Messages from a Message Storage Area Using AT Commands (AT+CMGR, AT+CMGL)
- 27. Appendix A: How to Choose an SMS Service Provider (SMS Gateway Provider, SMS Reseller, SMS Broker)?
- 28. Appendix B: Comparison Table of SMS Service Providers (SMS Gateway Providers, SMS Resellers, SMS Brokers)
- 29. Appendix C: Free Software/Tools and Libraries for Sending and Receiving SMS Messages with a Computer / PC
- 30. Appendix D: GSM 7-bit Default Alphabet Table (with Character Codes of ISO 8859 Latin 1)