Changed RPC sucessful execution code from 1 to 200. Included RpcHandler.h in main header file. Effectively allows RPC through HTTP.

Dependents:   RPC_HTTP RPC_HTTP_WIZnetInterface RPC_HTTP rpc_over_http_TL_interrupter_gatePJ

Fork of HTTPServer by Henry Leinen

Files at this revision

API Documentation at this revision

Comitter:
leihen
Date:
Sat Jun 01 16:49:17 2013 +0000
Parent:
5:dc88012caef1
Child:
7:cb7fec1265b5
Commit message:
Added DEBUG preprocessor constant to each file.
; Added non-blocking polling function.

Changed in this revision

HTTPConnection.cpp Show annotated file Show diff for this revision Revisions of this file
HTTPRequestHandler.cpp Show annotated file Show diff for this revision Revisions of this file
HTTPServer.cpp Show annotated file Show diff for this revision Revisions of this file
HTTPServer.h Show annotated file Show diff for this revision Revisions of this file
--- a/HTTPConnection.cpp	Sat Jun 01 06:24:43 2013 +0000
+++ b/HTTPConnection.cpp	Sat Jun 01 16:49:17 2013 +0000
@@ -3,12 +3,14 @@
 #include "mbed.h"
 #include "HTTPConnection.h"
 
+#define _DEBUG 0
+
 #include <vector>
 using std::vector;
 
 using std::string;
 
-#if (1 && !defined(TARGET_LPC11U24))
+#if (_DEBUG && !defined(TARGET_LPC11U24))
 #define INFO(x, ...) std::printf("[HttpConnection : INFO]"x"\r\n", ##__VA_ARGS__);
 #define WARN(x, ...) std::printf("[HttpConnection : WARN]"x"\r\n", ##__VA_ARGS__);
 #define ERR(x, ...) std::printf("[HttpConnection : ERR]"x"\r\n", ##__VA_ARGS__);
--- a/HTTPRequestHandler.cpp	Sat Jun 01 06:24:43 2013 +0000
+++ b/HTTPRequestHandler.cpp	Sat Jun 01 16:49:17 2013 +0000
@@ -2,7 +2,9 @@
 #include "mbed.h"
 #include "HTTPRequestHandler.h"
 
-#if (1 && !defined(TARGET_LPC11U24))
+#define _DEBUG 0
+
+#if (_DEBUG && !defined(TARGET_LPC11U24))
 #define INFO(x, ...) std::printf("[HTTPRequestHandler : DBG]"x"\r\n", ##__VA_ARGS__);
 #define WARN(x, ...) std::printf("[HTTPRequestHandler : DBG]"x"\r\n", ##__VA_ARGS__);
 #define ERR(x, ...) std::printf("[HTTPRequestHandler : DBG]"x"\r\n", ##__VA_ARGS__);
--- a/HTTPServer.cpp	Sat Jun 01 06:24:43 2013 +0000
+++ b/HTTPServer.cpp	Sat Jun 01 16:49:17 2013 +0000
@@ -1,7 +1,7 @@
 #include "mbed.h"
 #include "HTTPServer.h"
 
-#define _DEBUG      1
+#define _DEBUG      0
 
 #ifdef _DEBUG
 DigitalOut led1(LED1);
@@ -89,7 +89,7 @@
 }
 
 
-int HTTPServer::poll()
+int HTTPServer::poll(bool blocking)
 {    
     int retval = -1;
     INFO("Listening for new connection requests.");
@@ -101,7 +101,7 @@
 #ifdef _DEBUG
     led4 = 1;   //  Indicate we are waiting for a new connection 
 #endif
-    m_pSvr->set_blocking(true); 
+    m_pSvr->set_blocking(blocking); 
     retval = m_pSvr->accept(Clnt);
     if (retval > 0) {
         // no connection availale yet, so just return
--- a/HTTPServer.h	Sat Jun 01 06:24:43 2013 +0000
+++ b/HTTPServer.h	Sat Jun 01 16:49:17 2013 +0000
@@ -133,10 +133,11 @@
         
         /** Performs the regular polling of the server component. Needs to be called cyclically.
         * The function will internally check whether new connections are requested by a client and will also poll all existing client connections.
+        * @param blocking : if true, 
         * @returns -1 if there was a problem. If 0 is returned, the latest request was served successfully and the server is
         * ready for processing the next request. Simply call \c poll as long as you want to serve new incoming requests.
         */
-        int poll();
+        int poll(bool blocking = true);
   
     private:
         /** The standard error handler function.