From: batt Date: Fri, 21 May 2010 20:45:33 +0000 (+0000) Subject: Add channel error check in nmea parser. X-Git-Tag: 2.5.0~128 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=7065c58b8fc35d778ddd17754ad98e4c1c746f5b;p=bertos.git Add channel error check in nmea parser. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3789 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/net/nmea.c b/bertos/net/nmea.c index d4600e07..8fe3ad7e 100644 --- a/bertos/net/nmea.c +++ b/bertos/net/nmea.c @@ -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); + } }