go-nmea v1.3.0 Release Notes

Release Date: 2020-08-26 // about 1 year ago
  • 🆕 New features

    🏷 TAG Block struct

    type TagBlock struct { Timeint64// TypeUnixTime unix timestamp (unit is likely to be s, but might be ms, YMMV), parameter: -cRelativeTime int64// TypeRelativeTime relative time, parameter: -rDestinationstring // TypeDestinationID destination identification 15 char max, parameter: -dGroupingstring // TypeGrouping sentence grouping, parameter: -gLineCountint64// TypeLineCount line count, parameter: -nSourcestring // TypeSourceID source identification 15 char max, parameter: -sTextstring // TypeTextString valid character string, parameter -t}
    

    Ref.: https://github.com/adrianmo/go-nmea/blob/master/tagblock.go#L10

    Code example

    NMEA 4.10 TAG Block values can be accessed via the message's TagBlock struct:

    package mainimport ( "fmt""log""time""github.com/adrianmo/go-nmea")func main() { sentence := "\\s:Satelite\_1,c:1553390539\*62\\!AIVDM,1,1,,A,[email protected]`K6`nV00Sv,0\*52"s, err := nmea.Parse(sentence) if err != nil { log.Fatal(err) } parsed := s.(nmea.VDMVDO) fmt.Printf("TAG Block timestamp: %v\n", time.Unix(parsed.TagBlock.Time, 0)) fmt.Printf("TAG Block source: %v\n", parsed.TagBlock.Source) }
    

    Output (locale/time zone dependent):

    $ go run main/main.go
    
    TAG Block timestamp: 2019-03-24 14:22:19 +1300 NZDT
    TAG Block source: Satelite_1
    

    Thank you!

    @klyve @simeonmiteff @icholy


Previous changes from v1.2.0

  • 🗄 Deprecation

    📜 Message parsing is now talker-agnostic, i.e., it is based on the sentence data type only. For a sentence like $XXYYY,220516,A,23,5133.82,W*42, where XX is the talker and YYY is the sentence data type, the parser will only account for the YYY data type, which is what defines the structure and format of the sentence.

    In your code, given a sentence like the following:

    sentence := "$GPRMC,220516,A,5133.82,N,00042.24,W,173.8,231.8,130694,004.2,W\*70"
    

    🗄 Instead of using the old, deprecated prefixes (e.g. nmea.PrefixGPRMC) that included the talked ID and the data type:

    s, \_ := nmea.Parse(sentence)// Deprecated nmea.PrefixGPRMC, use nmea.TypeRMC insteadif s.Prefix() == nmea.PrefixGPRMC { m := s.(nmea.GPRMC) fmt.Printf("Validity: %s\n", m.Validity) ... }
    

    📜 Use the DataType() sentence method to determine the parsed sentence data type and then cast it to the right type:

    s, \_ := nmea.Parse(sentence)if s.DataType() == nmea.TypeRMC { m := s.(nmea.RMC) fmt.Printf("Validity: %s\n", m.Validity) ... }
    

    🆕 New features

    • 📜 Ability to register custom message parsers to allow parsing of sentence types that are currently not supported by the library [link].

    🆕 New sentences

    • GNS - Combined GPS fix for GPS, Glonass, Galileo, and BeiDou
    • THS - Actual vessel heading in degrees True and status
    • 🛰 VDM/VDO - Encapsulated binary payload
    • WPL - Waypoint location
    • RTE - Route
    • 📄 VHW - Water Speed and Heading
    • DPT - Depth of Water
    • DBS - Depth Below Surface
    • DBT - Depth below transducer

    Thank you!

    @icholy @bmurray @sthorshaug @BertoldVdb @kvartborg @krasi-georgiev @krawczyk87 @yavosh