* add C027_Support fork

Fork of C027_Support by u-blox

Revision:
21:c4d64830bf02
Parent:
19:2b5d097ca15d
Child:
24:0e287a85ac9e
diff -r 2b5d097ca15d -r c4d64830bf02 GPS.cpp
--- a/GPS.cpp	Mon Mar 24 07:38:05 2014 +0000
+++ b/GPS.cpp	Tue Apr 08 09:15:37 2014 +0000
@@ -12,28 +12,31 @@
     while (len > 0)
     {
         // NMEA protocol
+        pipe->set(unkn);
         int nmea = _parseNmea(pipe,len);
         if ((nmea != NOT_FOUND) && (unkn > 0))  
-            return unkn;
+            return pipe->get(buf,unkn);
         if (nmea == WAIT && fr)                       
             return WAIT;
         if (nmea > 0)                           
             return NMEA | pipe->get(buf,nmea);
         // UBX protocol
+        
+        pipe->set(unkn);
         int ubx = _parseUbx(pipe,len);
         if ((ubx != NOT_FOUND) && (unkn > 0))   
-            return unkn;
+            return pipe->get(buf,unkn);
         if (ubx == WAIT && fr)                        
             return WAIT;
         if (ubx > 0)                            
             return UBX | pipe->get(buf,ubx);
+        
         // UNKNOWN
-        *buf++ = pipe->getc();
         unkn ++;
         len--;
     }
-    if (unkn != NOT_FOUND)                      
-        return unkn; 
+    if (unkn > 0)                      
+        return pipe->get(buf,unkn); 
     return WAIT;
 }
 
@@ -42,7 +45,6 @@
     int o = 0;
     int c = 0;
     char ch;
-    pipe->start();
     if (++o > len)                      return WAIT;
     if ('$' != pipe->next())            return NOT_FOUND;
     // this needs to be extended by crc checking 
@@ -70,7 +72,6 @@
 int GPSParser::_parseUbx(Pipe<char>* pipe, int l)
 {
     int o = 0;
-    pipe->start();
     if (++o > l)                return WAIT;
     if ('\xB5' != pipe->next()) return NOT_FOUND;   
     if (++o > l)                return WAIT;