Download M03 AT Command - User Manual
Transcript
set the bit of ReciveAtCmdrep when it has received the return of the AT instruction, at this
time ,the bit will be judged in AT instruction sending frame, and then the function will parse
the different returns of AT instructions.
6.3.5 The function used to parse the return parameters of AT
instruction
This function is used to parse the return parameters of AT instruction, and split the
return parameters. The sample is as follow.
INT parse_line (char *line, char *argv[])
{
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[nargs] = NULL;
return (nargs);
}
if (*line == '"'){/* argument such as
"xxxx" */
line++; /* skip 1st <"> */
argv[nargs++] = line;
/* begin of argument string */
/* find end of string */
while (*line && (*line != '"')) {
++line;
}
if (*line == '\0') { /* end of line, but 2nd <"> is not found */
argv[nargs] = NULL;
return (-1);
}
*line++ = '\0';
/* terminate current arg */
108 | P a g e