We help IT Professionals succeed at work.

An AT command to inform me when a new SMS arrive,

NassClickMan
NassClickMan asked
on
8,404 Views
Last Modified: 2016-10-04
i want a An AT command to inform me when a new SMS arrive,
Comment
Watch Question

Commented:
AT+CNMI=3,3,2 should do it for you.

Don't forget to set the SMS mode (PDU or text) using AT+CMGF=0 or AT+CMGF=1 respectively.

Anyway it's the CNMI command that should do it, there are AT command manuals available at www.tdc.co.uk/technical if you need them. (For Siemens modems, but should work for most others as well).

Simon

Commented:
It is difficult to give an answer without to know, what kind of operting system you use and what is the target.
- A message only that there is a new SMS?
Then AT+CNMI is way to get a message. I could not give a recommendation on the parameters of AT+CNMI without to know in which message class your SMS comes in. There are four message classes and one of them will always stick on your SIM card. Last not least your have to check your SIM card with AT+CMGR, because if you have 20 places for SMS on your SIM card with wrong message class and follow the recommendation of Simon, then after the 20th SMS in wrong message class you will not receive a SMS anymore. They all will stick on the SMSC.
May a look  http://www.gsm-modem.de/gsm-data.html helps you to find the important commands. Documentation (PDF files) on the GSM modem and modules you can dowload at www.roundsolutions.com . They ship worldwide with there offices in UK, Germany and Sweden.
As a customer of mine you will enjoy the huge community based on a closed user forum in the Internet with FAQ and a lot of postings. You will get factory support and you will see that users help users as well. You will stay in a community with more then 380 members around the world. A big "technical family" that grows each month.
Regards
Meff

Author

Commented:
No i havent a gps modem.I have a siemens mobile which supports at commands and i can decode the pdu data.I just want a way to be informed whe a new message arrives because i dont want to use at+cmgl= to get then because i waste batery.

Commented:
Then the AT+CNMI=3,3,2 command ought to work for you.

Simon

Author

Commented:
AT+CNMI=3,3,2

ERROR
i get an error

Commented:
Check what your modem supports by giving it AT+CNMI? and see what it is set to at the moment by AT+CNMI=?

Simon

Author

Commented:
Write command
AT+CNMI=[<mode>[,<mt>[,<bm>[,<ds>[,<bfr>]]]]]
Parameter
<mode> See Test command
<mt> See Test command
<bm> See Test command
<ds> See Test command
<bfr> See Test command
Response
OK/ERROR/+CMS ERROR


maybe this will help you

Author

Commented:
AT+CNMI=?

+CNMI: (0,1),(0,1),(0,2),(0,2),(1)

OK
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Commented:
 
AT+CNMI =
[<mode>]
[,<mt>][,<bm>]
[,<ds>][,<bfr>]  
The write command selects the procedure how the receipt of new SMS 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), the reception of messages shall be per-
formed as specified in GSM 03.38.  
Note1:    If the DTR signal is not available or the state of the signal is ignored
(V.25ter command &D0), reliable message transfer can be ensured by us-
ing +CNMA acknowledgment procedure.
Note2:   The rules <mt>=2 and <mt>=3 for storing received SM are possible only if
phase 2+ compatibility is activated with +CSMS=1
Note3:   The parameter <ds>=1 is only available in phase 2+  
 
OK
If error is related to ME functionality:
+CMS ERROR: <err>
Parameter
<mode>  [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 re-
served (e.g. in on-line data mode) and flush them to the TE af-
ter reservation. Otherwise forward them directly to the TE.
  3  Forward unsolicited result codes directly to the TE. TA-TE link
specific inband technique is used to embed result codes and
data when TA is in online data mode.
<mt>  Rules for storing received SMS depend on the relevant data coding
method (refer to GSM 03.38 [2]), preferred memory storage (+CPMS)
setting and this value
Note: If AT command interface is acting as the only display device, the
ME must support storage of class 0 messages and messages in the
message waiting indication group (discard message)
  [0]  No SMS-DELIVER indications are routed to the TE.
  1  If SMS-DELIVER is stored in 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: ,<length><CR><LF><pdu> (PDU mode enabled)  
+CMT: <oa>,, <scts> [,<tooa>, <fo>, <pid>, <dcs>, <sca>,
<tosca>, <length>] <CR> <LF> <data> (text mode enabled)
 
  3  Class 3 SMS-DELIVERs are routed directly to the TE using
unsolicited result codes defined in <mt>=2. Messages of other
data coding schemes result in indication as defined in <mt>=1.
 
<bm>  Rules for storing received CBMs depend on the relevant data coding
method (refer to GSM 03.38 [2]), the setting of Select CBM Types
(+CSCB) and this value:
  [0]   No CBM indications are routed to the TE.
  2   New CBMs are routed directly to the TE using unsolicited re-
sult code: +CBM: <length><CR><LF><pdu> (PDU mode en-
abled) or +CBM: <sn>,<mid>,<dcs>,<page>,<pages><CR>
<LF><data> (text mode enabled).
  3   Class 3 CBMs are routed directly to TE using unsolicited result
codes defined in <bm>=2.
 
<ds>  [0]  No SMS-STATUS-REPORTs are routed to the TE.
  1  SMS-STATUS-REPORTs are routed to the TE using unsolic-
ited 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 routed into ME/TA, indication of
the memory location is routed to the TE using unsolicited result
code: +CDSI: <mem>,<index>
 
<bfr>  [1]   TA buffer of unsolicited result codes defined within this com-
mand is cleared when <mode> 1...3 is entered

(Extract from the manual)
Hi
One of the way is keep polling on port by using timer.
Use cmgl command to read the messges process the message if succesful delete the message so every time only new messages will be there after cmgl

Mandar  

Commented:
Hi
I have a question.
I send this command AT+CNMI =1,2,0,0 trougt serial port  and I receive only the first sms in pdu mode. how can I do to resolve this ?

Commented:
I am using sim808 modem for gprs communication at the same time i want modem to inform the mcu about the new message arrival AT+CNMI=3,2,0,0,0 I am using able to receive only first msg
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.