cc

Dependencies:   BufferedSerial

Files at this revision

API Documentation at this revision

Comitter:
mansiag
Date:
Mon Sep 05 07:01:30 2016 +0000
Parent:
18:23f4573bcda2
Child:
20:ea155e6b1fb1
Commit message:
Receive trailing delimiters of messages in vrecv()

Changed in this revision

ATParser.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/ATParser.cpp	Tue Aug 02 06:57:42 2016 +0000
+++ b/ATParser.cpp	Mon Sep 05 07:01:30 2016 +0000
@@ -190,6 +190,7 @@
 
 bool ATParser::vrecv(const char *response, va_list args)
 {
+    bool delim_recv = false;
     // Iterate through each line in the expected response
     while (response[0]) {
         // Since response is const, we need to copy it into our buffer to
@@ -256,6 +257,7 @@
                         }
                         if(c==0xD) {//there is no next number so exit from condition   
                             c = getc();//get rid of the following '\n' delimiter
+                            delim_recv = true;
                             break;
                         }
                         else {
@@ -275,6 +277,13 @@
 
                 // Jump to next line and continue parsing
                 response += i;
+                
+                // receive trailing delimiters
+                 for(int i=0; !delim_recv && i<_delim_size; i++) {
+                    c = getc();
+                    if(c < 0)
+                        break;
+                }
                 break;
             }