Changeset 12424 in josm


Ignore:
Timestamp:
2017-06-22T22:02:55+02:00 (7 years ago)
Author:
Don-vip
Message:

see #14924 - support NMEA GLL sentence

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/nmea/NmeaReader.java

    r12422 r12424  
    4242public class NmeaReader {
    4343
    44     public enum VTG {
     44    enum VTG {
    4545        COURSE(1), COURSE_REF(2), // true course
    4646        COURSE_M(3), COURSE_M_REF(4), // magnetic course
     
    5656    }
    5757
    58     public enum RMC {
     58    enum RMC {
    5959        TIME(1),
    6060        /** Warning from the receiver (A = data ok, V = warning) */
     
    7878    }
    7979
    80     public enum GGA {
     80    enum GGA {
    8181        TIME(1), LATITUDE(2), LATITUDE_NAME(3), LONGITUDE(4), LONGITUDE_NAME(5),
    8282        /**
     
    9696    }
    9797
    98     public enum GSA {
     98    enum GSA {
    9999        AUTOMATIC(1),
    100100        FIX_TYPE(2), // 1 = not fixed, 2 = 2D fixed, 3 = 3D fixed)
     
    108108        public final int position;
    109109        GSA(int position) {
     110            this.position = position;
     111        }
     112    }
     113
     114    enum GLL {
     115        LATITUDE(1), LATITUDE_NS(2), // Latitude, NS
     116        LONGITUDE(3), LONGITUDE_EW(4), // Latitude, EW
     117        UTC(5), // Universal Time Coordinated
     118        STATUS(6), // Status: A = Data valid, V = Data not valid
     119        /**
     120         * Mode (A = autonom; D = differential; E = estimated; N = not valid; S = simulated)
     121         * @since NMEA 2.3
     122         */
     123        MODE(7);
     124
     125        public final int position;
     126        GLL(int position) {
    110127            this.position = position;
    111128        }
     
    413430
    414431                // TODO fix?
    415                 // * Mode (A = autonom; D = differential; E = estimated; N = not valid; S
    416                 // * = simulated)
     432                // * Mode (A = autonom; D = differential; E = estimated; N = not valid; S = simulated)
    417433                // *
    418434                // * @since NMEA 2.3
    419435                //
    420436                //MODE(12);
     437            } else if (isSentence(e[0], Sentence.GLL)) {
     438                // coordinates
     439                LatLon latLon = parseLatLon(
     440                        e[GLL.LATITUDE_NS.position],
     441                        e[GLL.LONGITUDE_EW.position],
     442                        e[GLL.LATITUDE.position],
     443                        e[GLL.LONGITUDE.position]
     444                );
     445                if (LatLon.ZERO.equals(latLon)) {
     446                    ps.zeroCoord++;
     447                    return false;
     448                }
     449                // only consider valid data
     450                if (!"A".equals(e[GLL.STATUS.position])) {
     451                    return false;
     452                }
     453
     454                // RMC sentences contain a full date while GLL sentences contain only time,
     455                // so create new waypoints only of the NMEA file does not contain RMC sentences
     456                if (ps.pTime == null || currentwp == null) {
     457                    currentwp = new WayPoint(latLon);
     458                }
    421459            } else {
    422460                ps.unknown++;
Note: See TracChangeset for help on using the changeset viewer.