Microchip® Advanced Software Framework

BasicWEB.c File Reference
#include <stdio.h>
#include <string.h>
#include "conf_eth.h"
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#include "partest.h"
#include "portmacro.h"
#include "lwip/api.h"
#include "lwip/tcpip.h"
#include "lwip/memp.h"
#include "lwip/stats.h"
#include "lwip/init.h"
#include "ethernet.h"

Macros

#define webHTML_END   "\r\n</pre>\\r\n</font></BODY></html>"
 
#define webHTML_START   "<html><head></head><BODY onLoad=\"window.setTimeout(&quot;location.href='index.html'&quot;,1000)\" bgcolor=\"#FFFFFF\" text=\"#2477E6\">\\r\nPage Hits = "
 
#define webHTTP_OK   "HTTP/1.0 200 OK\r\nContent-type: text/html\r\n\r\n"
 
#define webHTTP_PORT   ( 80 )
 
#define webMAX_PAGE_SIZE   512
 
#define webSHORT_DELAY   ( 10 )
 

Functions

 portTASK_FUNCTION (vBasicWEBServer, pvParameters)
 WEB server main task check for incoming connection and process it. More...
 
static void prvweb_ParseHTMLRequest (struct netconn *pxNetCon)
 parse the incoming request parse the HTML request and send file More...
 

Variables

portCHAR cDynamicPage [webMAX_PAGE_SIZE]
 
portCHAR cPageHits [11]
 

#define webHTML_END   "\r\n</pre>\\r\n</font></BODY></html>"

Referenced by prvweb_ParseHTMLRequest().

#define webHTML_START   "<html><head></head><BODY onLoad=\"window.setTimeout(&quot;location.href='index.html'&quot;,1000)\" bgcolor=\"#FFFFFF\" text=\"#2477E6\">\\r\nPage Hits = "

Format of the dynamic page that is returned on each connection.

Referenced by prvweb_ParseHTMLRequest().

#define webHTTP_OK   "HTTP/1.0 200 OK\r\nContent-type: text/html\r\n\r\n"

Standard GET response.

Referenced by prvweb_ParseHTMLRequest().

#define webHTTP_PORT   ( 80 )

The port on which we listen.

Referenced by portTASK_FUNCTION().

#define webMAX_PAGE_SIZE   512

The size of the buffer in which the dynamic WEB page is created.

#define webSHORT_DELAY   ( 10 )

Delay on close error.

Referenced by portTASK_FUNCTION(), and prvweb_ParseHTMLRequest().

portTASK_FUNCTION ( vBasicWEBServer  ,
pvParameters   
)

WEB server main task check for incoming connection and process it.

Parameters
pvParametersInput. Not Used.

References ERR_OK, netconn_accept(), netconn_bind(), netconn_listen, netconn_new, NETCONN_TCP, NULL, pdFALSE, pdTRUE, prvweb_ParseHTMLRequest(), vParTestSetLED(), vTaskDelay(), webCONN_LED, webHTTP_PORT, and webSHORT_DELAY.

static void prvweb_ParseHTMLRequest ( struct netconn pxNetCon)
static

parse the incoming request parse the HTML request and send file

Function to process the current connection

Parameters
pxNetConInput. The netconn to use to send and receive data.

References cDynamicPage, cPageHits, ERR_OK, netbuf_data(), netbuf_delete(), netconn_close(), NETCONN_COPY, netconn_delete(), netconn_recv(), netconn_write(), NULL, vTaskDelay(), vTaskList(), webHTML_END, webHTML_START, webHTTP_OK, and webSHORT_DELAY.

Referenced by portTASK_FUNCTION().

portCHAR cDynamicPage[webMAX_PAGE_SIZE]

Referenced by prvweb_ParseHTMLRequest().

portCHAR cPageHits[11]

Referenced by prvweb_ParseHTMLRequest().