Hello !
I trying to modify the enet_io example of Tivaware C Series, I want to send the data from webpage to board via CGI handlers, here is the part of code shown below :
This CGI handler is called whenever the web browser requests iocontrol.cgi.
//
//*****************************************************************************
static char *
ControlCGIHandler(int32_t iIndex, int32_t i32NumParams, char *pcParam[],
char *pcValue[])
{
int32_t i32LEDState, i32Speed;
bool bParamError;
//
// We have not encountered any parameter errors yet.
//
bParamError = false;
//
// Get each of the expected parameters.
//
i32LEDState = FindCGIParameter("LEDOn", pcParam, i32NumParams);
i32Speed = GetCGIParam("speed_percent", pcParam, pcValue, i32NumParams,
&bParamError);
//
// Was there any error reported by the parameter parser?
//
if(bParamError || (i32Speed < 0) || (i32Speed > 100))
{
return(PARAM_ERROR_RESPONSE);
}
//
// We got all the parameters and the values were within the expected ranges
// so go ahead and make the changes.
//
io_set_led((i32LEDState == -1) ? false : true);
io_set_animation_speed(i32Speed);
//
// Send back the default response page.
//
return(DEFAULT_CGI_RESPONSE);
}
int32_t
FindCGIParameter(const char *pcToFind, char *pcParam[], int32_t iNumParams)
{
int32_t iLoop;
//
// Scan through all the parameters in the array.
//
for(iLoop = 0; iLoop < iNumParams; iLoop++)
{
//
// Does the parameter name match the provided string?
//
if(strcmp(pcToFind, pcParam[iLoop]) == 0)
{
//
// We found a match - return the index.
//
return(iLoop);
}
}
//
// If we drop out, the parameter was not found.
//
return(-1);
}
I want to know that how pcparam[] is located, where it will get find, means where the pcparam[] array wil is stored?
Regards