`
xusaomaiss
  • 浏览: 616751 次
  • 性别: Icon_minigender_1
  • 来自: 厦门
社区版块
存档分类
最新评论

Writing SMS Messages to Memory / Message Storage

阅读更多

转自:http://www.developershome.com/sms/cmgwCommand.asp

如果是搞MTK或是与AT模块有关的人,去上面的网址看看,一定会收获很多,MTK的AT文档其中有些错误,上面网页中讲的比较详细.

The AT command +CMGW (command name in text: Write Message to Memory) is used to write an SMS message to memory (i.e. message storage). The memory/message storage area to which SMS messages are written is specified by the +CPMS AT command (command line in text: Preferred Message Storage). Details about the +CPMS AT command can be found in the earlier section "Preferred Message Storage (AT+CPMS) " of this SMS tutorial.

 

23.1. Syntax of the +CMGW AT Command in SMS Text Mode

In SMS text mode, the syntax of the +CMGW AT command is: (Optional parameters are enclosed in square brackets.)

 

+CMGW[=address [,address_type [,message_status ]]]<CR>sms_message_body<Ctrl+z>

 

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+CMGW="+85291234567",145,"STO UNSENT"<CR> This is an example for illustrating the syntax of the +CMGW AT command in SMS text mode.<Ctrl+z>

 

The address Parameter

The first parameter of the +CMGW AT command, address , specifies the destination address to send the SMS message to. Usually it is a mobile number formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163). For example, "+85291234567" and "91234567". Note that the value passed to the address parameter should be a string, i.e. it should be enclosed in double quotes.

The address parameter is optional and so it can be omitted. Later when you want to send the SMS message out, you can specify the destination address by the +CMSS AT command (command name in text: Send Message from Storage).

 

The address_type Parameter

The second parameter of the +CMGW AT command, address_type , specifies the type of the address assigned to the address parameter. Two values are commonly used. They are 129 and 145:

  • 129 . Meaning: The value of address is formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163) but it is not sure whether the value of address is an international number, a national number or a number of other types. Example addresses: "85291234567", "91234567".

  • 145 . Meaning: The value of address is formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163) and it is an international number. Example address: "+85291234567".

As address_type is an optional parameter, it can be omitted. If you do so, the GSM/GPRS modem or mobile phone will use the default value of the address_type parameter, which is:

  • 129 if the value of address does not start with a "+" character. For example, "85291234567".

  • 145 if the value of address starts with a "+" character. For example, "+85291234567".

 

The message_status Parameter

The third parameter of the +CMGW AT command, message_status , specifies the status of the SMS message to be written. The SMS specification has defined four status values:

  • REC UNREAD . It refers to the message status "received unread".

  • REC READ . It refers to the message status "received read".

  • STO UNSENT . It refers to the message status "stored unsent". This is the default value.

  • STO SENT . It refers to the message status "stored sent".

Note that the value assigned to the message_status parameter should be a string. Thus, it should be enclosed in double quotes.

As message_status is an optional parameter, it can be omitted. If you do so, the GSM/GPRS modem or mobile phone will use the default value of the message_status parameter, which is "STO UNSENT".

 

The <CR> Character

<CR> , which represents the carriage return character, follows the message_status parameter. When the GSM/GPRS modem or mobile phone receives the carriage return character, it will send back a prompt formed by these four characters: the carriage return character, the linefeed character, the ">" character and the space character. If you don't understand what this means, don't worry. This should be clear to you when you see the example in the section "Example Demonstrating How to Use the +CMGW AT Command to Write SMS Text Messages to Message Storage in SMS Text Mode ".

 

The sms_message_body Parameter

The fourth parameter of the +CMGW AT command, sms_message_body , specifies the SMS message body to be written to the memory/message storage area. Entering the <Esc> character will cancel the +CMGW AT command. If you don't understand what this means, see the example in the section "Example Demonstrating How to Use the +CMGW AT Command to Write SMS Text Messages to Message Storage in SMS Text Mode ".

 

The <Ctrl+z> Character

When you finish entering the SMS message body, you have to enter the <Ctrl+z> character to mark the end of the SMS message body. The GSM/GPRS modem or mobile phone will then attempt to write the SMS message to the memory/message storage area.

 

23.2. SMSC Number Stored with the SMS Message (SMS Text Mode)

In SMS text mode, the +CMGW AT command does not have a parameter that allows you to specify an SMSC number. (Note that the +CMGW AT command does have such parameter when the GSM/GPRS modem or mobile phone is operating in SMS PDU mode.) However, when an SMS message is written to message storage, an SMSC number is actually stored with it. The SMSC number stored is the one specified by the +CSCA AT command (command name in text: Service Centre Address). Later if you send the SMS message, it will be transmitted through this SMSC. Once an SMS message has been written to message storage, it is not possible to change the SMSC number stored with the SMS message by using AT commands.

Note that it is possible that the command behavior on your mobile device is slightly different from what was described above.

More information about this issue is available in the "SMSC Number to be Used by the +CMSS AT Command to Send SMS Messages " section of this SMS tutorial.

 

23.3. Format of the Information Response of the +CMGW AT Command in SMS Text Mode

If the GSM/GPRS modem or mobile phone writes the SMS message to the message storage area successfully, it will return an information response to the computer / PC. In SMS text mode, the information response of the +CMGW AT command has the following format:

 

+CMGW: index

 

index is an integer that tells us the memory location to which the SMS message was written in the message storage area.

分享到:
评论

相关推荐

    orcl安装参数

    orcl安装参数

    MIPS Data Memory (练习)

    1 -&gt; enable writing to data memory, 0 -&gt; disable writing to data memory - Address for read/write operand (A -&gt; n_bits_address bits = 32 bits) - Write Data for write operand (WD -&gt; data_mem_width...

    CSAPP Lab 5:Writing a Dynamic Storage Allocator实验材料

    《深入理解计算机系统》(CSAPP)是一门深入探索计算机硬件与软件交互的课程,而实验5的主题是“Writing a Dynamic Storage Allocator”,即编写一个动态存储分配器。这个实验旨在帮助学生理解内存管理机制,特别是...

    From inquiry to academic writing

    本文是一本关于从调查研究到学术写作的英文写作教程,书名为《From Inquiry to Academic Writing - A text and reader》第二版。这本书由Stuart Greene和April Lidinsky联合撰写,他们分别来自圣母大学和印第安纳...

    kaggle赛题Linking Writing Processes to Writing Quality源代码

    基于kaggle赛题Linking Writing Processes to Writing Quality的源代码。 在写作过程中,很难总结出一系列复杂的行为和认知活动。作者可能会使用不同的技巧来计划和修改他们的作品,展示不同的停顿模式,或者在写作...

    Design Exploration of Emerging Nano-scale Non-volatile Memory

    The analysis of big data at exascale (1018 bytes or flops) has introduced the emerging need to reexamine the existing hardware platform that can support intensive dataoriented ...writing/erasing cycles

    From Hacking to Report Writing An Introduction to Security and Penetration epub

    From Hacking to Report Writing An Introduction to Security and Penetration Testing 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除

    Steps to Writing Well with Additional Readings

    Jean Wyrick's rhetorically organized STEPS TO WRITING WELL WITH ADDITIONAL READINGS is known for its student-friendly tone and the clear way it presents the basics of essay writing in an easy-to-...

    From Hacking to Report Writing An Introduction to Security and 无水印pdf

    From Hacking to Report Writing An Introduction to Security and Penetration Testing 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传...

    The Complete Idiot's Guide to Writing Shell Extensions.chm

    Explorer扩展编程的指导资料,包括一个chm教程以及其对应的源代码。 Part I - A step-by-step ...Part V - A tutorial on writing a shell extension that adds pages to the properties dialog of files ......

    On Writing Well 2006 (30th Anniversary Edition)

    It is a book for everybody who wants to learn how to write or who needs to do some writing to get through the day, as almost everybody does in the age of e-mail and the Internet. Whether you want to ...

    Online Messages Writing-Style Features

    A Framework for Authorship Identification of Online Messages Writing-Style Features and Classification Techniques

    cl-project:生成现代项目框架

    -&gt; writing /Users/fukamachi/Programs/lib/cl-sample/.gitignore ; writing /Users/fukamachi/Programs/lib/cl-sample/README.markdown ; writing /Users/fukamachi/Programs/lib/cl-sample/cl-sample-test.asd ; ...

    Memo Writing _memory_memo_

    标题中的“Memo Writing _memory_memo_”暗示了这是一个关于编写内存管理备忘录的教程,主要面向Windows平台的开发者。在Windows开发中,理解内存管理和优化是至关重要的,因为这直接影响到应用程序的性能、稳定性和...

    A helpful guide to essay writing

    《A helpful guide to essay writing》是一份涵盖了撰写论文所需知识的指南,它融合了多份出版物的材料,为学生提供了一个关于如何写作论文的全面指导。这份指南分为两个主要部分,第一部分关注的是结构与组织,第二...

    Academic_Writing_From_Paragraph_to_Essay

    内容翔实,可有效提高英语专业表达能力和写作水平。

    On Writing Well

    On Writing Well 英文写作圣经。 On Writing Well is a craft book. That's what I set out to write 25 years ago—a book that would teach the craft of writing warmly and clearly—and its principles have ...

    Linux中出现“No space left on device”错误的排查与解决方法

    前言 最近这两天登陆服务器,发现用 wget 下载文件的时候提示“No space left on device”,而且连使用 tab 键进行补全时也会提示该错误。 之前遇到过一次这种问题,是由于磁盘空间被占满了,导致无法创建新文件。...

Global site tag (gtag.js) - Google Analytics