Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of GPRS by
Diff: gprs.cpp
- Revision:
- 5:ac2342f162fa
- Parent:
- 4:63a2619b423b
- Child:
- 7:1278e9dde24e
diff -r 63a2619b423b -r ac2342f162fa gprs.cpp
--- a/gprs.cpp Tue Jan 21 06:44:58 2014 +0000
+++ b/gprs.cpp Wed Jan 22 02:04:57 2014 +0000
@@ -281,15 +281,26 @@
}
}
+int GPRS::networkInit(char* apn, char* userName, char* passWord)
+{
+ char cstt[64];
+ snprintf(cstt,sizeof(cstt),"AT+CSTT=\"%s\",\"%s\",\"%s\"\r\n",apn,userName,passWord);
+ if(0 != sendCmdAndWaitForResp(cstt, "OK", DEFAULT_TIMEOUT)) {
+ return -1;
+ }
+ return 0;
+}
int GPRS::connectTCP(char *ip, char *port)
{
- char cipstart[50];
+ char cipstart[64];
+#if 0
if(0 != sendCmdAndWaitForResp("AT+CSTT=\"CMNET\",\"\",\"\"\r\n", "OK", 5)) {
return -1;
}
+#endif
sprintf(cipstart, "AT+CIPSTART=\"TCP\",\"%s\",\"%s\"\r\n", ip, port);
- if(0 != sendCmdAndWaitForResp(cipstart, "OK", 5)) {
+ if(0 != sendCmdAndWaitForResp(cipstart, "OK", DEFAULT_TIMEOUT)) {
return -1;
}
return 0;
