ソースの整理中ですが、利用はできます。

Dependencies:   EthernetInterface HttpServer TextLCD mbed-rpc mbed-rtos mbed Socket lwip-eth lwip-sys lwip

Committer:
yueee_yt
Date:
Wed Mar 12 04:39:15 2014 +0000
Revision:
2:14b689a85306
Parent:
0:7766f6712673
bug fix

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yueee_yt 0:7766f6712673 1 /*
yueee_yt 0:7766f6712673 2 Permission is hereby granted, free of charge, to any person obtaining a copy
yueee_yt 0:7766f6712673 3 of this software and associated documentation files (the "Software"), to deal
yueee_yt 0:7766f6712673 4 in the Software without restriction, including without limitation the rights
yueee_yt 0:7766f6712673 5 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
yueee_yt 0:7766f6712673 6 copies of the Software, and to permit persons to whom the Software is
yueee_yt 0:7766f6712673 7 furnished to do so, subject to the following conditions:
yueee_yt 0:7766f6712673 8
yueee_yt 0:7766f6712673 9 The above copyright notice and this permission notice shall be included in
yueee_yt 0:7766f6712673 10 all copies or substantial portions of the Software.
yueee_yt 0:7766f6712673 11
yueee_yt 0:7766f6712673 12 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
yueee_yt 0:7766f6712673 13 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
yueee_yt 0:7766f6712673 14 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
yueee_yt 0:7766f6712673 15 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
yueee_yt 0:7766f6712673 16 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
yueee_yt 0:7766f6712673 17 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
yueee_yt 0:7766f6712673 18 THE SOFTWARE.
yueee_yt 0:7766f6712673 19 */
yueee_yt 0:7766f6712673 20
yueee_yt 0:7766f6712673 21 #ifndef FS_HANDLER_H
yueee_yt 0:7766f6712673 22 #define FS_HANDLER_H
yueee_yt 0:7766f6712673 23
yueee_yt 0:7766f6712673 24 #include "../HTTPRequestHandler.h"
yueee_yt 0:7766f6712673 25 #include "mbed.h"
yueee_yt 0:7766f6712673 26 #include "EthernetInterface.h"
yueee_yt 0:7766f6712673 27 #include <map>
yueee_yt 0:7766f6712673 28 using std::map;
yueee_yt 0:7766f6712673 29
yueee_yt 0:7766f6712673 30 #include <string>
yueee_yt 0:7766f6712673 31 using std::string;
yueee_yt 0:7766f6712673 32
yueee_yt 0:7766f6712673 33 class FSHandler : public HTTPRequestHandler
yueee_yt 0:7766f6712673 34 {
yueee_yt 0:7766f6712673 35 public:
yueee_yt 0:7766f6712673 36 FSHandler(const char* rootPath, const char* path, TCPSocketConnection* pTCPSocketConnection);
yueee_yt 0:7766f6712673 37 virtual ~FSHandler();
yueee_yt 0:7766f6712673 38
yueee_yt 0:7766f6712673 39 static void mount(const string& fsPath, const string& rootPath);
yueee_yt 0:7766f6712673 40
yueee_yt 0:7766f6712673 41 //protected:
yueee_yt 0:7766f6712673 42 static inline HTTPRequestHandler* inst(const char* rootPath, const char* path, TCPSocketConnection* pTCPSocketConnection) { return new FSHandler(rootPath, path, pTCPSocketConnection); } //if we ever could do static virtual functions, this would be one
yueee_yt 0:7766f6712673 43
yueee_yt 0:7766f6712673 44 virtual void doGet();
yueee_yt 0:7766f6712673 45 virtual void doPost();
yueee_yt 0:7766f6712673 46 virtual void doHead();
yueee_yt 0:7766f6712673 47
yueee_yt 0:7766f6712673 48 virtual void onReadable(); //Data has been read
yueee_yt 0:7766f6712673 49 virtual void onWriteable(); //Data has been written & buf is free
yueee_yt 0:7766f6712673 50 virtual void onClose(); //Connection is closing
yueee_yt 0:7766f6712673 51
yueee_yt 0:7766f6712673 52 private:
yueee_yt 0:7766f6712673 53 FILE* m_fp;
yueee_yt 0:7766f6712673 54 bool m_err404;
yueee_yt 0:7766f6712673 55 static map<string,string> m_lFsPath;
yueee_yt 0:7766f6712673 56 };
yueee_yt 0:7766f6712673 57
yueee_yt 0:7766f6712673 58 #endif