I need to read an compare the text from the incomming sms.
The incomming SMS looks like this:
Based on the text of this message i have to compare the string and make some action. Simply put, incomming sms is used as control command.
Anyone done this ?
Im not sure if i understand you right, but i was thinking to process this text as normal string. In the basic development guide i found AT Strings Service, but im not sure if this would be of help for me.
User can send sms with wrong text and i have to make some compare before i send reply. From my point of view i can compare this string thru normal c function and pass this data to sms that is used for reply. Could this be done on this way ?
That’s the ADL User Guide - not the Basic interface!
I doubt it - like it says, this is to process Standard repsonse strings - you are not looking at the standard response; you are looking at the content of the SMS.
Yes - and you can simplify that comparison by defining the format in a way that’s easy to compare.
Using fixed-width fields is one way to do it.
However, if the commands are to be entered manually by people, you may prefer to make the format such that they’re easier to enter - and put some extra effort into parsing them.
As ever, it’s a tradeoff - and you need to consider the requirements of your application (including your customers!) to determine the best course…
I done this, but i im not sure how to process this incomming text. This incoming text is used as command and after i make compare i send ( as reply ) some early defined message from array on messages.
So maybe the right question would be, how to take the text from the incomming smsText , so i can compare it to my defined words.
Thank your for the code. ! That did solve the problem.
I write some stringCompare function and the program was compiled with no errors, but it didn’t work as it should.The only thing that i did not use was the wm_strcmp function.I was using the stdio.h and normal string copy functions. On the other side, the wm_strcmp comes from strcmp ?.
I need to use the delimiter " , " becuse the sms can have multiple commands.So i guess i can not use something like ascii *s = strtok(SmsText, ", ");
If you have multple commands separated with comma and if the commands are in such format : comm=1, comm=2
how would you separate them, so you can read then both or together ?
Im not sure if this is the problem becuse i can not send more then 2 sms’s but, why do i get this warning?
@ colin-tfe
I think that strtok should solve the problem but i can’t make it work.
When i get +CMTI:comm1,comm2 from the sms and when i want to compare it to defined string,nothing happens.
Program is compiled without errors . Maybe dumb idea but… type casting ?
@SunilRao
wm_strGetParameterString ( dst, src, Position )
I’v read the basic docu. and there are examples that i can use.
so, wm_strGetParameterString ( dst, smsText, Position ) should give me the “comm1,comm2” result.
How do you then make the compare between defined string and incomming one (smsText)?.