SARENT-SORENTO / gsm-shield-arduino

Automatically exported from code.google.com/p/gsm-shield-arduino
0 stars 0 forks source link

Problems with GETSMS_AUTH_SMS == sms.GetAuthorizedSMS(....) #46

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Dear all,
In my program, I use three kinds of users. According to their SIM position they 
all have different rights. 
For example the code I use for setting user 1 and user 2

if (GETSMS_AUTH_SMS == sms.GetAuthorizedSMS(position, phone_num, 
sms_text,160,1,2)) {
     user = 1;   
     }
else if  if (GETSMS_AUTH_SMS == sms.GetAuthorizedSMS(position, phone_num, 
sms_text,160,3,10)) {
     user = 2;   
     }

This should be very straightforward code, though I experience a lot of 
troubles. 
It often happens that my phone number (stored on SIM position 1) doesn’t get 
recognized by module. 

I was wondering how I could fix this? 
Are there other users that experience the same? 
Are there ways to get around this code?

Ciao

Frederic

Original issue reported on code.google.com by frederic...@gmail.com on 5 Oct 2012 at 1:06

GoogleCodeExporter commented 9 years ago
Hi,
does it appear only for position 1?

Original comment by martines...@gmail.com on 15 Oct 2012 at 7:51

GoogleCodeExporter commented 9 years ago
Yes, it looks so.
Do you have an idea? 

Thanks in advance

Original comment by frederic...@gmail.com on 15 Oct 2012 at 10:48

GoogleCodeExporter commented 9 years ago
I think the problem is larger than I described earlier. instead using the 
GetAuthorizedSMS method, now I just tried to store the phone_num in a String 
variable
(String afzender = phone_num;) after I just used the GETsms method.

When I tried to print out this variable, the variable was still empty. Does 
anyone have an idea in which type of variable I have to store phone_num so I 
can compare it with a predefined value? in the most memory efficient way

for example
String user1 = "+32478560482";

sms.GetSMS(position, phone_num, sms_text, 100);

String afzender = phone_num;

if (afzender ==user1)
{
Action 
}

Kind regards

Original comment by frederic...@gmail.com on 18 Oct 2012 at 2:58

GoogleCodeExporter commented 9 years ago
Hi,
to compare two string you have to use strcmp function (check the reference 
online)
you cant use "if (afzender ==user1)".
Marco

Original comment by martines...@gmail.com on 18 Oct 2012 at 4:47

GoogleCodeExporter commented 9 years ago
Damn, 

off course!

forgot that...

Thank you, I will try it again. 

Marco, do you have an idea on the GetAuthorizedSMS issue?
Thanks

Original comment by frederic...@gmail.com on 18 Oct 2012 at 6:00

GoogleCodeExporter commented 9 years ago
Ok, coming back on comment 4.
It still not explain why 'String afzender' is sometimes empty when I try to 
print it.

Original comment by frederic...@gmail.com on 18 Oct 2012 at 7:47

GoogleCodeExporter commented 9 years ago

Original comment by martines...@gmail.com on 11 Dec 2012 at 5:01

GoogleCodeExporter commented 9 years ago
This issue section is not longer supported.
Please check the support page www.gsmlib.org 

Original comment by martines...@gmail.com on 6 Jul 2013 at 11:27