- Timestamp:
- 2009-02-09T10:05:19+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/NmeaReader.java
r1385 r1388 158 158 } 159 159 public int getParserChecksumErrors() { 160 return ps.checksum_errors ;160 return ps.checksum_errors+ps.no_checksum; 161 161 } 162 162 public int getParserMalformed() { … … 219 219 protected int malformed = 0; 220 220 protected int checksum_errors = 0; 221 protected int no_checksum = 0; 221 222 protected int unknown = 0; 222 223 protected int zero_coord = 0; … … 235 236 // and result in a malformed packet. 236 237 String[] chkstrings = s.split("\\*"); 237 byte[] chb = chkstrings[0].getBytes(); 238 int chk=0; 239 for(int i = 1; i < chb.length; i++) chk ^= chb[i]; 240 if(Integer.parseInt(chkstrings[1].substring(0,2),16) != chk) { 241 //System.out.println("Checksum error"); 242 ps.checksum_errors++; 243 ps.p_Wp=null; 244 return false; 245 } 238 if(chkstrings.length > 1) 239 { 240 byte[] chb = chkstrings[0].getBytes(); 241 int chk=0; 242 for(int i = 1; i < chb.length; i++) chk ^= chb[i]; 243 if(Integer.parseInt(chkstrings[1].substring(0,2),16) != chk) { 244 //System.out.println("Checksum error"); 245 ps.checksum_errors++; 246 ps.p_Wp=null; 247 return false; 248 } 249 } 250 else 251 ps.no_checksum++; 246 252 // now for the content 247 253 String[] e = chkstrings[0].split(","); … … 435 441 } catch(Exception x) { 436 442 // out of bounds and such 443 // x.printStackTrace(); 437 444 // System.out.println("Malformed line: "+s.toString().trim()); 438 445 ps.malformed++; … … 460 467 int latdeg = Integer.parseInt(widthNorth.substring(0, latdegsep)); 461 468 double latmin = Double.parseDouble(widthNorth.substring(latdegsep)); 469 if(latdeg < 0) // strange data with '-' sign 470 latmin *= -1.0; 462 471 double lat = latdeg + latmin / 60; 463 472 if ("S".equals(ns)) { … … 470 479 int londeg = Integer.parseInt(lengthEast.substring(0, londegsep)); 471 480 double lonmin = Double.parseDouble(lengthEast.substring(londegsep)); 481 if(londeg < 0) // strange data with '-' sign 482 lonmin *= -1.0; 472 483 double lon = londeg + lonmin / 60; 473 484 if ("W".equals(ew)) {
Note:
See TracChangeset
for help on using the changeset viewer.