Ryo Iizuka / Mbed 2 deprecated MiMicRemoteMCU-for-Mbed

Dependencies:   libMiMic mbed-rtos mbed NySDFileSystem

Revision:
5:227d20070da4
Parent:
4:00b4e7596014
Child:
7:8cbfa0625c51
--- a/main.cpp	Sun Apr 21 01:22:16 2013 +0000
+++ b/main.cpp	Wed Apr 24 08:06:09 2013 +0000
@@ -1,12 +1,17 @@
 #include "mbed.h"
+#include "SDFileSystem.h"
 #include "mimic.h"
 #include "fsdata.h"
 
-
 /**
  * local filesystem support.
  */
 LocalFileSystem lf("local");
+SDFileSystem sd(p5, p6, p7, p12,"sd");
+
+DigitalOut led1(LED1);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
 
 /**
  * MiMic RemoteMCU httpd.<br/>
@@ -25,6 +30,7 @@
     ModMiMicSetting mimicsetting; //mimic setting API
     ModRemoteMcu remotemcu; // remotemcu API
     ModLocalFileSystem modlocal; //basic URL parser
+    ModLocalFileSystem modsd; //basic URL parser
     
 public:
     MiMicRemoteMcu():Httpd(80)
@@ -33,6 +39,7 @@
         this->mimicsetting.setParam("setup");
         this->remotemcu.setParam("mvm");
         this->modlocal.setParam("local");
+        this->modsd.setParam("sd");
     }
     virtual void onRequest(HttpdConnection& i_connection)
     {
@@ -52,17 +59,27 @@
         if(this->modlocal.execute(i_connection)){
             return;
         }
+        //try to ModLocalFileSystem(SD)
+        if(this->modsd.execute(i_connection)){
+            return;
+        }
         
         //Otherwise, Send the redirect response to /rom/index.html
         i_connection.sendHeader(301,
             "text/html",
-            "Status: 301:Moved Permanently\r\n"
+            "Status: 302:Moved Temporarily\r\n"
             "Location: /rom/index.html\r\n");        
         return;
     }
 };
+
 int main()
 {
+    {DigitalOut led(LED1);led=0;}
+    {DigitalOut led(LED2);led=0;}
+    {DigitalOut led(LED3);led=0;}
+    {DigitalOut led(LED4);led=0;}
+
     NetConfig cfg; //create network configulation  with onchip-setting.
     cfg.loadFromFile("/local/mimic.cfg"); //try to override setting by local file.
     Net net(cfg);  //create a net instance