Working Multithreaded HTTP Server using WiFly module. Currently only supporting GET method.
Dependencies: WiFlyHTTPServer WiflyInterface mbed-rpc mbed-rtos mbed
RTOS Wifly HTTP Server
This sample application demonstrates how the HTTP Server can be used in a multithreaded (RTOS) Environment. However currently only the GET method is supported.
main.cpp@1:40eadac4750b, 2013-06-26 (annotated)
- Committer:
- leihen
- Date:
- Wed Jun 26 22:41:58 2013 +0000
- Revision:
- 1:40eadac4750b
- Parent:
- 0:9c6ebc97c758
UPdated the HTTPServer Library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
leihen | 0:9c6ebc97c758 | 1 | #include "mbed.h" |
leihen | 0:9c6ebc97c758 | 2 | #include "HttpServer.h" |
leihen | 0:9c6ebc97c758 | 3 | #include "FsHandler.h" |
leihen | 0:9c6ebc97c758 | 4 | #include "LocalFileSystem.h" |
leihen | 0:9c6ebc97c758 | 5 | |
leihen | 0:9c6ebc97c758 | 6 | DigitalOut myled(LED1); |
leihen | 0:9c6ebc97c758 | 7 | |
leihen | 0:9c6ebc97c758 | 8 | Serial pc(USBTX, USBRX, "pc"); |
leihen | 0:9c6ebc97c758 | 9 | |
leihen | 0:9c6ebc97c758 | 10 | static LocalFileSystem local("local"); |
leihen | 0:9c6ebc97c758 | 11 | |
leihen | 0:9c6ebc97c758 | 12 | |
leihen | 0:9c6ebc97c758 | 13 | int main() { |
leihen | 0:9c6ebc97c758 | 14 | pc.baud(460800); |
leihen | 0:9c6ebc97c758 | 15 | |
leihen | 0:9c6ebc97c758 | 16 | HTTPFsRequestHandler::mount("/local/", "/"); |
leihen | 0:9c6ebc97c758 | 17 | |
leihen | 0:9c6ebc97c758 | 18 | HttpServer svr(p9, p10, p30, p29, "Spawnpoint", "Quantenoptik1", WPA); |
leihen | 0:9c6ebc97c758 | 19 | |
leihen | 0:9c6ebc97c758 | 20 | svr.addHandler<HTTPFsRequestHandler>("/"); |
leihen | 0:9c6ebc97c758 | 21 | // Start the server |
leihen | 0:9c6ebc97c758 | 22 | if (!svr.start(80) ) { |
leihen | 0:9c6ebc97c758 | 23 | error("SERVER FAILED TO START"); |
leihen | 0:9c6ebc97c758 | 24 | } |
leihen | 0:9c6ebc97c758 | 25 | |
leihen | 0:9c6ebc97c758 | 26 | while(1) { |
leihen | 0:9c6ebc97c758 | 27 | myled = 1; |
leihen | 0:9c6ebc97c758 | 28 | wait(0.2); |
leihen | 0:9c6ebc97c758 | 29 | myled = 0; |
leihen | 0:9c6ebc97c758 | 30 | wait(0.2); |
leihen | 0:9c6ebc97c758 | 31 | } |
leihen | 0:9c6ebc97c758 | 32 | } |