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:
- 13:662bd1df9a72
- Parent:
- 12:96c7b62c7aaf
- Child:
- 14:ab7c8627f950
--- a/main.cpp Fri May 09 08:58:25 2014 +0000 +++ b/main.cpp Fri May 09 11:57:47 2014 +0000 @@ -34,23 +34,14 @@ - Freescale: FRDM-KL25Z, FRDM-KL46Z - STM: NUCLEO-F401RE, NUCLEO-F030R8 */ -#if defined(TARGET_UBLOX_C027) || defined(TARGET_LPC1768) - #define C027_USEONBOARD // remove this if you have a GSM/GPS shield - #ifdef C027_USEONBOARD - #include "C027.h" - C027 c027; - #elif defined(TARGET_LPC1768) - // We assume we have a C027 (not an Arch Pro) - #define D15 P0_1 - #define D14 P0_0 - #define D4 P2_12 - #define D1 P4_28 - #define D0 P4_29 - #define LED1 P3_25 - #endif +#if defined(TARGET_UBLOX_C027) + #define C027_USEONBOARD // remove this if you have the GSM/GPS shield mounted #endif -#ifndef C027_USEONBOARD +#ifdef C027_USEONBOARD + #include "C027.h" + C027 c027; +#else #define GPSSCL D15 #define GPSSDA D14 #define GPSADR (66<<1) // GPS I2C Address @@ -114,7 +105,7 @@ int ret; char buf[512] = ""; - // only trace if + // only trace if the serial is different from our modem port if ((USBRX!=MDMRXD)&&(USBTX!=MDMTXD)) { Serial pc(USBTX,USBRX); pc.baud(115200); @@ -137,10 +128,10 @@ wait(2); // Create the GPS object -#if defined(GPSSCL) && defined(GPSSDA) && defined(GPSADR) - GPSI2C gps(GPSSDA,GPSSCL,GPSADR); // use GPSI2C class -#elif defined(GPSTXD) && defined(GPSRXD) && defined(GPSBAUD) - GPSSerial gps(GPSTXD,GPSRXD,GPSBAUD); // or GPSSerial class +#if GPSADR // use GPSI2C class + GPSI2C gps(GPSSDA,GPSSCL,GPSADR); +#elif GPSBAUD // or GPSSerial class + GPSSerial gps(GPSTXD,GPSRXD,GPSBAUD); #else #warning "please define the pins for the GPS" #endif