Download User Manual-VSD03

Transcript
}
}
}
else
{
ErrorCode=*(arg+2);
printf("reciver error At cmd resp ERROR Code:%d",ErrorCode);
}
}
6.3.7.3 The sample of complicated AT+instruction with return parameters
AT+instruction as this type has a response with more parameters, network scan is
a typical example.
1、The function of detaching the group of parameters
It is used to devide the long parameters in AT+instruction response into groups.
INT parse_line_group (char *line, char *argv_group[])
{
INT nargs = 0;
while (nargs < ATCP_MAXARGS) {
/* skip any white space */
while ((*line == ' ') || (*line == '\t')) {
++line;
}
if (*line == '\0') { /* end of line, no more args */
argv_group[nargs] = NULL;
return (nargs);
}
{
line++;
argv_group[nargs++] = line;
/* begin of argument group */
/* find end of string */
while (*line!='\r' && (*(line+1) != '\n')) {
++line;
}
if (*line == '\0') { /* end of line, but 2nd <"> is not found */
argv_group[nargs] = NULL;
114