I use a button and a Cellular for a simple test.
When GSM and GPRS network connected, I press button to send a sms and send a request to www.google.com.
My questions are:
I can’t get IP address each time. I need rebuild the application many times then get the IP address. How to set the module to reconnect the GPRS to get the IP, instead of rebooting the system?
The thread ‘’ (0x3) has exited with code 0 (0x0).
A first chance exception of type ‘System.Exception’ occurred in mscorlib.dll
When I see the Ip in the output window, I press the button.
After the button is pressed, the system hangs.
However the sms successfully send to my phone.
What driver do you mean?
I download the source code form https://tcpcellularradio.codeplex.com/
Then add the CellularRadio and CellularRadioManager to my project.
Any problem?
I got the modules and working on the software. I am doing this at the same time as I am completing my alarm system as it will be part of that. The existing design which has SMS is working fine, even at 115200 bps on a Cobra 2.
I’ll update you once I have something working reliably.
I can’t always get the IP using the GPRS module. (maybe 3 times deploying, then get the IP once)
Is this a normal condition?
In my code, when I get the IP, I use a button to send a request to google.
But only in the first time I can get the response. Then, the system hang
Do I need to reset something ?
{
// This method is run when the mainboard is powered up or reset.
private CellularRadioManager _radioManager;
void ProgramStarted()
{
Debug.Print("Program Started");
button.ButtonPressed+=button_ButtonPressed;
_radioManager = new CellularRadioManager(4)
{
AccessPointName = "internet",
DebugPrintEnabled = true,
IsHttpModeEnabled = true
};
}
private readonly string _crlf = "" + (char)13 + (char)10;
void button_ButtonPressed(Button sender, Button.ButtonState state)
{
Debug.Print("sending data");
_radioManager.Connect("www.google.com");
var request =
"GET / HTTP/1.1" + _crlf +
"Host: www.google.com" + _crlf +
_crlf;
_radioManager.SendData(request);
var response = "";
_radioManager.ReceiveData(5000, out response);
Debug.Print(response);
Debug.Print("finished");
}
}
Output:
Program Started
The thread ‘’ (0x3) has exited with code 0 (0x0).
#### Exception System.Exception - 0x00000000 (4) ####
#### Message:
#### System.Convert::ToInt64 [IP: 00af] ####
#### System.Convert::ToInt32 [IP: 0011] ####
#### System.Int32::Parse [IP: 000b] ####
#### Gadgeteer.Modules.Mekalogic.CellularRadio::ProcessATCommandResponse [IP: 01bd] ####
#### Gadgeteer.Modules.Mekalogic.CellularRadio::SerialRead [IP: 0030] ####
A first chance exception of type ‘System.Exception’ occurred in mscorlib.dll
GSM Network Registration Error
GSM Network Registration Error
GSM Network Registration Error
The thread ‘’ (0x6) has exited with code 0 (0x0).
#### Exception System.Exception - 0x00000000 (4) ####
#### Message:
#### System.Convert::ToInt64 [IP: 00af] ####
#### System.Convert::ToInt32 [IP: 0011] ####
#### System.Int32::Parse [IP: 000b] ####
#### Gadgeteer.Modules.Mekalogic.CellularRadio::ProcessATCommandResponse [IP: 01bd] ####
#### Gadgeteer.Modules.Mekalogic.CellularRadio::SerialRead [IP: 0030] ####
A first chance exception of type ‘System.Exception’ occurred in mscorlib.dll
GSM Network Registration Error
GSM Network Registered
GPRS Network Registration Error
GPRS Network Registered
IMEI: 861785000232458
IP: 116.59.179.55
sending data
HTTP/1.1 302 Found
Location: Google
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Set-Cookie: PREF=ID=3dad002b607fe34e:FF=0:TM=1381823626:LM=1381823626:S=YN-IsQvgi-HPHvw0; expires=Thu, 15-Oct-2015 07:53:46 GMT; path=/; domain=.google.com
Set-Cookie: NID=67=JcLx96ulQO4jKWTj0d_akkNktqyD41IS4ORBNnHyX_Jzl6gmI3zy7PX23erAW7iEW8WxzGzDHI9q9W-63LtXkKqzxPZUUZNnOuRyH-cRswIxQ0pNuv3zmpKdEua0Yv9k; expires=Wed, 16-Apr-2014 07:53:46 GMT; path=/; domain=.google.com; HttpOnly
P3P: CP=“This is not a P3P policy! See P3P and Google's cookies - Google Account Help for more info.”
Date: Tue, 15 Oct 2013 07:53:46 GMT
Server: gws
Content-Length: 262
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Alternate-Protocol: 80:quic