cc
Diff: ATParser.cpp
- Revision:
- 15:311f99666a8d
- Parent:
- 13:46a18ad08efc
- Child:
- 16:b9b53df4dc4d
--- a/ATParser.cpp Fri Apr 01 17:27:30 2016 +0000 +++ b/ATParser.cpp Mon Jul 04 12:08:15 2016 +0000 @@ -227,7 +227,7 @@ // We keep trying the match until we succeed or some other error // derails us. int j = 0; - + while (true) { // Recieve next character int c = getc(); @@ -240,9 +240,30 @@ // Check for match int count = -1; sscanf(_buffer+offset, _buffer, &count); - + // We only succeed if all characters in the response are matched - if (count == j) { + if(count==j) { + //check if last input is a number + if (_buffer[offset-6]=='%' && _buffer[offset-5]=='*' + && (_buffer[offset-4]=='x' || _buffer[offset-4]=='d' || _buffer[offset-4]=='u')) + { + //if the last char is a number, keep getting the next character till CR + while(1) + { + int c = getc(); + if (c < 0) { + return false; + } + if(c==0xD) {//there is no next number so exit from condition + break; + } + else { + _buffer[offset + j++] = c; + _buffer[offset + j] = 0; + } + } + } + debug_if(dbg_on, "AT= %s\r\n", _buffer+offset); // Reuse the front end of the buffer memcpy(_buffer, response, i);