Update library (02 Feb 2015)

Dependencies:   EthernetInterface HTTPClient mbed-rtos mbed

Fork of HTTPClient_HelloWorld by Donatien Garnier

Files at this revision

API Documentation at this revision

Comitter:
ban4jp
Date:
Sun Feb 01 15:30:08 2015 +0000
Parent:
4:dce35de805b5
Child:
6:b6f680d83b3c
Commit message:
Update library (02 Feb 2015); Format code.

Changed in this revision

EthernetInterface.lib Show annotated file Show diff for this revision Revisions of this file
HTTPClient.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/EthernetInterface.lib	Mon Dec 02 14:41:44 2013 +0000
+++ b/EthernetInterface.lib	Sun Feb 01 15:30:08 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/EthernetInterface/#cba86db5ab96
+http://developer.mbed.org/users/mbed_official/code/EthernetInterface/#d1ccbed7687a
--- a/HTTPClient.lib	Mon Dec 02 14:41:44 2013 +0000
+++ b/HTTPClient.lib	Sun Feb 01 15:30:08 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/donatien/code/HTTPClient/#1f743885e7de
+http://developer.mbed.org/users/ban4jp/code/HTTPClient/#f020c92bd1a2
--- a/main.cpp	Mon Dec 02 14:41:44 2013 +0000
+++ b/main.cpp	Sun Feb 01 15:30:08 2015 +0000
@@ -6,45 +6,36 @@
 HTTPClient http;
 char str[512];
 
-int main() 
+int main()
 {
     int ret = eth.init(); //Use DHCP
-    if (!ret)
-    {
-      printf("Initialized, MAC: %s\n", eth.getMACAddress());
-    }
-    else
-    {
-      printf("Error eth.init() - ret = %d\n", ret);
-      return -1;
+    if (!ret) {
+        printf("Initialized, MAC: %s\n", eth.getMACAddress());
+    } else {
+        printf("Error eth.init() - ret = %d\n", ret);
+        return -1;
     }
 
     ret = eth.connect();
-    if (!ret)
-    {
-      printf("Connected, IP: %s, MASK: %s, GW: %s\n",
-        eth.getIPAddress(), eth.getNetworkMask(), eth.getGateway());
+    if (!ret) {
+        printf("Connected, IP: %s, MASK: %s, GW: %s\n",
+               eth.getIPAddress(), eth.getNetworkMask(), eth.getGateway());
+    } else {
+        printf("Error eth.connect() - ret = %d\n", ret);
+        return -1;
     }
-    else
-    {
-      printf("Error eth.connect() - ret = %d\n", ret);
-      return -1;
-    }
-    
-    
+
+
     //GET data
     printf("\nTrying to fetch page...\n");
     ret = http.get("http://mbed.org/media/uploads/donatien/hello.txt", str, 128);
-    if (!ret)
-    {
-      printf("Page fetched successfully - read %d characters\n", strlen(str));
-      printf("Result: %s\n", str);
+    if (!ret) {
+        printf("Page fetched successfully - read %d characters\n", strlen(str));
+        printf("Result: %s\n", str);
+    } else {
+        printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode());
     }
-    else
-    {
-      printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode());
-    }
-    
+
     //POST data
     HTTPMap map;
     HTTPText inText(str, 512);
@@ -52,56 +43,44 @@
     map.put("test", "1234");
     printf("\nTrying to post data...\n");
     ret = http.post("http://httpbin.org/post", map, &inText);
-    if (!ret)
-    {
-      printf("Executed POST successfully - read %d characters\n", strlen(str));
-      printf("Result: %s\n", str);
+    if (!ret) {
+        printf("Executed POST successfully - read %d characters\n", strlen(str));
+        printf("Result: %s\n", str);
+    } else {
+        printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode());
     }
-    else
-    {
-      printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode());
-    }
-    
+
     //PUT data
     strcpy(str, "This is a PUT test!");
     HTTPText outText(str);
     //HTTPText inText(str, 512);
     printf("\nTrying to put resource...\n");
     ret = http.put("http://httpbin.org/put", outText, &inText);
-    if (!ret)
-    {
-      printf("Executed PUT successfully - read %d characters\n", strlen(str));
-      printf("Result: %s\n", str);
+    if (!ret) {
+        printf("Executed PUT successfully - read %d characters\n", strlen(str));
+        printf("Result: %s\n", str);
+    } else {
+        printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode());
     }
-    else
-    {
-      printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode());
-    }
-    
+
     //DELETE data
     //HTTPText inText(str, 512);
     printf("\nTrying to delete resource...\n");
     ret = http.del("http://httpbin.org/delete", &inText);
-    if (!ret)
-    {
-      printf("Executed DELETE successfully - read %d characters\n", strlen(str));
-      printf("Result: %s\n", str);
-    }
-    else
-    {
-      printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode());
+    if (!ret) {
+        printf("Executed DELETE successfully - read %d characters\n", strlen(str));
+        printf("Result: %s\n", str);
+    } else {
+        printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode());
     }
-    
-    
+
+
     printf("\n");
-    ret = eth.disconnect();  
-    if (!ret)
-    {
-      printf("Disconnected\n");
-    }
-    else
-    {
-      printf("Error eth.disconnect() - ret = %d\n", ret);
+    ret = eth.disconnect();
+    if (!ret) {
+        printf("Disconnected\n");
+    } else {
+        printf("Error eth.disconnect() - ret = %d\n", ret);
     }
 
 
--- a/mbed-rtos.lib	Mon Dec 02 14:41:44 2013 +0000
+++ b/mbed-rtos.lib	Sun Feb 01 15:30:08 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed-rtos/#29007aef10a4
+http://developer.mbed.org/users/mbed_official/code/mbed-rtos/#5448826aa700
--- a/mbed.bld	Mon Dec 02 14:41:44 2013 +0000
+++ b/mbed.bld	Sun Feb 01 15:30:08 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/673126e12c73
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5
\ No newline at end of file