GPS Trail Import Error
hpuhr opened this issue · comments
It was reported by a user that:
If I use the "Import GPS Trail" task and load a legit NMEA file with recorded positions I get an error like the one below for every line of the document, and the output console reports "Found 0 fixes".
Line 0: [ERROR] parseInt() error. Parsed checksum string was not readable as hex. ("3A
")
I investigated the issue by performing a step-by-step debugging of the code and found the following:
The NMEA 0183 protocol specification dictates that each sentence must terminate with a Carriage Return and Line Feed sequence ( typically escaped in code with \r\n ). More info here.
Your current implementation of GPSTrailImportTask::parseCurrentFile() seems to be built around the assumption that the NMEA sentences end with a LF character only. Thus, if we supply a "by the book" NMEA file to COMPASS, after reading a line with getline(), the LF char is removed as expected but the CR char is passed along with the actual NMEA sentence (appended immediately after the checksum) and then fed to the NemaTode parser, which then throws the aforementioned errors rightfully.