After a lot of experimenting with the SMS subject, I noticed all by chance, that when my provider sent an SMS for advertisment purposes, the program could not handle it properly because in Hserin line to get the SMS, a 10 digit number was expected and not the 4 digit one.
Keep in mind that the "defaults" may not always be default enough!
Here is my test subroutine:
At the 3rd command line where HSerin 5000,ex_sms4,[wait... is executed, the command waits for +30 which is the country code for Greece, then I get 10 digits for the phone that is sending the SMS.Code:read_sms: Lcdout com,line1,"Reading SMS" HSerout ["AT+CMGL=",34,"ALL",34,13] '"ALL" is for Wavecom module. Read all SMS ' Read Caller ID etc. The timeout value in the HSERIN statement is important. ' it takes some time before the phone replies to the AT+CMGL command HSerin 5000,ex_sms4,[wait("READ"),wait("+30"),str cc_phone\10,wait(44,44,34),SKIP 23,STR array\15\13] 'Number is waitstr command\10 LCDOut com,1,"Read 1 SMS" pause 1000 sms_delete: LCDOut com,1,"Deleting SMS" HSerout ["AT+CMGD=1,4",13] 'Delete all messages HSerin 19000,ex_sms2,[wait("OK")] 'Wait for OK (null) LCDOut com,line1,"Deleted SMS " Pause 1000 return ex_sms2: 'No new message or timeout error LCDOut com,line2,"Error",rep " "\11:Pause 1000 return ex_sms4: 'Wrong Number! LCDOut com,line2,"Error phone Nbr":Pause 1000 goto sms_delete
But if the sender has only 4 digits I now through the timeout, jump to ex_sms4 and after an LCD message, the new and irrelevant SMS is deleted.
Hope this helps all that deal with SMS stuff.
Ioannis




Bookmarks