Working sample which demonstrates the Http Server implementation using WiFlyHTTPServer library.
Dependencies: WiFlyHTTPServer WiflyInterface mbed-rpc mbed
Diff: main.cpp
- Revision:
- 2:b3d211f851dd
- Parent:
- 1:da491ef49a3e
--- a/main.cpp Sat Jun 01 18:08:03 2013 +0000 +++ b/main.cpp Sun Jun 02 00:53:38 2013 +0000 @@ -1,5 +1,4 @@ #include "mbed.h" -#include "WiflyInterface.h" #include "HTTPServer.h" #include "FsHandler.h" #include "RpcHandler.h" @@ -8,11 +7,9 @@ DigitalOut myled(LED1); -WiflyInterface wifly(p9, p10, p25, p26, "<Your AP Name>", "<Your Passphrase>", WPA); - LocalFileSystem local("local"); -HTTPServer svr; +HTTPServer svr(p9, p10, p30, p29, "<Your AP Name>", "<Your Passphrase>", WPA); RpcDigitalOut Led1(LED1, "Led1"); @@ -25,10 +22,6 @@ /* Mount the local file system. */ HTTPFsRequestHandler::mount("/local/", "/"); - - /* Start the wifly interface and connect to an AP */ - wifly.init(); - while(!wifly.connect()); /* Add handler for file system access */ svr.addHandler<HTTPFsRequestHandler>("/"); @@ -41,8 +34,8 @@ while(1) { /* get the time and the uptime from WiFly */ - tim = wifly.getTime(false); - printf("Current time is : %s\n", tim); + tim = svr.getTime(); + printf("Current time is : %s\n", tim.c_str()); if (svr.poll(false) >= 0) { myled = !myled;