kteru / sbp

Parser/Serializer for the Swift Navigation Binary Protocol (SBP)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sbp

Parser/Serializer for the Swift Navigation Binary Protocol (SBP). This is compatible with SBP protocol specification v2.2.7 (stable messages).

GoDoc Build Status Coverage Status

Installation

$ go get -u github.com/kteru/sbp

Example

package main

import (
	"fmt"
	"io"
	"os"

	"github.com/kteru/sbp"
)

func main() {
	frd := sbp.NewFrameReader(os.Stdin)

	for {
		fr, err := frd.ReadFrame()
		if err == io.EOF {
			os.Exit(0)
		}
		if err != nil {
			continue
		}

		msg, _ := fr.Msg()

		switch m := msg.(type) {
		case *sbp.MsgPosLlh:
			fmt.Printf("%.9f,%.9f,%.3f,%d\n", m.Lat, m.Lon, m.Height, m.FixMode)
		}
	}
}

About

Parser/Serializer for the Swift Navigation Binary Protocol (SBP)


Languages

Language:Go 100.0%