A simple client that allows the user to send Json data to Axeda's IoT cloud using an SSL socket (with certificate verification).

Dependencies:   mbed

Only allows use of URLs, not IP addresses. Most CyaSSL errors are caused by incorrect certificates or failed certificate verification (188, 151, 155).

Revision:
2:cdfc629d20fa
Parent:
1:2d299b96dc79
--- a/main.cpp	Mon Mar 23 19:13:52 2015 +0000
+++ b/main.cpp	Mon Mar 23 19:38:52 2015 +0000
@@ -16,6 +16,10 @@
  */
 const string Serialstr = "";
 
+//Size of the http receive and send buffers
+const int BUFFER_SIZE = 2000;
+
+//Destination url to send data to the axeda cloud from the device
 const string base_url = "https://nucleus-connect.axeda.com/ammp/data/1/";
 
 int main(){
@@ -101,12 +105,12 @@
     }
     
     //Create receive interface and buffer
-    char rbuf[2000];
+    char rbuf[BUFFER_SIZE];
     HTTPText* receive = new HTTPText(rbuf, sizeof(rbuf));
     
     //Json output object, data must be in Json format, example data is input already:
     //HTTPJson type merely sets the HTTP header to JSON type, nothing else is different from the HTTPText type
-    char sbuf[2000] = "{\"data\":[{\"dataItems\":{\"mental_trauma\":1,\"physical_trauma\":2,\"emotional_trauma\":3}}]}\0";
+    char sbuf[BUFFER_SIZE] = "{\"data\":[{\"dataItems\":{\"mental_trauma\":1,\"physical_trauma\":2,\"emotional_trauma\":3}}]}\0";
     HTTPJson* send = new HTTPJson(sbuf);
     
     //Create HTTP Client Instance