int _stdcall parse_params(char ** content, unsigned int * content_len, char ** name, char ** value)
content:[in/out],The parameters/properties data which want to parse
content_len:[in/out],content's length
name:[out],The name of parameters/properties which is parsed from content
value:[out],The value of parameters/properties which is parsed from content
1: parse success, 0: parse fail
Parses parameters/attribute data.
When user gets parameter/property of the camera by get_properties/get_params function ,
The rc_ipcam library by GET_PROPERTIES_RESULT and the GET_PARAMS_RESULT event notification user,
The lParam parameter for the GET_RESULT_PARAM data type,
the member variable content, content_len are the parameter/property data which return from camera .(please refer to the specific GET_RESULT_PARAM type description).
The user can call this function to parse the parameters/properties data.
Because the parameters/property data maybe include a more than one parameter/ property,
the user needs to loop calls the function to achieve the parsing all parameter/property.
For example:
void CTest2Dlg::on_get_properties_result(WPARAM wParam, LPARAM lParam)
{
GET_RESULT_PARAM * param = (GET_RESULT_PARAM *)lParam;
char * content = param->content;
unsigned int content_len = param->content_len;
char * name, * value;
CString str;
while (parse_params(&content, &content_len, &name, &value))
{
str.Format("%s=%s",name,value);
m_properties_list.InsertString(-1, str);
}
free_get_result_param(param);
}
Note, this function returns *name and *value and the new rc_ipcam memory allocation is not,
But directly to the memory of content. Therefore, if the user releases the content,
Then *name and *value are illegal pointer, continue to access will be abnormal.