Ryo Iizuka / libMiMic

Dependents:   MbedFileServer_1768MiniDK2 RedWireBridge IssueDebug_gcc MiMicRemoteMCU-for-Mbed ... more

Revision:
111:f525c6e5e27b
Parent:
48:00d211aac2ec
--- a/mbed/mod/ModLocalFileSystem.h	Sun Mar 15 09:33:38 2015 +0000
+++ b/mbed/mod/ModLocalFileSystem.h	Mon Mar 16 14:19:16 2015 +0000
@@ -28,11 +28,19 @@
     private:
         /** file system type*/
         unsigned char _fs_type;
+        /** ルートディレクトリのプレフィクス "/pathname/" 表記*/        
+        const char* _root_alias;
+    private:
+        void retFile(char* i_buf,HttpdConnection& i_connection);
+        void retDirHtml(const char* i_buf,HttpdConnection& i_connection,unsigned char i_fs_type);
+        void retDirJson(const char* buf,HttpdConnection& i_connection,unsigned char i_fs_type);
+        
     public:
         const static unsigned char FST_DEFAULT=0x00;
         const static unsigned char FST_SDFATFS=0x01;
     public:
         /**
+         * Create filesistem responder.
          * @param i_fs_type
          * Filesystem type.
          * This value should match the file system type of mount point.
@@ -42,9 +50,23 @@
          * </ul>
          */
         ModLocalFileSystem(const char* i_path,unsigned char i_fs_type=FST_DEFAULT);
+        /**
+         * 2nd constructor.
+         * @param i_root_alias
+         * Root path string. Handler replaces the accepted URL prefix in the root path.
+         * ex. '/' or '/virtual_path/',
+         */
+        ModLocalFileSystem(const char* i_path,const char* i_root_alias,unsigned char i_fs_type=FST_DEFAULT);
+        /**
+         * 3rd donstructor.
+         * Must be call setParam method before call execute.
+         */
         ModLocalFileSystem();
         virtual ~ModLocalFileSystem();
         void setParam(const char* i_path,unsigned char i_fs_type=FST_DEFAULT);
+        void setParam(const char* i_path,const char* i_root_alias,unsigned char i_fs_type=FST_DEFAULT);
+        virtual bool canHandle(HttpdConnection& i_connection);
+       
         bool execute(HttpdConnection& i_connection);
     };