HTTPサーバテスト

Dependencies:   EthernetNetIf mbed HTTPServer

Files at this revision

API Documentation at this revision

Comitter:
jksoft
Date:
Sun Nov 20 06:05:36 2011 +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 546e1420b6eb EthernetNetIf.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EthernetNetIf.lib	Sun Nov 20 06:05:36 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/EthernetNetIf/#bc7df6da7589
diff -r 000000000000 -r 546e1420b6eb HTTPServer.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HTTPServer.lib	Sun Nov 20 06:05:36 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/HTTPServer/#d753966e4d97
diff -r 000000000000 -r 546e1420b6eb main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Nov 20 06:05:36 2011 +0000
@@ -0,0 +1,46 @@
+#include "mbed.h"
+#include "EthernetNetIf.h" // ƒ‰ƒCƒuƒ‰ƒŠ‚̃wƒbƒ_Eƒtƒ@ƒCƒ‹‚ðƒCƒ“ƒNƒ‹[ƒh
+#include "HTTPServer.h" // ƒ‰ƒCƒuƒ‰ƒŠ‚̃wƒbƒ_Eƒtƒ@ƒCƒ‹‚ðƒCƒ“ƒNƒ‹[ƒh
+
+// ƒ‰ƒCƒuƒ‰ƒŠ‚Ì’è‹`
+EthernetNetIf eth;                      // ƒC[ƒTƒlƒbƒgEƒCƒ“ƒ^[ƒtƒF[ƒX
+HTTPServer svr;                         // HTTPƒT[ƒo
+DigitalOut led1(LED1);                  // “®ì’†•\Ž¦—p
+DigitalOut led2(LED2, "led2");          // ƒuƒ‰ƒEƒUã‚©‚爵‚¤‚½‚ß‚É–¼‘O‚ð•t‚¯‚é
+AnalogIn ain(p15,"tmp");                // ƒuƒ‰ƒEƒUã‚©‚爵‚¤‚½‚ß‚É–¼‘O‚ð•t‚¯‚é
+LocalFileSystem fs("webfs");            // ƒuƒ‰ƒEƒUã‚©‚çmbedƒhƒ‰ƒCƒu‚ɃAƒNƒZƒX
+
+int main() {
+    printf("Setting up...\n");
+
+    EthernetErr ethErr = eth.setup();   // ƒlƒbƒgƒ[ƒN‚ɐڑ±
+
+    if(ethErr) {
+        // Ú‘±ˆÙí
+        printf("Error %d in setup.\n", ethErr);
+        return -1;
+    }
+    printf("Setup OK\n");
+
+    // HTTPƒT[ƒo‚̐ݒè
+    FSHandler::mount("/webfs", "/");
+    svr.addHandler<RPCHandler>("/rpc");
+    svr.addHandler<FSHandler>("/");
+    svr.bind(80);
+
+    printf("Listening...\n");
+
+    Timer tm;
+    tm.start();                         // ƒ^ƒCƒ}EƒXƒ^[ƒg
+
+    while(true)
+    {
+        Net::poll();                    // ƒlƒbƒgƒ[ƒNˆ—
+        if(tm.read()>.5)                // ƒ^ƒCƒ}EƒXƒ^[ƒg‚µ‚Ä‚©‚ç0.5•b‚½‚Á‚½‚珈—‚·‚é
+        {
+            led1=!led1;                 // LED‚ð“_–Å
+            tm.start();                 // ƒ^ƒCƒ}EƒXƒ^[ƒg
+        }
+    }
+    return 0;
+}
\ No newline at end of file
diff -r 000000000000 -r 546e1420b6eb mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Nov 20 06:05:36 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9a9732ce53a1