skorokithakis / A6lib

An ESP8266/Arduino library for communicating with the A6 GSM module. ⛺
MIT License
127 stars 49 forks source link

unreadSMSNum is 0 every time obtain after setting A6command("AT+CMGF=1", "OK", "yy", A6_CMD_TIMEOUT, 2, NULL); #8

Closed amit524 closed 7 years ago

amit524 commented 7 years ago

salute to you for your support !!! +CMS ERROR: 304 Invalid PDU mode parameter and time out error solved. using SMS to text mode A6command("AT+CMGF=1", "OK", "yy", A6_CMD_TIMEOUT, 2, NULL);

but every time obtain unreadSMSNum is 0 even if sended new message .SMS to text mode set according to your suggestion . but not enter in this loop for (int i = 0; i < unreadSMSNum; i++)

void loop { callInfo cinfo = checkCallStatus(); if (cinfo.direction == DIR_INCOMING) { Serial.println(cinfo.number); hangUp(); A6command("AT+CMGF=1", "OK", "yy", A6_CMD_TIMEOUT, 2, NULL); 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);
    }
}

}

and got the response like this

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

skorokithakis commented 7 years ago

Please don't open new tickets every time. You probably just don't have any unread SMS.