Add channel error check in nmea parser.
authorbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 21 May 2010 20:45:33 +0000 (20:45 +0000)
committerbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 21 May 2010 20:45:33 +0000 (20:45 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3789 38d2e660-2303-0410-9eaa-f027e97ec537

bertos/net/nmea.c

index d4600e07d21e1f8c7ebfc6b2d4afe241aeb57210..8fe3ad7ea207319c99dc22fd4529165a2893332d 100644 (file)
@@ -456,13 +456,19 @@ int nmea_gpgsv(nmeap_context_t *context, nmeap_sentence_t *sentence)
 }
 
 
-/*
+/**
  * Parse NMEA sentence from a channel.
  */
 void nmea_poll(nmeap_context_t *context, KFile *channel)
 {
-       int c;
+       int c, e;
        while ((c = kfile_getc(channel)) != EOF)
                nmeap_parse(context, c);
+
+       if ((e = kfile_error(channel)))
+       {
+               LOG_ERR("ch error [%0X]\n", e);
+               kfile_clearerr(channel);
+       }
 }