Port Pin RA4 = %a04
During processing of this file, the HTTP Server encounters the ‘%a04’ string. After parsing it, the HTTP Server makes a callback to HTTPGetVar(httpInfo, val). The httpInfo->var.get.varRef will have the value HTTP_START_OF_VAR. The main user application implements HTTPGetVar as follows:
#include "projdefs.h" #include "net\http.h" ROM char SerialNumberStr[] = "123456SER"; WORD HTTPGetVar(HTTP_INFO* httpInfo, BYTE* val) { BYTE varValue, varGroup, ref; varValue = httpInfo->var.get.tagVal; //Variable Value of requested variable varGroup = httpInfo->var.get.tagGroup; //Variable Group of requested variable ref = httpInfo->var.get.varRef; //Current callback reference with respect //to 'var' variable. //In case requested var not found, set it to NULL character and return HTTP_END_OF_VAR *val = '\0'; //Identify variable group if (varGroup == 'a') { // Identify variable value. // Is it RA4 ? if ( varValue == 4 ) { // We will simply return ‘1’ if RA4 is high, or ‘0’ if low. if ( PORTB_RA4 ) *val = ‘1’; else *val = ‘0; // Tell HTTP that this is last byte of // variable value. return HTTP_END_OF_VAR; } else // Check for other variables values... //... } } }