SMS deletion on SIM

After processing a received SMS, I want to delete it from the SIM with the means of
adl_atCmdSend(“AT+CMGD=1\r\n” , NULL, NULL);

However, the message was not deleted.

Not being sure, if the command needet to be subscribed before use, I did so in advance with
adl_atCmdSubscribe(“AT+CMGD” ,NULL, ADL_CMD_TYPE_PARA |ADL_CMD_TYPE_ACT);

but without any effect.

What prefents the deletion of SMS #1 on the SIM?
at

How do you process it?

Note that AT Command are terminated by CR - not CRLF.

How do you know that its index will always be 1 ?

Why don’t you subscribe to the responses? The response would show you any error code that’s returned…

No it doesn’t - subscribing a command is for when you want to “catch” an incoming command

That could be messing things up…

You hint with the termination of the AT command was good.
The line “adl_atCmdSend(“AT+CMGD=1\r” , NULL, NULL);” works
(however, I am a bit surprised that terminating with “\r\n” refuses the correct procession)

The SMS index 1 was just an exemple.

For further analysis I defined a response-handler to obtain the error code.
However, I get only the ascii"OK" or “ERROR” (content of “StrData[]” of structure adl_atResponse_t).
Is this, what you meant by ‘error code’?

thanks so far
at

Indeed!
It is unnecessary - but I didn’t think that it should actually break anything!

I would expect you to get a +CMS ERROR: - but maybe a “malformed” command just gives ERROR?

Here we go…
You have to activate via “AT+CMEE=1\r” the delivering of an error code.
By default, only an “ERROR” will be answered.
at

True for manual operation - but you shouldn’t have to do that in an Open-AT application

I think this code may help you.
On SmsHandler event , we receive the SmsText, and SMS sender Number.
Here in the code i am validating the sender number
If return is true it will be saving in the SIM or else will not.

server_number1=“xxxxxxxxxxx”

bool SMSHandler(ascii *SmsTel, ascii *SmsTimeLength,ascii *SmsText )
{
TRACE (( 1, “SMS RECEIVED” ));
if(wm_strcmp( server_number1,SmsTel ) == 0)
{
return TRUE;
}
else
{
return FALSE;
}

}