Closed amit524 closed 7 years ago
I don't understand this. Please elaborate on the problem with steps to reproduce.
when i exucte getUnreadSMSLocs(int* buf, int maxItems) this function i getting time out error or A6command("AT+CMGL=\"REC UNREAD\"", "\xff\r\nOK\r\n", "\r\nOK\r\n", A6_CMD_TIMEOUT, 2, &response); changed function "AT+CMGL=0" inplace of "AT+CMGL=\"REC UNREAD\"" A6command("AT+CMGL=0", "\xff\r\nOK\r\n", "\r\nOK\r\n", A6_CMD_TIMEOUT, 2, &response);
Did that work?
no
+CMS ERROR: 304 Invalid PDU mode parameter comes
and other all function work properly
So the problem is that you're getting a timeout when trying to read SMS with getUnreadSMSLocs
?
i am using hardware serial inplace of software serial and using mega 2560
yes if i increase #define A6_CMD_TIMEOUT 2000 then also time out error or +CMS ERROR: 304 comes
Hmm, that's odd. Can you try setting SMS to text mode again?
A6command("AT+CMGF=1", "OK", "yy", A6_CMD_TIMEOUT, 2, NULL);
this is my cade
callInfo cinfo = checkCallStatus(); if (cinfo.direction == DIR_INCOMING) { Serial.println(cinfo.number); hangUp(); unreadSMSNum =getUnreadSMSLocs(unreadSMSLocs, 30); Serial.println("unreadSMSNum"); Serial.println(unreadSMSNum); for (int i = 0; i < unreadSMSNum; i++) { Serial.print("New message at index: "); Serial.println(unreadSMSLocs[i], DEC);
sms =readSMS(unreadSMSLocs[i]);
Serial.println(sms.number);
Serial.println(sms.date);
Serial.println(sms.message);
}
}
A6command("AT+CMGF=1", "OK", "yy", A6_CMD_TIMEOUT, 2, NULL);
this is work and response like this
Reply OK.
Issuing command: AT+CMGF=1
Reply in 1056 ms:
OK
Does SMS work after that?
now its work responce like this
Timed out. Issuing command: ATH Reply in 1055 ms: OK
Reply OK. Issuing command: AT+CMGF=1 Reply in 1055 ms: OK
Reply OK. Issuing command: AT+CMGL="REC UNREAD" Reply in 1058 ms: OK
Reply OK. unreadSMSNum 0 Issuing command: AT+CLCC Reply in 1055 ms: OK
but every time i got the unreadSMSNum is 0
and not enter in this loop
for (int i = 0; i < unreadSMSNum; i++) { Serial.print("New message at index: "); Serial.println(unreadSMSLocs[i], DEC);
sms =readSMS(unreadSMSLocs[i]);
Serial.println(sms.number);
Serial.println(sms.date);
Serial.println(sms.message);
}
if i send the new message then also reponce like Reply OK. Issuing command: AT+CMGF=1 Reply in 1055 ms: OK
Reply OK. Issuing command: AT+CMGL="REC UNREAD" Reply in 1058 ms: OK
Reply OK. unreadSMSNum 0 Issuing command: AT+CLCC Reply in 1055 ms: OK
int getUnreadSMSLocs(int* buf, int maxItems) { String seqStart = "+CMGL: "; String response = "";
}