A simple web server that can be bound to either the EthernetInterface or the WiflyInterface.

Dependents:   Smart-WiFly-WebServer WattEye X10Svr SSDP_Server

Revision:
38:c8fa31e6fe02
Parent:
37:0cb2774e2410
Child:
39:0427544a5c08
--- a/SW_HTTPServer.h	Sun May 11 21:16:42 2014 +0000
+++ b/SW_HTTPServer.h	Sat Jul 26 19:49:13 2014 +0000
@@ -3,8 +3,8 @@
 #define SW_HTTPSERVER_H
 #include "mbed.h"
 //#include "MODSERIAL.h"    // would like to hook in mod serial for higher performance, less blocking
-#include "RawSerial.h"
-#include "Wifly.h"
+//#include "RawSerial.h"
+//#include "Wifly.h"
 #include "TCPSocketServer.h"
 #include "TCPSocketConnection.h"
 
@@ -28,13 +28,6 @@
 #define MAX_HEADER_SIZE 1000
 
 
-/// INCLUDE_GETREMOTE is used for backward compatibility, however
-/// this makes the server dependent on the WiFly module. By not
-/// defining this, the web server can be more readily adapted to
-/// a wired interface using EthernetInterface.
-//#define INCLUDE_GETREMOTE
-
-
 /// HTTPServer is a simple web server using the WiFly module.
 ///
 /// While simple, it is a capable, web server. The basic mode
@@ -237,7 +230,7 @@
     /**
     * Create the HTTPServer object.
     *
-    * @param wifly is the serial port with the wifly interface.
+    * @param wifly is the serial port with the wifly interface. This is not longer used.
     * @param port is the optional parameter for the port number to use, default is 80.
     * @param webroot is a file system path to the root folder for the web space. If any trailing '/'
     *        is included (e.g. "/web/path/") it will be removed (to "/web/path").
@@ -251,7 +244,7 @@
     * @param allocforfile is the memory allocation to support sending a file to the client. This is 
     *        typically sized to fit an ethernet frame.
     */
-    HTTPServer(Wifly * wifly, int port = 80, const char * webroot = "/", int maxheaderParams = 15, 
+    HTTPServer(void * wifly, int port = 80, const char * webroot = "/", int maxheaderParams = 15, 
         int maxqueryParams = 30, int maxdynamicpages = 10,
         PC * pc = NULL, int _allocforheader = MAX_HEADER_SIZE, int _allocforfile = FILESEND_BUF_SIZE);
 
@@ -448,31 +441,6 @@
     */
     void UnescapeString(char * encoded);
 
-
-#ifdef INCLUDE_GETREMOTE
-    /**
-    * Get the IP address of the remote node to which we are connected.
-    *
-    * This will get the IP address of the remote node to which we are
-    * currently connected. This is written into the buffer in
-    * "192.168.100.234" format. If the buffer size is not >= 16 bytes,
-    * it will set the buffer to null.
-    *
-    * @deprecated This binds the web server to only network interfaces
-    *           that support this API (WiFly), so can limit its use.
-    *           This API will be removed.
-    *
-    * @note This switches the module into, and out of, command mode
-    *          which has quite a time penalty.
-    *
-    * @param str is the string to write the address into, which should be at
-    *        least as large as "192.168.100.203" (16-bytes).
-    * @param strSize of the str buffer must be >=16, so it will not buffer overrun.
-    * @returns true if it succeeded, false otherwise
-    */
-    bool GetRemoteAddr(char * str, int strSize);
-#endif
-
     /**
     * This is used to force a connection to close.
     *
@@ -550,26 +518,7 @@
     */
     unsigned int GetPerformanceClock();
 
-    /**
-    * Get the underlying wifly object.
-    *
-    * This lets you get to the underlying wifly object in order to
-    * interact with it.
-    *
-    * @code
-    * HTTPServer svr(&wifly, HTTP_SERVER_PORT, "/local/", 15, 30, 10, &pc);
-    * ...
-    * svr->GetWifly()->getWiflyVerString()
-    * @endcode
-    *
-    * returns the wifly option.
-    */
-    Wifly * GetWifly() {
-        return wifly;
-    };
-
 private:
-    Wifly * wifly;
     char * webroot;
     PC * pc;
     TCPSocketServer * server;