Release v1.3.0
New features
TAG Block struct
type TagBlock struct {
Time int64 // TypeUnixTime unix timestamp (unit is likely to be s, but might be ms, YMMV), parameter: -c
RelativeTime int64 // TypeRelativeTime relative time, parameter: -r
Destination string // TypeDestinationID destination identification 15 char max, parameter: -d
Grouping string // TypeGrouping sentence grouping, parameter: -g
LineCount int64 // TypeLineCount line count, parameter: -n
Source string // TypeSourceID source identification 15 char max, parameter: -s
Text string // 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 main
import (
"fmt"
"log"
"time"
"github.com/adrianmo/go-nmea"
)
func main() {
sentence := "\\s:Satelite_1,c:1553390539*62\\!AIVDM,1,1,,A,13M@ah0025QdPDTCOl`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