Working sample which demonstrates the Http Server implementation using WiFlyHTTPServer library.

Dependencies:   WiFlyHTTPServer WiflyInterface mbed-rpc mbed

Revision:
0:71b654aa5846
Child:
1:da491ef49a3e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Jun 01 18:01:29 2013 +0000
@@ -0,0 +1,55 @@
+#include "mbed.h"
+#include "WiflyInterface.h"
+#include "HTTPServer.h"
+#include "FsHandler.h"
+#include "RpcHandler.h"
+#include "LocalFileSystem.h"
+#include "mbed_rpc.h"
+
+DigitalOut myled(LED1);
+
+WiflyInterface wifly(p9, p10, p25, p26, "Spawnpoint", "Quantenoptik1", WPA);
+
+LocalFileSystem local("local");
+
+HTTPServer  svr;
+
+
+RpcDigitalOut Led1(LED1, "Led1");
+RpcDigitalOut Led2(LED2, "Led2");
+RpcDigitalOut Led3(LED3, "Led3");
+RpcDigitalOut Led4(LED4, "Led4");
+
+int main() {
+    std::string tim;
+    
+    /* 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>("/");
+    /* Add handler to acces RPC objects */
+    svr.addHandler<HTTPRpcRequestHandler>("/rpc/");
+    
+    /* Start the server which will listen for incoming connections on port 80 */
+    svr.start(80);
+    
+    
+    while(1) {
+        /* get the time and the uptime from WiFly */
+        tim = wifly.getTime(false);
+        printf("Current time is : %s\n", tim);
+        
+       if (svr.poll(false) >= 0) {
+            myled = !myled;
+        }
+        else {
+            error("WiFly Polling failed.");
+        }
+
+    }
+}