Hi, with Quectel EC25-E module
It gives error CMS ERROR:305 with some of sms not all of them. We could not solve it. Please help. Thank you.
Hi, with Quectel EC25-E module
It gives error CMS ERROR:305 with some of sms not all of them. We could not solve it. Please help. Thank you.
Hi again Any help please?
I use this code to send SMS. It gives CMS ERROR 305 but we did not know what is wrong.
int sendSms(UsbPort &device, string phoneNumber, string message) {
char buf[MAXBUF] = {0};
int n;
if(device.fildes > 0) {
int max_check = 0;
if (write(device.fildes, "ATZ\r", 4) < 4) {
printf("ATZ write error - %s \n", strerror(errno));
return -1;
}
this_thread::sleep_for(chrono::seconds(1));
if (write(device.fildes, "AT+CMGF=1\r", 10) < 10) {
printf("AT+CMGF=1 write error - %s \n", strerror(errno));
return -1;
}
if (tcdrain(device.fildes) != 0) {
perror("tcdrain() error");
return -1;
}
this_thread::sleep_for(chrono::seconds(1));
bzero(buf, sizeof(buf));
read(device.fildes, buf, MAXBUF - 1);
cout << "Buffer-1 = " << buf << endl;
if (write(device.fildes, "ATE+CSMS=1\r", 11) < 11) {
printf("ATE+CSMS=1 write error - %s \n", strerror(errno));
return -1;
}
if (tcdrain(device.fildes) != 0) {
perror("tcdrain() error");
return -1;
}
this_thread::sleep_for(chrono::seconds(1));
bzero(buf, sizeof(buf));
if ((n = read(device.fildes, buf, MAXBUF - 1)) > -1) {
int length = strlen(buf);
cout << "length = " << length << endl;
buf[length] = '\0';
cout << "Buffer-2 = " << buf << endl;
if (strstr(buf, "+CSMS:") != NULL) { // Ready to send SMS
cout << "Can send SMS: " + string(buf) << endl;
// Send SMS
string data1 = "AT+CMGS=\"" + phoneNumber + "\"\r";
if (write(device.fildes, data1.c_str(), data1.length()) < data1.length()) {
printf("AT+CMGS write error - %s \n", strerror(errno));
return -1;
}
else {
this_thread::sleep_for(chrono::seconds(1));
string data2 = message + "\x1A";
if (write(device.fildes, data2.c_str(), data2.length()) < data2.length()) {
printf("ATE+CSMS=1 write error - %s \n", strerror(errno));
return -1;
}
if (tcdrain(device.fildes) != 0) {
perror("tcdrain() error");
return -1;
}
this_thread::sleep_for(chrono::seconds(1));
bzero(buf, sizeof(buf));
if ((n = read(device.fildes, buf, MAXBUF - 1)) > -1) {
int length = strlen(buf);
cout << "length = " << length << endl;
buf[length] = '\0';
cout << "Buffer-2 = " << buf << endl;
if (strstr(buf, "OK") != NULL) {
cout << message + " sent to : " + telNo + " successfully." << endl;
return 0;
}
}
else {
cout << message + " sent to : " + telNo + " unsuccessful!" << endl;
return -1;
}
}
}
else {
cout << "Error: buf = " + string(buf) << endl;
return -1;
}
}
}
return -1;
}
Does GSM module accept all ASCII char s. or should we change some of them? Is that the problem?
We detect to problem. Problem occurs when sms is too long. How to solve that problem? Can anyone help?
Hello SmartEq_Bilisim
Regarding the issue of sending short messages, the current test GSM format has a maximum sending short message of 140 bytes, and the IRA format maximum sending short message is 160 bytes. If you want to send a long text message, you can use AT+QCMGS command to send in segments, thank you.