Skip to content

Commit

Permalink
Update readme: note tag blocks feature and code example
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonmiteff committed Aug 21, 2020
1 parent 239a27d commit 4b3b9d4
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions README.md
Expand Up @@ -7,6 +7,7 @@ This is a NMEA library for the Go programming language (Golang).
## Features

- Parse individual NMEA 0183 sentences
- Support for sentences with NMEA 4.10 "TAG Blocks"
- Register custom parser for unsupported sentence types
- User-friendly MIT license

Expand Down Expand Up @@ -106,6 +107,41 @@ Date: 13/06/94
Variation: -4.200000
```

### TAG Blocks

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

```go
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
```

### Custom message parsing

If you need to parse a message not supported by the library you can implement your own message parsing.
Expand Down

0 comments on commit 4b3b9d4

Please sign in to comment.