User Manual

Table Of Contents
SARA-R4 series-AT commands manual
UBX-17003787 - R16
9Short Messages Service
Page 91 of 401
9.13Write message to memory +CMGW
+CMGW
Modules All products
Syntax PIN required Settings saved Can be aborted Response time Error referenceAttributes
full Yes No No <10 s +CMS Error
9.13.1Description
Stores a message (SMS-DELIVER or SMS-SUBMIT) to memory storage <mem2> and returns the memory
location <index> of the stored message. <Ctrl-Z> indicates that the SMS shall be stored, while <ESC> indicates
aborting of the edited SMS.
The entered text/PDU is preceded by a ">" (Greater-Than sign) character, and this indicates that the
interface is in "text/PDU enter" mode. The DCD signal shall be in ON state while the text/PDU is entered.
9.13.2Syntax
Type Syntax Response Example
Text mode (+CMGF=1):
AT+CMGW[=<oa/da>[,<tooa/toda>[,
<stat>]]]<CR>
text is entered<Ctrl-Z/ESC>
+CMGW: <index>
OK
AT+CMGW="091137880"<CR>
> This is the text<Ctrl-Z>
+CMGW: 303
OK
Set
PDU mode (+CMGF=0):
AT+CMGW=<length>[,<stat>]<CR>
PDU is given<Ctrl-Z/ESC>
+CMGW: <index>
OK
AT+CMGW=13<CR>
> 039121430100038166F600000
4E374F80D<Ctrl-Z>
+CMGW: 303
OK
Test AT+CMGW=? OK
9.13.3Defined values
Parameter Type Description
<da> String TP-Destination-Address Address-Value field (see the 3GPP TS 23.040 [8]); BCD
numbers (or GSM 7 bit default alphabet characters) are converted to characters
of the currently selected TE character set (see the +CSCS AT command); type of
address given by <toda>
<oa> String TP-Originating-Address Address-Value field (see the 3GPP TS 23.040 [8]); BCD
numbers (or GSM 7 bit default alphabet characters) are converted to characters
of the currently selected TE character set (see the +CSCS AT command); type of
address given by <tooa>
<tooa> Number TP-Originating-Address Type-of-Address octet (see the 3GPP TS 24.011 [13]); see the
<toda> parameter for the default value
<toda> Number TP-Destination-Address Type-of-Address octet (see the 3GPP TS 24.011 [13]); when
the first character of <da> is + (IRA 43) the default value is 145, otherwise it is 129)
<stat> Number or
String
Number type in PDU mode (default value: 2), or string type in text mode (default
value: "STO UNSENT"); it indicates the message status in memory:
0: in PDU mode or "REC UNREAD" in text mode: received unread SMS messages
1: in PDU mode or "REC READ" in text mode: received read SMS messages
2: in PDU mode or "STO UNSENT" in text mode: stored unsent SMS messages
3: in PDU mode or "STO SENT" in text mode: stored sent SMS messages
<text> String SMS string
<index> Number Storage position
<length> Number The parameter meaning depends on the message format:
In text mode: number of characters
In PDU mode: PDU's length in octets without the Service Center's address. In
example: 039121430100038166F6000004E374F80D is a PDU with Service Center's
number +1234, that generates the address 03912143 (4 octets). Thus in this case
<length>=13.