Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetNetIf mbed HTTPServer
Revision 0:c88421a1adc9, committed 2012-04-10
- Comitter:
- nenad
- Date:
- Tue Apr 10 14:53:06 2012 +0000
- Commit message:
Changed in this revision
diff -r 000000000000 -r c88421a1adc9 EthernetNetIf.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EthernetNetIf.lib Tue Apr 10 14:53:06 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/donatien/code/EthernetNetIf/#bc7df6da7589
diff -r 000000000000 -r c88421a1adc9 HTTPServer.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HTTPServer.lib Tue Apr 10 14:53:06 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/donatien/code/HTTPServer/#d753966e4d97
diff -r 000000000000 -r c88421a1adc9 HTTPServerExample.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HTTPServerExample.cpp Tue Apr 10 14:53:06 2012 +0000
@@ -0,0 +1,61 @@
+#include "mbed.h"
+#include "EthernetNetIf.h"
+#include "HTTPServer.h"
+
+DigitalOut led1(LED1, "led1");
+DigitalOut led2(LED2, "led2");
+DigitalOut led3(LED3, "led3");
+DigitalOut led4(LED4, "led4");
+
+LocalFileSystem fs("webfs");
+
+EthernetNetIf eth;
+/*EthernetNetIf eth(
+ IpAddr(192,168,0,111), //IP Address
+ IpAddr(255,255,255,0), //Network Mask
+ IpAddr(192,168,0,1), //Gateway
+ IpAddr(192,168,0,1) //DNS
+);*/
+HTTPServer svr;
+
+int main() {
+ Base::add_rpc_class<DigitalOut>();
+
+ 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", "/files"); //Mount /webfs path on /files web path
+ FSHandler::mount("/webfs", "/"); //Mount /webfs path on web root path
+
+ svr.addHandler<SimpleHandler>("/hello");
+ svr.addHandler<RPCHandler>("/rpc");
+ svr.addHandler<FSHandler>("/files");
+ svr.addHandler<FSHandler>("/"); //Default handler
+ //Example : Access to mbed.htm : http://a.b.c.d/mbed.htm or http://a.b.c.d/files/mbed.htm
+
+ svr.bind(80);
+
+ printf("Listening...\n");
+
+ Timer tm;
+ tm.start();
+ //Listen indefinitely
+ while(true)
+ {
+ Net::poll();
+ if(tm.read()>.5)
+ {
+ led1=!led1; //Show that we are alive
+ tm.start();
+ }
+ }
+
+ return 0;
+
+}
diff -r 000000000000 -r c88421a1adc9 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Apr 10 14:53:06 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9114680c05da