s

Dependencies:   BufferedSerial

Files at this revision

API Documentation at this revision

Comitter:
mridup
Date:
Mon Jul 04 12:19:04 2016 +0000
Parent:
15:311f99666a8d
Child:
17:bf5ceea4d6f2
Commit message:
minor changes.

Changed in this revision

ATParser.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/ATParser.cpp	Mon Jul 04 12:08:15 2016 +0000
+++ b/ATParser.cpp	Mon Jul 04 12:19:04 2016 +0000
@@ -229,7 +229,7 @@
         int j = 0;
         
         while (true) {
-            // Recieve next character
+            // Receive next character
             int c = getc();
             if (c < 0) {
                 return false;
@@ -243,26 +243,26 @@
             
             // We only succeed if all characters in the response are matched
             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'))
+                //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(true)
                     {
-                        //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;
-                            }
+                        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