本文摘录3gpp27005中关于CNMI的片段,充分理解此文章可以充分根据GSM-MODEM的提示功能,主动打开GSM-MODEM的新短信、状态报告,小区广播提示。
New Message Indications to TE +CNMI
Parameter Command Syntax
Command | Possible response(s) |
+CNMI=[<mode>[,<mt>[,<bm>[,<ds>[, <bfr>]]]]] | +CMS ERROR: <err> |
+CNMI? | +CNMI: <mode>,<mt>,<bm>,<ds>,<bfr> |
+CNMI=? | +CNMI: (list of supported <mode>s),(list of supported <mt>s),(list of supported <bm>s),(list of supported <ds>s),(list of supported <bfr>s) |
Description
Set command selects the procedure, how receiving of new messages from the network is indicated to the TE when TE is active, e.g. DTR signal is ON. If TE is inactive (e.g. DTR signal is OFF), message receiving should be done as specified in 3G TS 23.038 [2].
NOTE: When DTR signal is not available or the state of the signal is ignored (V.25ter command &D0), reliable message transfer can be assured by using +CNMA acknowledgement procedure.
<mode> controls the processing of unsolicited result codes specified within this command, <mt> sets the result code indication routing for SMS-DELIVERs, <bm> for CBMs and <ds> for SMS-STATUS-REPORTs. <bfr> defines the handling method for buffered result codes when <mode> 1, 2 or 3 is enabled. If ME does not support requested item (although TA does), final result code +CMS ERROR: <err> is returned. See chapter Message Service Failure Result Code for a list of <err> values.
Test command gives the settings supported by the TA as compound values.
NOTE: Command Select Message Service +CSMS should be used to detect ME support of mobile terminated SMs and CBMs, and to define whether a message routed directly to TE should be acknowledged or not (refer command +CNMA).
Defined Values
<mode> (refer figure 2;
NOTE: The buffering mechanism may as well be located in the ME; the setting affects only to unsolicited result codes specified within this command):
0 Buffer unsolicited result codes in the TA. If TA result code buffer is full, indications can be buffered in some other place or the oldest indications may be discarded and replaced with the new received indications.
1 Discard indication and reject new received message unsolicited result codes when TA-TE link is reserved (e.g. in on-line data mode). Otherwise forward them directly to the TE.
2 Buffer unsolicited result codes in the TA when TA-TE link is reserved (e.g. in on-line data mode) and flush them to the TE after reservation. Otherwise forward them directly to the TE.
3 Forward unsolicited result codes directly to the TE. TA-TE link specific inband technique used to embed result codes and data when TA is in on-line data mode.
NOTE: It is possible that ME/TA result code buffer is in volatile memory. In this case messages may get lost if the power of ME/TA is switched off before codes are sent to TE. Thus, it is not recommended to use direct message routing (<mt>=2 or 3, <bm>=2 or 3, or <ds>=1) with <mode> value 0 or 2.
<mt> (the rules for storing received SMs depend on its data coding scheme (refer 3G TS 23.038 [2]), preferred memory storage (+CPMS) setting and this value; refer table 1;
NOTE: If AT command interface is acting as the only display device, the ME must support storing of class 0 messages and messages in the message waiting indication group (discard message); refer table 2):
0 No SMS-DELIVER indications are routed to the TE.
1 If SMS-DELIVER is stored into ME/TA, indication of the memory location is routed to the TE using unsolicited result code:
+CMTI: <mem>,<index>
2 SMS-DELIVERs (except class 2 messages and messages in the message waiting indication group (store message)) are routed directly to the TE using unsolicited result code:
+CMT: [<alpha>],<length><CR><LF><pdu> (PDU mode enabled)
or
+CMT: <oa>, [<alpha>],<scts>[,<tooa>,<fo>,<pid>,<dcs>,<sca>,<tosca>, <length>]<CR><LF><data> (text mode enabled; about parameters in italics, refer command Show Text Mode Parameters +CSDH)
If ME has its own display device then class 0 messages and messages in the message waiting indication group (discard message) may be copied to both ME display and to TE. In this case, ME shall send the acknowledgement to the network (refer table 2).
Class 2 messages and messages in the message waiting indication group (store message) result in indication as defined in <mt>=1.
3 Class 3 SMS-DELIVERs are routed directly to TE using unsolicited result codes defined in <mt>=2. Messages of other data coding schemes result in indication as defined in <mt>=1.
<mt> | Receiving procedure for different message data coding schemes (refer 3G TS 23.038 [2]) |
0 | no class: as in 3G TS 23.038 [2], but use <mem3> as preferred memory class 0: as in 3G TS 23.038 [2], but use <mem3> as preferred memory if message is tried to be stored class 1: as in 3G TS 23.038 [2], but use <mem3> as preferred memory class 2: as in 3G TS 23.038 [2] class 3: as in 3G TS 23.038 [2], but use <mem3> as preferred memory message waiting indication group (discard message): as in 3G TS 23.038 [2], but use <mem3> as preferred memory if message is tried to be stored message waiting indication group (store message): as in 3G TS 23.038 [2], but use <mem3> as preferred memory |
1 | as <mt>=0 but send indication if message stored successfully |
2 | no class: route message to TE class 0: as in 3G TS 23.038 [2], but also route message to TE and do not try to store it in memory class 1: route message to TE class 2: as <mt>=1 class 3: route message to TE message waiting indication group (discard message): as in 3G TS 23.038 [2], but also route message to TE and do not try to store it in memory message waiting indication group (store message): as <mt>=1 |
3 | class 3: route message to TE others: as <mt>=1 |
Table 2: SMS-DELIVER result code and acknowledgement summary
<mt> | no class or class 1 | class 0 or message waiting indication group (discard) | class 2 or message waiting indication group (store) | class 3 |
1 | +CMTI | [+CMTI1)] | +CMTI | +CMTI |
2 | +CMT & +CNMA3) | +CMT [& +CNMA2)] | +CMTI | +CMT & +CNMA3) |
3 | +CMTI | [+CMTI1)] | +CMTI | +CMT & +CNMA3) |
1) result code is sent when ME does not have other display device than AT interface 2) acknowledgement command must be sent when +CSMS <service> value equals 1 and ME does not have other display device than AT interface 3) acknowledgement command must be sent when +CSMS <service> value equals 1 |
<bm> (the rules for storing received CBMs depend on its data coding scheme (refer 3G TS 23.038 [2]), the setting of Select CBM Types (+CSCB) and this value; refer table 3):
0 No CBM indications are routed to the TE.
1 If CBM is stored into ME/TA, indication of the memory location is routed to the TE using unsolicited result code:
+CBMI: <mem>,<index>
2 New CBMs are routed directly to the TE using unsolicited result code:
+CBM: <length><CR><LF><pdu> (PDU mode enabled)
or
+CBM: <sn>,<mid>,<dcs>,<page>,<pages><CR><LF><data> (text mode enabled)
If ME supports data coding groups which define special routing also for messages other than class 3 (e.g. (U)SIM specific messages), ME may choose not to route messages of such data coding schemes into TE (indication of a stored CBM may be given as defined in <bm>=1).
3 Class 3 CBMs are routed directly to TE using unsolicited result codes defined in <bm>=2. If CBM storage is supported, messages of other classes result in indication as defined in <bm>=1.
<bm> | Receiving procedure for different message data coding schemes (refer 3G TS 23.038 [2]) |
0 | all schemes: as in 3G TS 23.038 [2]; if CBM storage is supported, store message to "BM" (or some manufacturer or data coding scheme specific memory) |
1 | all schemes: as <bm>=0 but send indication if message stored successfully |
2 | all schemes: route message to TE unless ME has detected a special routing to somewhere else (e.g. to (U)SIM; an indication may be sent if message stored successfully) |
3 | class 3: route message to TE others: as <bm>=1 (if CBM memory storage is supported) |
<ds>:
0 No SMS-STATUS-REPORTs are routed to the TE.
1 SMS-STATUS-REPORTs are routed to the TE using unsolicited result code:
+CDS: <length><CR><LF><pdu> (PDU mode enabled)
or
+CDS: <fo>,<mr>,[<ra>],[<tora>],<scts>,<dt>,<st> (text mode enabled)
2 If SMS-STATUS-REPORT is stored into ME/TA, indication of the memory location is routed to the TE using unsolicited result code:
+CDSI: <mem>,<index>
Table 4: SMS-STATUS-REPORT result code and acknowledgement summary
<ds> | result codes and commands |
1 | +CDS & +CNMA1) |
2 | +CDSI |
1) acknowledgement command must be sent when +CSMS <service> value equals 1 |
<bfr>:
0 TA buffer of unsolicited result codes defined within this command is flushed to the TE when <mode> 1...3 is entered (OK response shall be given before flushing the codes).
1 TA buffer of unsolicited result codes defined within this command is cleared when <mode> 1...3 is entered.
Implementation
Mandatory when any of the new message indications implemented