Working sample implementation for the EthernetInterface HTTPServer.
Dependencies: EthernetInterface HTTPServer mbed-rpc mbed-rtos mbed
Sample application which shows basic functionality of my HTTPServer library.
Import libraryHTTPServer
Single instance HTTP Server using new Ethernet Interface.
.
Revision 0:28a67716dfec, committed 2013-06-22
- Comitter:
- leihen
- Date:
- Sat Jun 22 15:50:41 2013 +0000
- Child:
- 1:6cbd17e628f1
- Commit message:
- Example implementation for usage of Ethernet Interface HTTPServer
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EthernetInterface.lib Sat Jun 22 15:50:41 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/EthernetInterface/#40640efbfcae
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HTTPServer.lib Sat Jun 22 15:50:41 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/leihen/code/HTTPServer/#aa5338a5e452
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debug.h Sat Jun 22 15:50:41 2013 +0000
@@ -0,0 +1,16 @@
+#ifndef __DEBUG_H__
+#define __DEBUG_H__
+
+
+#ifdef DEBUG
+#define INFO(x, ...) std::printf("[INFO: %s:%d]"x"\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
+#define WARN(x, ...) std::printf("[WARN: %s:%d]"x"\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
+#define ERR(x, ...) std::printf("[ERR: %s:%d]"x"\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
+#else
+#define INFO(x, ...)
+#define WARN(x, ...)
+#define ERR(x, ...)
+#endif
+
+
+#endif // __DEBUG_H__#ifndef __DEBUG_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Jun 22 15:50:41 2013 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+#include "HTTPServer.h"
+#include "FsHandler.h"
+#include "LocalFileSystem.h"
+
+
+DigitalOut myled(LED1);
+
+Serial pc(USBTX, USBRX, "pc");
+
+HTTPServer svr;
+
+LocalFileSystem local("local");
+
+int main() {
+
+ pc.baud(460800);
+ HTTPFsRequestHandler::mount("/local/", "/");
+ svr.addHandler<HTTPFsRequestHandler>("/");
+
+ if (!svr.start()) {
+ error("Server not starting !");
+ exit(0);
+ }
+
+ while(1) {
+ svr.poll();
+ myled = 1;
+ wait(0.2);
+ myled = 0;
+ wait(0.2);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rpc.lib Sat Jun 22 15:50:41 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rpc/#1ecadde1c929
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Sat Jun 22 15:50:41 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#58b30ac3f00e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Jun 22 15:50:41 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17 \ No newline at end of file
