Go Down

Topic: Sim900 Read SMS edge case (Read 422 times) previous topic - next topic

RobvdVeer

Hi,

I have a question about reading an SMS message using AT commands. I would like to know how to handle SMS messages containing OK or ERROR, because that sgnifies the end of the command response, eg.

Code: [Select]
AT+CMGR=3

+CMGR: "REC READ","+85291234567",,"07/04/20,10:08:02+32",145,4,0,0,"+85290000000",145,49
It is easy to read text messages via AT commands.

OK


Now what if the message contains OK/Error?

Code: [Select]
AT+CMGR=3

+CMGR: "REC READ","+85291234567",,"07/04/20,10:08:02+32",145,4,0,0,"+85290000000",145,49
It is easy to trick the parser

OK. 

Message continues here

OK <- proper termination


Any ideas?
Rob
Follow my progress on http://simplicate.weebly.com

K5CZ

#1
Dec 24, 2013, 12:43 am Last Edit: Dec 24, 2013, 12:57 am by K5CZ Reason: 1
I try little trick and it works:
Code: [Select]
AT+CMGR=3;+CCLK?

+CMGR: "REC READ","+420773684528","","13/12/24,00:44:33+04"
It is easy to trick the parser!

OK

As you can see, the message continues here...

+CCLK: "13/12/23,00:46:37+04"

OK

You may parse until +CCLK is found
Arduino Uno R3, Arduino Mega 2560 R3, Ethermega (R3), and some Ethernet Shields (R3), Chronodots, TMP36 sensors, DS18B20 sensors, LCDs/TFTs, RS232C to learn and play...

RobvdVeer

That is a real nice solution.

That is, until somebody sends +CCLK !
Perhaps i should investigate if reading the SMS in PDU is feasible, at least i get proper encoding and a length descriptor...

http://www.smartposition.nl/resources/sms_pdu.html

Rob
Follow my progress on http://simplicate.weebly.com

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy