C027_Support library test
Dependencies: C027_Support
Dependents: C027_SupportTest_xively_location software_test_v1
Fork of Seeed_GPRS_Library_HelloWorld by
When running this example make sure you have:
- edited the SIM PIN, APN, USER and PASSWORD for you network operator
- have inserted a SIM card with enough credits
- the antennas connected
- have good reception (especially for GPS)
- installed the mbed CDC drivers if you run windows
- connected a terminal program, such as teraterm
The example will connect the modem to the network and attach it. I will place a post request to download a file from mbed website. It will do a USSD request and finally wait for incoming SMS. It will try to answer your SMS (try asking "where are you").
You should see a similar output in your preferred console program:
C027 Support Example Device Init Device Status: Device: SARA-G350 Power Save: Active SIM: Ready CCID: xxxxxxxxxxxxxxxxxxxxxxxxxxx IMEI: xxxxxxxxxxxxxxxxxxx IMSI: xxxxxxxxxxxxxxxxxxx Manufacturer: u-blox Model: SARA-G350 Version: 08.49 Network Check Network Status: Registration: Home Signal Strength: -87 dBm Operator: Swisscom Phone Number: +41xxxxxxxxxxx Network Join IP Address: xx.xx.xx.xx Socket Create Socket Connect Make a Http Post Request Socket Send Socket Recving Socket 0: 337 bytes pending Socket 0: 145 bytes pending Socket 0: closed by remote host Socket Recv "HTTP/1.1 200 OK Server: nginx/1.1.19 Date: Thu, 10 Apr 2014 13:09:02 GMT Content-Type: text/plain Connection: close Last-Modified: Fri, 27 Jul 2012 13:30:34 GMT Cache-Control: max-age=36000 Expires: Thu, 10 Apr 2014 20:43:53 GMT Vary: Accept-Encoding X-Mystery-Header: 260358892 X-be: web0_prod_sjc Age: 8709 Hello world! " Socket Close Socket Free Network Disconnect Send Ussd Command *#134# Got Ussd Answer: "UNKNOWN APPLICATION" Checking SMS and GPS GPS Location: 47.28xxx 8.56xxx GPS Location: 47.28xxx 8.56xxx ... GPS Location: 47.28xxx 8.56xxx GPS Location: 47.28xxx 8.56xxx Network Status: Registration: Home Signal Strength: -89 dBm Operator: Swisscom Phone Number: +41xxxxxxxxx GPS Location: 47.28xxx 8.56xxx GPS Location: 47.28xxx 8.56xxx ...
Diff: main.cpp
- Revision:
- 9:26f694bc31b4
- Parent:
- 7:e000317ddef6
- Child:
- 10:d2da2028a233
--- a/main.cpp Thu Apr 10 13:45:20 2014 +0000 +++ b/main.cpp Thu Apr 17 15:10:09 2014 +0000 @@ -3,6 +3,28 @@ #include "GPS.h" #include "MDM.h" +//---------------------------------------------------------------------- +// You may need to configure these parameters + +/** Set your secret SIM pin here "1234" +*/ +#define SIMPIN NULL + +/** The APN of your network operator, sometimes it is "internet" + check your contract with the network operator +*/ +#define APN "gprs.swisscom.ch" + +/** Set the user name for your APN, or NULL if not needed +*/ +#define USERNAME NULL + +/** Set the password for your APN, or NULL if not needed +*/ +#define PASSWORD NULL + +//---------------------------------------------------------------------- + C027 c027; void printDeviceStatus(MDMParser::DevStatus* status) { @@ -75,7 +97,7 @@ printf("Device Init\r\n"); MDMParser::DevStatus devStatus; MDMParser::NetStatus netStatus; - if (mdm.init(/* SIM PIN = */ NULL, &devStatus)) + if (mdm.init(SIMPIN, &devStatus)) { printDeviceStatus(&devStatus); @@ -88,9 +110,7 @@ printf("Network Join\r\n"); // join the internet connection MDMParser::IP ip = - mdm.join(/* APN = */ "gprs.swisscom.ch", - /* USER = */ NULL, - /* PASSWORD = */ NULL); + mdm.join(APN,USERNAME,PASSWORD); if (ip != NOIP) { printf(" IP Address: " IPSTR "\r\n", IPNUM(ip)); @@ -187,7 +207,7 @@ } } wait_ms(wait); - } + } mdm.powerOff(); gps.powerOff(); }