Sam Clarke / Mbed 2 deprecated GPS-GPRS_Tracker

Dependencies:   GPS MODSERIAL mbed-rtos mbed

Revision:
1:00c7dc0c1761
Parent:
0:5b4bcbd69509
Child:
2:2b2c785c6627
diff -r 5b4bcbd69509 -r 00c7dc0c1761 main.cpp
--- a/main.cpp	Sat Oct 06 22:47:34 2012 +0000
+++ b/main.cpp	Sun Oct 07 02:01:51 2012 +0000
@@ -46,7 +46,7 @@
     GPRS.printf("AT+CMGF=1\r\n");
     wait(1);
     // Set the phone number
-    GPRS.printf("AT+CMGS=\"+614<<NUMBER>>\"\r\n");
+    GPRS.printf("AT+CMGS=\"+61435404829\"\r\n");
     wait(1);
     // Write out the GPS data in a message
     GPRS.printf("Time: %4.2f \nAltitude: %3.2fm\nSpeed: %3.2f Kn\nHeading: %3.2f Deg\nValidity: %c\nFix: %s\nSatellites: %d", gps.time, gps.altitude, gps.speed, gps.heading,gps.validity,gps.fixtype,gps.satellites);
@@ -56,7 +56,7 @@
     wait(3);
     GPRS.printf("AT+CMGF=1\r\n");
     wait(1);
-    GPRS.printf("AT+CMGS=\"+614<<NUMBER>>\"\r\n");
+    GPRS.printf("AT+CMGS=\"+61435404829\"\r\n");
     wait(1);
     GPRS.printf("Find me at....\n %s%f,%f%s", GoogleChunk, gps.latitude, gps.longitude, GoogleExtras);
     wait(1);
@@ -78,11 +78,12 @@
     }
     // Uncomment the following to debug
 
-    //pc.printf("buffer = %s", GPRSbuffer);
-    //pc.printf("index  = %d", index);
+    pc.printf("buffer = %s", GPRSbuffer);
+
 
     // If we get an SMS notification....
     if (sscanf(GPRSbuffer, "$$+CMTI: \"SM\",%d", &index)>0) {
+        pc.printf("\nSMS recieved @ index [%d]", index);
         // Do the send SMS routine...
         sendSms();
         // Wait for the cascade of \r\nOK\r\n\r\nOK\r\n's from the SMS's to finish
@@ -93,7 +94,14 @@
         memset(GPRSbuffer, '0', 512);
         // Reset the char counter
         i = 0;
-    } else pc.printf("\nWaiting for SMS...\n");
+    } else {
+        GPRS.rxBufferFlush();
+        // Reset the GPRS buffer
+        memset(GPRSbuffer, '0', 512);
+        // Reset the char counter
+        i = 0;
+        pc.printf("\nWaiting for SMS...\n");
+    }
 }
 
 int main()