Aeris Workshop program to read Moisture sensor and send the data to AerCloud using MQTT

Dependencies:   MQTT mbed-src

Files at this revision

API Documentation at this revision

Comitter:
agoel
Date:
Tue Jun 16 22:48:20 2015 +0000
Parent:
0:9c4dbd5b0a33
Child:
2:08cbf9d1754f
Commit message:
Minor print changes

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Jun 16 19:04:09 2015 +0000
+++ b/main.cpp	Tue Jun 16 22:48:20 2015 +0000
@@ -232,18 +232,18 @@
     char url[512];
     snprintf(url, sizeof(url), "%s/%s/scls/%s?apiKey=%s", AC_BASE, _AERCLOUD_ACCOUNT_ID, simImei, _AERCLOUD_API_KEY);
     ret = http.get(url, str, 128);
-    printf("URL : %s", url);
-    printf("STR : %s", str);
+//    printf("URL : %s", url);
+//    printf("STR : %s", str);
 
     if (ret == HTTP_OK) {
         // We're already provisioned
         printf("Yes\r\n");
-        printf("Page fetched successfully - read %d characters\r\n", strlen(str));
-        printf("Result: %s\r\n", str);
+//        printf("Page fetched successfully - read %d characters\r\n", strlen(str));
+//        printf("Result: %s\r\n", str);
         simProvisioned = true;
     } else {
         printf("No\r\n");
-        printf("Error - ret = %d - HTTP return code = %d\r\n", ret, http.getHTTPResponseCode());
+//        printf("Error - ret = %d - HTTP return code = %d\r\n", ret, http.getHTTPResponseCode());
 
         //SIM is not provisioned. trying to provision it...
         char url[512];
@@ -255,7 +255,7 @@
 
         if (!ret) {
             printf("Executed POST successfully - read %d characters\r\n", strlen(str));
-            printf("Result: %s\r\n", str);
+//            printf("Result: %s\r\n", str);
             simProvisioned = true;
         } else {
             if(http.getHTTPResponseCode() == 200)
@@ -401,9 +401,12 @@
                 printf("\r\nPosted data took ...  %u seconds \r\n", time(NULL)-beforeTime );
             }
 
+            // URL to print
+            printf("URL for Main Container: %s/%s/scls/%s/containers/%s/contentInstances?apiKey=%s&dataFormat=jsonRaw\n\n", AC_BASE, _AERCLOUD_ACCOUNT_ID, simImei, _AERCLOUD_CONTAINER, _AERCLOUD_API_KEY);
+            printf("URL for Alam Container: %s/%s/scls/%s/containers/%s/contentInstances?apiKey=%s&dataFormat=jsonRaw\n\n", AC_BASE, _AERCLOUD_ACCOUNT_ID, simImei, _AERCLOUD_CONTAINER_ALARM, _AERCLOUD_API_KEY);
+
             printf("Will be measuring again after 1 seconds !!!! \r\n\n");
             wait (1);
-            moistureValue = 0;
         }
     }