公式ホームページのPlogramでエラーが発生してビルドに失敗するので作成しました。

Dependencies:   C12832 EthernetInterface HTTPClient mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
txracing
Date:
Sat Apr 05 04:47:58 2014 +0000
Commit message:
test

Changed in this revision

C12832.lib Show annotated file Show diff for this revision Revisions of this file
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
diff -r 000000000000 -r 16eef181c81e C12832.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832.lib	Sat Apr 05 04:47:58 2014 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/chris/code/C12832/#7de323fa46fe
diff -r 000000000000 -r 16eef181c81e EthernetInterface.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EthernetInterface.lib	Sat Apr 05 04:47:58 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/EthernetInterface/#6a67d2bddc7c
diff -r 000000000000 -r 16eef181c81e HTTPClient.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HTTPClient.lib	Sat Apr 05 04:47:58 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/HTTPClient/#1f743885e7de
diff -r 000000000000 -r 16eef181c81e main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Apr 05 04:47:58 2014 +0000
@@ -0,0 +1,109 @@
+#include "mbed.h"
+#include "EthernetInterface.h"
+#include "HTTPClient.h"
+#include "C12832.h"
+
+EthernetInterface eth;
+HTTPClient http;
+char str[512];
+
+C12832 lcd(p5, p7, p6, p8, p11);
+
+int main() 
+{
+    eth.init(); //Use DHCP
+
+    eth.connect();
+    
+
+    
+    //GET data
+    
+    lcd.cls();
+    lcd.locate(0,3);   
+    lcd.printf("\nTrying to fetch page...\n");
+    int ret = http.get("http://mbed.org/media/uploads/donatien/hello.txt", str, 128);
+    if (!ret)
+    {
+      lcd.cls();
+      lcd.locate(0,3);       
+      lcd.printf("Page fetched successfully - read %d characters\n", strlen(str));
+      printf("Result: %s\n", str);
+    }
+    else
+    {
+      lcd.cls();
+      lcd.locate(0,3); 
+      lcd.printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode());
+    }
+    
+    //POST data
+    HTTPMap map;
+    HTTPText inText(str, 512);
+    map.put("Hello", "World");
+    map.put("test", "1234");
+    lcd.cls();
+    lcd.locate(0,3); 
+    lcd.printf("\nTrying to post data...\n");
+    ret = http.post("http://httpbin.org/post", map, &inText);
+    if (!ret)
+    {
+      lcd.cls();
+      lcd.locate(0,3); 
+      lcd.printf("Executed POST successfully - read %d characters\n", strlen(str));
+      lcd.printf("Result: %s\n", str);
+    }
+    else
+    {
+      lcd.cls();
+      lcd.locate(0,3); 
+      lcd.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);
+    lcd.cls();
+    lcd.locate(0,3); 
+    lcd.printf("\nTrying to put resource...\n");
+    ret = http.put("http://httpbin.org/put", outText, &inText);
+    if (!ret)
+    {
+      lcd.cls();
+      lcd.locate(0,3); 
+      lcd.printf("Executed PUT successfully - read %d characters\n", strlen(str));
+      lcd.printf("Result: %s\n", str);
+    }
+    else
+    {
+      lcd.cls();
+      lcd.locate(0,3); 
+      lcd.printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode());
+    }
+    
+    //DELETE data
+    //HTTPText inText(str, 512);
+    lcd.cls();
+    lcd.locate(0,3); 
+    lcd.printf("\nTrying to delete resource...\n");
+    ret = http.del("http://httpbin.org/delete", &inText);
+    if (!ret)
+    {
+      lcd.cls();
+      lcd.locate(0,3); 
+      lcd.printf("Executed DELETE successfully - read %d characters\n", strlen(str));
+      lcd.printf("Result: %s\n", str);
+    }
+    else
+    {
+      lcd.cls();
+      lcd.locate(0,3); 
+      lcd.printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode());
+    }
+    
+    eth.disconnect();  
+
+    while(1) {
+    }
+}
diff -r 000000000000 -r 16eef181c81e mbed-rtos.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Sat Apr 05 04:47:58 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#420a92812cd1
diff -r 000000000000 -r 16eef181c81e mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Apr 05 04:47:58 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/7d30d6019079
\ No newline at end of file