Skip to content

GPS / NMEA packet message dissector (standard and proprietary)

License

Notifications You must be signed in to change notification settings

pilebones/go-nmea

Repository files navigation

go-nmea Go Report Card GitHub Repo stars GoDoc Release License Build Status Coverage Status

A Golang library for decode and serialize standard and proprietary NMEA packet message (GPS information dissector).

Tested with this GPS Module cover L80 gps protocol specification v1.0.pdf. See another NMEA specification.

NMEA Specification

NMEA standard specification provide 58 kind of message with different structure. And more according to GPS devices manufacturer (ex: 40 proprietary message identified prefixed by PMTK for L80 GPS protocol specification).

Syntax: $<talker_id><message_id>[<data-fields>...]*<checksum><CRLF>

Supported NMEA message

The following list will be expanded to manage new types, but now the library can decode and serialize:

  • $GPRMC - Recommended Minimum Specific GPS/TRANSIT Data
  • $GPVTG - Track Made Good and Ground Speed
  • $GPGGA - Global Positioning System Fix Data
  • $GPGSA - GPS DOP and active satellites
  • $GPGSV - GPS Satellites in view
  • $GPGLL - Geographic position, latitude / longitude
  • $GPTXT - Transfert various text information

Usage

Library for parsing (read) or serialize (write) NMEA packets (bijective handling), see below:

package main

import "fmt"
import nmea "github.com/pilebones/go-nmea"

func main() {
	raw := "$GPGGA,015540.000,3150.68378,N,11711.93139,E,1,17,0.6,0051.6,M,0.0,M,,*58"

	fmt.Println("Parsing NMEA message:", raw)
	msg, err := nmea.Parse(raw)
	if err != nil {
		fmt.Println("Unable to decode nmea message, err:", err.Error())
		return
	}

	// TODO: Handling complex struct depending on kind of nmea message

	fmt.Println("Craft NMEA packets using Serialize():", msg.Serialize())
}

Documentation

License

go-nmea is available under the GNU GPL v3 - Clause License.