Closed ortegafernando closed 9 years ago
I'm a noob, but I can get index with this function. It HAVE TO BE improve with people like you (buffer sizes,how to get how many messages you have, and so on)
int IsSMSPresent(byte required_status)
{
char gprsBuffer[100];
char *p;
sim900_check_with_cmd("AT+CMGF=1\r\n","OK",DEFAULT_TIMEOUT,CMD);
suli_delay_ms(1000);
switch (required_status) {
case SMS_UNREAD:
sim900_send_cmd("AT+CMGL=\"REC UNREAD\"\r\n");
break;
case SMS_READ:
sim900_send_cmd("AT+CMGL=\"REC READ\"\r\n");
break;
case SMS_ALL:
sim900_send_cmd("AT+CMGL=\"ALL\"\r\n");
break;
}
sim900_clean_buffer(gprsBuffer,100);
sim900_read_buffer(gprsBuffer,100,DEFAULT_TIMEOUT);
if(NULL != ( s = strstr(gprsBuffer,"+CMGL:"))){
// there is some SMS with status => get its position
// response is:
// +CMGL: <index>,<stat>,<oa/da>,,[,<tooa/toda>,<length>]
// <CR><LF> <data> <CR><LF>OK<CR><LF>
p = strstr(gprsBuffer,":");
if (p != NULL) {
return atoi(p+1);
}
}
return 0;
}
hi,
I am very glad to hear from you, and thanks sincerely for your advice in email, it is really a question that we need to focus on.
We just test the GPRS_Shield_Suli library with our GPRS Shield module in China and it works fine. So it may have some bugs with a third party SIM900 Shield or in other country. As you said, you have some problem on receiving the SMS message, it is about the AT+ CNMI command. Actually, our GPRS Shield will set command "AT+CNMI = 2,1" when initializing. So, when a new message arrives, it will send the CMTI text to uart directly, (e.g. +CMTI: "SM",24\r\n).
I also have a problem with your int IsSMSPresent(byte required_status) function, AT+CMGL is used to list out the specified messages(unread / read/ all), how can you distinguish the message that you need from the message lists?
Looking forward for your reply and further discussion. thank you~
lawliet.zou@gmail.com
From: op2op2op2 Date: 2014-10-10 01:15 To: Seeed-Studio/GPRS_Shield_Suli Subject: Re: [GPRS_Shield_Suli] GSM recieving problem (#2) I'm a noob, but I can get index with this function. It HAVE TO BE improve with people like you (buffer sizes,how to get how many messages you have, and so on)
int IsSMSPresent(byte required_status)
{
char gprsBuffer[100];
char *p;
sim900_check_with_cmd("AT+CMGF=1\r\n","OK",DEFAULT_TIMEOUT,CMD);
suli_delay_ms(1000);
switch (required_status) {
case SMS_UNREAD:
sim900_send_cmd("AT+CMGL=\"REC UNREAD\"\r\n");
break;
case SMS_READ:
sim900_send_cmd("AT+CMGL=\"REC READ\"\r\n");
break;
case SMS_ALL:
sim900_send_cmd("AT+CMGL=\"ALL\"\r\n");
break;
}
sim900_clean_buffer(gprsBuffer,100);
sim900_read_buffer(gprsBuffer,100,DEFAULT_TIMEOUT);
if(NULL != ( s = strstr(gprsBuffer,"+CMGL:"))){
// there is some SMS with status => get its position
// response is:
// +CMGL:
}
return 0;
} — Reply to this email directly or view it on GitHub.
Hi,
My shield is also a sIM900 chip one. I dont know if it can have a diferent firmware.
As I said I am a noob with arduino, but when you call for "UNREAD SMS" AT+CMGL will return a list of all SMS that meets that condition, so if there is only one, you will recieve that SMS, if there are several, you will recive the text for the first SMS, then the second, and so on.
I think that if you call again CMGL all SMS will be marked as READ (I can't ensure this), and also, I think that if you call your funtion "readSMS" with the index that I've obtained with my function, the SMS will be marked as READ (I can't ensure this)
CMGL writes into uart +CMGL:
Problems or bugs that my sketch has:
I think that an arduino program working with a SIM900 will have to do this secuence:
Why delete it ?
Because otherwise, SIM CARD will be full and you will not recieve any more SMS.
In order to do the secuence, I think that a function like isSMSpresent is necessary, but has to be improve to return an array of indexes.
What do you think about it ?
hi,
sorry for my late reply :)
Yes, it is really a good idea to get the SMS message as your secuence. Maybe a little complicated, but I think that it is strong enough to work normally.
and, er... would you like to finish your Read SMS function for this library and then pull request to the github? If your answer is yes, then I could offer you some coupon in our bazzar .^_^.
Thanks for your attention & contribution again. Seeed is very appreciative of your efforts and sharing. We need and love makers like you, open hardware movement needs makers like you.
Ok, I will try and I will use your coupon .^_^. I never pull changes to github, could you help me how to do it ? best regards,
Date: Sun, 12 Oct 2014 19:47:41 -0700 From: notifications@github.com To: GPRS_Shield_Suli@noreply.github.com CC: op2op2op2@hotmail.com Subject: Re: [GPRS_Shield_Suli] GSM recieving problem (#2)
hi,
sorry for my late reply :)
Yes, it is really a good idea to get the SMS message as your secuence. Maybe a little complicated, but I think that it is strong enough to work normally.
and, er... would you like to finish your Read SMS function for this library and then pull request to the github? If your answer is yes, then I could offer you some coupon in our bazzar .^_^.
Thanks for your attention & contribution again. Seeed is very appreciative of your efforts and sharing. We need and love makers like you, open hardware movement needs makers like you.
— Reply to this email directly or view it on GitHub. =
hi, you can just follow the instruction of the two URL below https://help.github.com/articles/using-pull-requests/ https://help.github.com/articles/creating-a-pull-request/
If you are not familiar with the operation, you can also create your test repository firstly, and then pull request to it as a try. Good luck!
lawliet.zou@gmail.com
From: op2op2op2 Date: 2014-10-15 03:17 To: Seeed-Studio/GPRS_Shield_Suli CC: lawliet zou Subject: Re: [GPRS_ShieldSuli] GSM recieving problem (#2) Ok, I will try and I will use your coupon .^^. I never pull changes to github, could you help me how to do it ? best regards,
Date: Sun, 12 Oct 2014 19:47:41 -0700 From: notifications@github.com To: GPRS_Shield_Suli@noreply.github.com CC: op2op2op2@hotmail.com Subject: Re: [GPRS_Shield_Suli] GSM recieving problem (#2)
hi,
sorry for my late reply :)
Yes, it is really a good idea to get the SMS message as your secuence. Maybe a little complicated, but I think that it is strong enough to work normally.
and, er... would you like to finish your Read SMS function for this library and then pull request to the github? If your answer is yes, then I could offer you some coupon in our bazzar .^_^.
Thanks for your attention & contribution again. Seeed is very appreciative of your efforts and sharing. We need and love makers like you, open hardware movement needs makers like you.
— Reply to this email directly or view it on GitHub. = — Reply to this email directly or view it on GitHub.
HI, I have try more time than I expected. Also add a funtion to get phone number and datetime strings for a SMS. Please, check it, and with my a great coupon !!!! (it has been a lot of work). Best regards
Date: Tue, 14 Oct 2014 19:00:27 -0700 From: notifications@github.com To: GPRS_Shield_Suli@noreply.github.com CC: op2op2op2@hotmail.com Subject: Re: [GPRS_Shield_Suli] GSM recieving problem (#2)
hi,
you can just follow the instruction of the two URL below
https://help.github.com/articles/using-pull-requests/
https://help.github.com/articles/creating-a-pull-request/
If you are not familiar with the operation, you can also create your test repository firstly, and then pull request to it as a try. Good luck!
lawliet.zou@gmail.com
From: op2op2op2
Date: 2014-10-15 03:17
To: Seeed-Studio/GPRS_Shield_Suli
CC: lawliet zou
Subject: Re: [GPRS_Shield_Suli] GSM recieving problem (#2)
Ok, I will try and I will use your coupon .^_^.
I never pull changes to github, could you help me how to do it ?
best regards,
Date: Sun, 12 Oct 2014 19:47:41 -0700
From: notifications@github.com
To: GPRS_Shield_Suli@noreply.github.com
CC: op2op2op2@hotmail.com
Subject: Re: [GPRS_Shield_Suli] GSM recieving problem (#2)
hi,
sorry for my late reply :)
Yes, it is really a good idea to get the SMS message as your secuence. Maybe a little complicated, but I think that it is strong enough to work normally.
and, er... would you like to finish your Read SMS function for this library and then pull request to the github? If your answer is yes, then I could offer you some coupon in our bazzar .^_^.
Thanks for your attention & contribution again. Seeed is very appreciative of your efforts and sharing. We need and love makers like you, open hardware movement needs makers like you.
—
Reply to this email directly or view it on GitHub. =
—
Reply to this email directly or view it on GitHub.
— Reply to this email directly or view it on GitHub. =
hi,
Thanks for your contribution sincerely, would you like to tell me your email? We will inform you the coupon via email and it should be the early next month.
lawliet.zou@gmail.com
From: op2op2op2 Date: 2014-10-19 04:57 To: Seeed-Studio/GPRS_Shield_Suli CC: lawliet zou Subject: Re: [GPRS_Shield_Suli] GSM recieving problem (#2) HI, I have try more time than I expected. Also add a funtion to get phone number and datetime strings for a SMS. Please, check it, and with my a great coupon !!!! (it has been a lot of work). Best regards
Date: Tue, 14 Oct 2014 19:00:27 -0700 From: notifications@github.com To: GPRS_Shield_Suli@noreply.github.com CC: op2op2op2@hotmail.com Subject: Re: [GPRS_Shield_Suli] GSM recieving problem (#2)
hi,
you can just follow the instruction of the two URL below
https://help.github.com/articles/using-pull-requests/
https://help.github.com/articles/creating-a-pull-request/
If you are not familiar with the operation, you can also create your test repository firstly, and then pull request to it as a try. Good luck!
lawliet.zou@gmail.com
From: op2op2op2
Date: 2014-10-15 03:17
To: Seeed-Studio/GPRS_Shield_Suli
CC: lawliet zou
Subject: Re: [GPRS_Shield_Suli] GSM recieving problem (#2)
Ok, I will try and I will use your coupon .^_^.
I never pull changes to github, could you help me how to do it ?
best regards,
Date: Sun, 12 Oct 2014 19:47:41 -0700
From: notifications@github.com
To: GPRS_Shield_Suli@noreply.github.com
CC: op2op2op2@hotmail.com
Subject: Re: [GPRS_Shield_Suli] GSM recieving problem (#2)
hi,
sorry for my late reply :)
Yes, it is really a good idea to get the SMS message as your secuence. Maybe a little complicated, but I think that it is strong enough to work normally.
and, er... would you like to finish your Read SMS function for this library and then pull request to the github? If your answer is yes, then I could offer you some coupon in our bazzar .^_^.
Thanks for your attention & contribution again. Seeed is very appreciative of your efforts and sharing. We need and love makers like you, open hardware movement needs makers like you.
—
Reply to this email directly or view it on GitHub. =
—
Reply to this email directly or view it on GitHub.
— Reply to this email directly or view it on GitHub. = — Reply to this email directly or view it on GitHub.
Hi, I am working in your library, but where is my coupon ?
I have more things to publish in your library.
And i have also TWO IMPORTANT QUESTIONS about your library.
One: Why have you use in all your function "0" to say "true" and "-1" to say "false" ? It is just the opossite to "true or false" constants in arduino enviroment. Is it something that I dont know that made -1 and 0 usefull ?
Second: Why do you use "int" as data returned for all functions ? Could it be byte to save SRAM ? Is it something that I don't know that made the use of ints in all function better ?
I hope your answer and my coupon.
Best regards
Answered you with email.
I don't know why my emails are been rejected. Any way, i will write here:
"Thanks, what about these two questions ?
Best regards,"
Could you close this issue ?
Hi,
thanks for this great library.
I have found an issue in GPRS_LoopHandle example.
I'm not using your official shield, but a third party SIM900 shield.
It's about finding CMTI text in uart.
If you don't config your SIM900 with the AT command +CNMI (is used to specify how newly arrived SMS messages should be handled. You can tell the GSM/GPRS modem or mobile phone either to forward newly arrived SMS messages directly to the PC, or to save them in message storage and then notify the PC about their locations in message storage), you could not recieve CMTI text in uart.
We have two possible solution (I prefer b) solution)
a. Always config with this AT command: CNMI b.Change the library with a function like: isSMSpresent that will return the index of the first unread SMS
Here is the code from SIM900.h library:
char SMSGSM::IsSMSPresent(byte required_status) { char ret_val = -1; char *p_char; byte status;
}
Could you update your library with a similar function ?
May be your function could return both index and total number of UNREAD sms
Hope your answer.
Best regards,