Specifications

56
Figure 17 Uploading an MPFS Image using FTP
To provide the user with a dynamic page in order to view current system data,
the use of CGI will be needed. With the Microchip HTTP server, the HTTP GET
option is already implemented. When the HTTP server encounters a string „%xx‟
in a CGI page that it is serving, it calls the function HTTPGetVar. The function is
implemented by the main user application and is used to transfer application
specific variable status to HTTP. Figure 18 shown below uses the HTTPGetVar
function to update system data by a CGI.
Syntax
WORD HTTPGetVar(BYTE var, WORD ref, BYTE *val)
Parameters
var [in]
Variable identifier whose status is to be returned
ref [in]
Call Reference. This reference value indicates if this is a very first call. After
first call, this value is strictly maintained by the main application. HTTP uses
the return value of this function to determine whether to call this function again
for more data. Given that only one byte is transferred at a time with this
callback, the reference value allows the main application to keep track of its
data transfer. If a variable status requires more than bytes, the main application
can use ref as an index to data array to be returned. Every time a byte is sent,
the updated value of ref is returned as a return value; the same value is passed
on next callback. In the end, when the last byte is sent, the application must
return HTTP_END_OF_VAR as a return value. HTTP will keep calling this
function until it receives HTTP_END_OF_VAR as a return value.