How can list and receive SMS

Dear All,
I am trying hard the receive SMS to my TEL0051.
I red the document AT command and I undertood, I have to the following command
First I set the text mod
I also saw this command AT+CNMI
Someone could tellme in which order I have to enter my command to have a result with
A second question.
Can I put those command
AT+CMGL to list
AT+CMGR to read.
Mayn thank for your helps
Cheers
I am trying hard the receive SMS to my TEL0051.
I red the document AT command and I undertood, I have to the following command
First I set the text mod
Code: Select all
Second I select the memory storage
sendATcommand("AT+CMGF=1","OK",2000,true,false,false,false)
Code: Select all
The I list all UREAD meddage
sendATcommand("AT+CPMS=\"SM\",\"SM\",\"SM\"","+CPMS:",2000,true,false,false,false)
Code: Select all
When my project is running, I sent a SMS to it and it never display any message. It display the first 20 message
sendATcommand("AT+CMGL=\"REC UNREAD\"","OK",5000,true,false,true,false);
Code: Select all
That function work, but it never display new messages that I just sent.for(int m=1; m<=20;m++)
{
sms_read(m,sms_from_number,sms_date,sms_time,sms_text);
}
void sms_read(int sms_pos,char *sms_from_number, char *sms_date, char *sms_time, char *sms_text)
{
// Definie une variable
char cmd[12];
// Defini la command
sprintf(cmd,"AT+CMGR=%d,1",sms_pos);
sendATcommand(cmd,"OK",2000,true,false,false,true);
// J'affiche le message recu
//Serial.print(F("Message :")); Serial.println(buffer_by_line[3]);
strcpy(sms_text,buffer_by_line[3]);
splitString(supprimeCaractere(buffer_by_line[2],'"'),splitedString);
strcpy(sms_from_number,splitedString[1]);
strcpy(sms_date,splitedString[3]);
strcpy(sms_time,splitedString[4]);
#ifdef DEBUG_SMS
Serial.print(F("Stat :")); Serial.print(buffer_by_line[0]); Serial.print(F(" - "));Serial.println(splitedString[0]);
Serial.print(F("From :")); Serial.println(sms_from_number);
Serial.print(F("Date :")); Serial.println(sms_date);
Serial.print(F("Time :")); Serial.println(sms_time);
Serial.print(F("Message :")); Serial.println(sms_text);
Serial.println("");
#endif
}
I also saw this command AT+CNMI
Code: Select all
But I do not really understand how it work and at which time it should be usedsendATcommand("AT+CNMI=2,1,0,0,0","OK",1000,true,false,false,false);
Someone could tellme in which order I have to enter my command to have a result with
AT+CMGL=\"REC UNREAD\"
A second question.
Can I put those command
Code: Select all
in my setup() loop or should it call each time a request an SMS command assendATcommand("AT+CMGF=1","OK",2000,true,false,false,false)
sendATcommand("AT+CPMS=\"SM\",\"SM\",\"SM\"","+CPMS:",2000,true,false,false,false)
AT+CMGL to list
AT+CMGR to read.
Mayn thank for your helps
Cheers