trash over HTTP

Dependencies:   C027_Support HTTPClient TrashSensors mbed Crypto

Fork of SLOTrashHTTP by Corey Ford

Collects sensor readings and sends them to https://trash.coreyford.name/

Server code: https://github.com/coyotebush/trash-map

Revision:
1:929b55ff96b0
Parent:
0:284e9c16e92d
Child:
2:ecc029c53752
--- a/main.cpp	Sun May 24 23:40:27 2015 +0000
+++ b/main.cpp	Mon May 25 03:19:34 2015 +0000
@@ -38,19 +38,6 @@
     if (!mdm.connect(SIMPIN, APN,USERNAME,PASSWORD))
         return -1;
     HTTPClient http;
-  
-    //GET data
-    printf("\r\nTrying to fetch page...\r\n");
-    int ret = http.get("http://developer.mbed.org/media/uploads/donatien/hello.txt", str, 128);
-    if (!ret)
-    {
-      printf("Page fetched successfully - read %d characters\r\n", strlen(str));
-      printf("Result: %s\r\n", str);
-    }
-    else
-    {
-      printf("Error - ret = %d - HTTP return code = %d\r\n", ret, http.getHTTPResponseCode());
-    }
     
     while (true) {
         distS.start();
@@ -65,7 +52,7 @@
         map.put("name", SENSOR_NAME);
         map.put("value", distString);
         printf("\r\nTrying to post data...\r\n");
-        ret = http.post("http://trash.coreyford.name/sensor", map, &inText);
+        int ret = http.post("http://trash.coreyford.name/sensor", map, &inText);
         if (!ret)
         {
           printf("Executed POST successfully - read %d characters\r\n", strlen(str));
@@ -76,12 +63,6 @@
           printf("Error - ret = %d - HTTP return code = %d\r\n", ret, http.getHTTPResponseCode());
         }
         
-        wait_ms(5000);
+        wait_ms(10000);
     }
-
-
-    mdm.disconnect();
-    mdm.powerOff();
-
-    while(true);
 }