HTTPサーバのサンプル

Dependencies:   EthernetNetIf HTTPServer mbed

Files at this revision

API Documentation at this revision

Comitter:
jksoft
Date:
Mon Sep 14 14:59:01 2015 +0000
Commit message:
??

Changed in this revision

EthernetNetIf.lib Show annotated file Show diff for this revision Revisions of this file
HTTPServer.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.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r a3e48855b378 EthernetNetIf.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EthernetNetIf.lib	Mon Sep 14 14:59:01 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/EthernetNetIf/#bc7df6da7589
diff -r 000000000000 -r a3e48855b378 HTTPServer.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HTTPServer.lib	Mon Sep 14 14:59:01 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/HTTPServer/#d753966e4d97
diff -r 000000000000 -r a3e48855b378 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Sep 14 14:59:01 2015 +0000
@@ -0,0 +1,45 @@
+#include "mbed.h"
+#include "EthernetNetIf.h"
+#include "HTTPServer.h"
+
+EthernetNetIf eth;
+HTTPServer svr;
+DigitalOut led1(LED1);
+DigitalOut led2(LED2, "led2");
+AnalogIn ain(p15,"tmp");
+LocalFileSystem fs("webfs");
+
+int main() {
+    
+    printf("Setting up...\n");
+
+    EthernetErr ethErr = eth.setup();
+
+    if(ethErr) {
+        printf("Error %d in setup.\n", ethErr);
+        return -1;
+    }
+    printf("Setup OK\n");
+    
+
+    FSHandler::mount("/webfs", "/");
+    svr.addHandler<RPCHandler>("/rpc");
+    svr.addHandler<FSHandler>("/");
+    svr.bind(80);
+
+    printf("Listening...\n");
+
+    Timer tm;
+    tm.start();
+
+    while(true)
+    {
+        Net::poll();
+        if(tm.read()>.5)
+        {
+            led1=!led1;
+            tm.start();
+        }
+    }
+    return 0;
+}
\ No newline at end of file
diff -r 000000000000 -r a3e48855b378 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Sep 14 14:59:01 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9a9732ce53a1
\ No newline at end of file