From 2ffc4bc09d62f73d9ab2094185593165946c6dac Mon Sep 17 00:00:00 2001 From: Bjarte Klyve Larsen Date: Sat, 3 Aug 2019 13:34:15 +0200 Subject: [PATCH 1/8] Added support for TagBlocks TagBlock is now parsed before any other messages and is a part of BaseSentence --- sentence.go | 9 ++++ tagblock.go | 111 +++++++++++++++++++++++++++++++++++++++++++++++ tagblock_test.go | 95 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 215 insertions(+) create mode 100644 tagblock.go create mode 100644 tagblock_test.go diff --git a/sentence.go b/sentence.go index 69e92a5..a6636f7 100644 --- a/sentence.go +++ b/sentence.go @@ -34,6 +34,7 @@ type BaseSentence struct { Fields []string // Array of fields Checksum string // The Checksum Raw string // The raw NMEA sentence received + TagBlock TagBlock // NMEA tagblock } // Prefix returns the talker and type of message @@ -57,6 +58,12 @@ func (s BaseSentence) String() string { return s.Raw } // parseSentence parses a raw message into it's fields func parseSentence(raw string) (BaseSentence, error) { raw = strings.TrimSpace(raw) + var tagBlock TagBlock + tagBlock, raw, err := parseTagBlock(raw) + if err != nil { + return BaseSentence{}, err + } + startIndex := strings.IndexAny(raw, SentenceStart+SentenceStartEncapsulated) if startIndex != 0 { return BaseSentence{}, fmt.Errorf("nmea: sentence does not start with a '$' or '!'") @@ -77,12 +84,14 @@ func parseSentence(raw string) (BaseSentence, error) { "nmea: sentence checksum mismatch [%s != %s]", checksum, checksumRaw) } talker, typ := parsePrefix(fields[0]) + return BaseSentence{ Talker: talker, Type: typ, Fields: fields[1:], Checksum: checksumRaw, Raw: raw, + TagBlock: tagBlock, }, nil } diff --git a/tagblock.go b/tagblock.go new file mode 100644 index 0000000..a30f3f9 --- /dev/null +++ b/tagblock.go @@ -0,0 +1,111 @@ +package nmea + +import ( + "fmt" + "regexp" + "strconv" + "strings" +) + +const ( + // TypeUnixTime unix timestamp, parameter: -c + TypeUnixTime = "c" + // TypeDestinationID destination identification 15char max, parameter: -d + TypeDestinationID = "d" + // TypeGrouping sentence grouping, parameter: -g + TypeGrouping = "g" + // TypeLineCount linecount, parameter: -n + TypeLineCount = "n" + // TypeRelativeTime relative time time, paremeter: -r + TypeRelativeTime = "r" + // TypeSourceID source identification 15char max, paremter: -s + TypeSourceID = "s" + // TypeTextString valid character string, parameter -t + TypeTextString = "t" +) + +var ( + // TagBlockRegexp matches nmea tag blocks + TagBlockRegexp = regexp.MustCompile(`^(.*)\\(\S+)\\(.*)`) +) + +// TagBlock struct +type TagBlock struct { + Head string // * + Time uint32 // -c + RelativeTime uint32 // -r + Destination string // -d 15 char max + Grouping string // -g nummeric string + LineCount uint32 // -n int + Source string // -s 15 char max + Text string // -t Variable length text +} + +func parseUint(raw string) (uint32, error) { + i, err := strconv.ParseUint(raw[2:], 10, 32) + if err != nil { + return 0, fmt.Errorf("nmea: tagblock unable to parse uint32 [%s]", raw) + } + return uint32(i), nil +} + +// parseTagBlock adds support for tagblocks +// https://rietman.wordpress.com/2016/09/17/nemastudio-now-supports-the-nmea-0183-tag-block/ +func parseTagBlock(raw string) (TagBlock, string, error) { + matches := TagBlockRegexp.FindStringSubmatch(raw) + var tagBlock TagBlock + if matches != nil { + raw = matches[3] + tags := matches[2] + tagBlock.Head = matches[1] + + sumSepIndex := strings.Index(tags, ChecksumSep) + if sumSepIndex == -1 { + return tagBlock, raw, fmt.Errorf("nmea: tagblock does not contain checksum separator") + } + + var ( + fieldsRaw = tags[0:sumSepIndex] + checksumRaw = strings.ToUpper(tags[sumSepIndex+1:]) + checksum = xorChecksum(fieldsRaw) + err error + ) + + // Validate the checksum + if checksum != checksumRaw { + return tagBlock, raw, fmt.Errorf("nmea: tagblock checksum mismatch [%s != %s]", checksum, checksumRaw) + } + + data := strings.Split(tags[:sumSepIndex], ",") + for _, item := range data { + switch item[0:1] { + case TypeUnixTime: + tagBlock.Time, err = parseUint(item) + if err != nil { + return tagBlock, raw, err + } + case TypeDestinationID: + tagBlock.Destination = item[2:] + case TypeGrouping: + tagBlock.Grouping = item[2:] + case TypeLineCount: + tagBlock.LineCount, err = parseUint(item) + if err != nil { + return tagBlock, raw, err + } + case TypeRelativeTime: + tagBlock.RelativeTime, err = parseUint(item) + if err != nil { + return tagBlock, raw, err + } + case TypeSourceID: + tagBlock.Source = item[2:] + case TypeTextString: + tagBlock.Text = item[2:] + } + } + + } + + return tagBlock, raw, nil +} diff --git a/tagblock_test.go b/tagblock_test.go new file mode 100644 index 0000000..8d41bdc --- /dev/null +++ b/tagblock_test.go @@ -0,0 +1,95 @@ +package nmea + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +var tagblocktests = []struct { + //name: "Tagblock ok", + //raw: "", + name string + raw string + err string + msg TagBlock +}{ + { + + name: "Test NMEA tag block", + raw: "\\s:Satelite_1,c:1553390539*62\\!AIVDM,1,1,,A,13M@ah0025QdPDTCOl`K6`nV00Sv,0*52", + msg: TagBlock{ + Time: 1553390539, + Source: "Satelite_1", + }, + }, + { + + name: "Test NMEA tag block with head", + raw: "UdPbC?\\s:satelite,c:1564827317*25\\!AIVDM,1,1,,A,19NSRaP02A0fo91kwnaMKbjR08:J,0*15", + msg: TagBlock{ + Time: 1564827317, + Source: "satelite", + Head: "UdPbC?", + }, + }, + { + + name: "Test unknown tag", + raw: "UdPbC?\\x:NorSat_1,c:1564827317*42\\!AIVDM,1,1,,A,19NSRaP02A0fo91kwnaMKbjR08:J,0*15", + msg: TagBlock{ + Time: 1564827317, + Source: "", + Head: "UdPbC?", + }, + }, + { + + name: "Test all input types", + raw: "UdPbC?\\s:satelite,c:1564827317,r:1553390539,d:ara,g:bulk,n:13,t:helloworld*3F\\!AIVDM,1,1,,A,19NSRaP02A0fo91kwnaMKbjR08:J,0*15", + msg: TagBlock{ + Time: 1564827317, + RelativeTime: 1553390539, + Destination: "ara", + Grouping: "bulk", + Source: "satelite", + Head: "UdPbC?", + Text: "helloworld", + LineCount: 13, + }, + }, + { + + name: "Test Invalid checksum", + raw: "UdPbC?\\s:satelite,c:1564827317*49\\!AIVDM,1,1,,A,19NSRaP02A0fo91kwnaMKbjR08:J,0*15", + err: "nmea: tagblock checksum mismatch [25 != 49]", + }, + { + + name: "Test no checksum", + raw: "UdPbC?\\s:satelite,c:156482731749\\!AIVDM,1,1,,A,19NSRaP02A0fo91kwnaMKbjR08:J,0*15", + err: "nmea: tagblock does not contain checksum separator", + }, + { + + name: "Test invalid int", + raw: "UdPbC?\\s:satelite,c:gjadslkg*30\\!AIVDM,1,1,,A,19NSRaP02A0fo91kwnaMKbjR08:J,0*15", + err: "nmea: tagblock unable to parse uint32 [c:gjadslkg]", + }, +} + +func TestTagBlock(t *testing.T) { + for _, tt := range tagblocktests { + t.Run(tt.name, func(t *testing.T) { + m, err := Parse(tt.raw) + if tt.err != "" { + assert.Error(t, err) + assert.EqualError(t, err, tt.err) + } else { + assert.NoError(t, err) + vdm := m.(VDMVDO) + assert.Equal(t, tt.msg, vdm.BaseSentence.TagBlock) + } + }) + } +} From 83a54dfa37f9200d3bf14c7cdb0d760f864243e7 Mon Sep 17 00:00:00 2001 From: Bjarte Klyve Larsen Date: Sat, 3 Aug 2019 16:52:48 +0200 Subject: [PATCH 2/8] Added tests for linecount and relative time --- tagblock_test.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tagblock_test.go b/tagblock_test.go index 8d41bdc..0696473 100644 --- a/tagblock_test.go +++ b/tagblock_test.go @@ -72,10 +72,22 @@ var tagblocktests = []struct { }, { - name: "Test invalid int", + name: "Test invalid timestamp", raw: "UdPbC?\\s:satelite,c:gjadslkg*30\\!AIVDM,1,1,,A,19NSRaP02A0fo91kwnaMKbjR08:J,0*15", err: "nmea: tagblock unable to parse uint32 [c:gjadslkg]", }, + { + + name: "Test invalid linecount", + raw: "UdPbC?\\s:satelite,n:gjadslkg*3D\\!AIVDM,1,1,,A,19NSRaP02A0fo91kwnaMKbjR08:J,0*15", + err: "nmea: tagblock unable to parse uint32 [n:gjadslkg]", + }, + { + + name: "Test invalid relative time", + raw: "UdPbC?\\s:satelite,r:gjadslkg*21\\!AIVDM,1,1,,A,19NSRaP02A0fo91kwnaMKbjR08:J,0*15", + err: "nmea: tagblock unable to parse uint32 [r:gjadslkg]", + }, } func TestTagBlock(t *testing.T) { From 30fd1833ecd43c286a18dd058cc33d3feeee837e Mon Sep 17 00:00:00 2001 From: Bjarte Klyve Larsen Date: Sat, 3 Aug 2019 23:02:45 +0200 Subject: [PATCH 3/8] Early exit if no matches in tagblock --- tagblock.go | 94 ++++++++++++++++++++++++++--------------------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/tagblock.go b/tagblock.go index a30f3f9..51d4744 100644 --- a/tagblock.go +++ b/tagblock.go @@ -53,59 +53,59 @@ func parseUint(raw string) (uint32, error) { // https://rietman.wordpress.com/2016/09/17/nemastudio-now-supports-the-nmea-0183-tag-block/ func parseTagBlock(raw string) (TagBlock, string, error) { matches := TagBlockRegexp.FindStringSubmatch(raw) - var tagBlock TagBlock - if matches != nil { - raw = matches[3] - tags := matches[2] - tagBlock.Head = matches[1] + if matches == nil { + return TagBlock{}, raw, nil + } - sumSepIndex := strings.Index(tags, ChecksumSep) - if sumSepIndex == -1 { - return tagBlock, raw, fmt.Errorf("nmea: tagblock does not contain checksum separator") - } + tagBlock := TagBlock{} + raw = matches[3] + tags := matches[2] + tagBlock.Head = matches[1] - var ( - fieldsRaw = tags[0:sumSepIndex] - checksumRaw = strings.ToUpper(tags[sumSepIndex+1:]) - checksum = xorChecksum(fieldsRaw) - err error - ) + sumSepIndex := strings.Index(tags, ChecksumSep) + if sumSepIndex == -1 { + return tagBlock, raw, fmt.Errorf("nmea: tagblock does not contain checksum separator") + } - // Validate the checksum - if checksum != checksumRaw { - return tagBlock, raw, fmt.Errorf("nmea: tagblock checksum mismatch [%s != %s]", checksum, checksumRaw) - } + var ( + fieldsRaw = tags[0:sumSepIndex] + checksumRaw = strings.ToUpper(tags[sumSepIndex+1:]) + checksum = xorChecksum(fieldsRaw) + err error + ) + + // Validate the checksum + if checksum != checksumRaw { + return tagBlock, raw, fmt.Errorf("nmea: tagblock checksum mismatch [%s != %s]", checksum, checksumRaw) + } - data := strings.Split(tags[:sumSepIndex], ",") - for _, item := range data { - switch item[0:1] { - case TypeUnixTime: - tagBlock.Time, err = parseUint(item) - if err != nil { - return tagBlock, raw, err - } - case TypeDestinationID: - tagBlock.Destination = item[2:] - case TypeGrouping: - tagBlock.Grouping = item[2:] - case TypeLineCount: - tagBlock.LineCount, err = parseUint(item) - if err != nil { - return tagBlock, raw, err - } - case TypeRelativeTime: - tagBlock.RelativeTime, err = parseUint(item) - if err != nil { - return tagBlock, raw, err - } - case TypeSourceID: - tagBlock.Source = item[2:] - case TypeTextString: - tagBlock.Text = item[2:] + data := strings.Split(tags[:sumSepIndex], ",") + for _, item := range data { + switch item[0:1] { + case TypeUnixTime: + tagBlock.Time, err = parseUint(item) + if err != nil { + return tagBlock, raw, err + } + case TypeDestinationID: + tagBlock.Destination = item[2:] + case TypeGrouping: + tagBlock.Grouping = item[2:] + case TypeLineCount: + tagBlock.LineCount, err = parseUint(item) + if err != nil { + return tagBlock, raw, err + } + case TypeRelativeTime: + tagBlock.RelativeTime, err = parseUint(item) + if err != nil { + return tagBlock, raw, err } + case TypeSourceID: + tagBlock.Source = item[2:] + case TypeTextString: + tagBlock.Text = item[2:] } - } - return tagBlock, raw, nil } From e7a1392269bb00867203f79550f0ba911131a47a Mon Sep 17 00:00:00 2001 From: Bjarte Klyve Larsen Date: Thu, 8 Aug 2019 15:53:02 +0200 Subject: [PATCH 4/8] Fixed PR comments --- sentence.go | 1 - tagblock.go | 31 +++++++++++++++++-------------- tagblock_test.go | 18 ++++++++++++++++-- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/sentence.go b/sentence.go index a6636f7..3f317b5 100644 --- a/sentence.go +++ b/sentence.go @@ -58,7 +58,6 @@ func (s BaseSentence) String() string { return s.Raw } // parseSentence parses a raw message into it's fields func parseSentence(raw string) (BaseSentence, error) { raw = strings.TrimSpace(raw) - var tagBlock TagBlock tagBlock, raw, err := parseTagBlock(raw) if err != nil { return BaseSentence{}, err diff --git a/tagblock.go b/tagblock.go index 51d4744..90120d1 100644 --- a/tagblock.go +++ b/tagblock.go @@ -25,34 +25,34 @@ const ( ) var ( - // TagBlockRegexp matches nmea tag blocks - TagBlockRegexp = regexp.MustCompile(`^(.*)\\(\S+)\\(.*)`) + // tagBlockRegexp matches nmea tag blocks + tagBlockRegexp = regexp.MustCompile(`^(.*)\\(\S+)\\(.*)`) ) // TagBlock struct type TagBlock struct { Head string // * - Time uint32 // -c - RelativeTime uint32 // -r + Time int64 // -c + RelativeTime int64 // -r Destination string // -d 15 char max Grouping string // -g nummeric string - LineCount uint32 // -n int + LineCount int64 // -n int Source string // -s 15 char max Text string // -t Variable length text } -func parseUint(raw string) (uint32, error) { - i, err := strconv.ParseUint(raw[2:], 10, 32) +func parseUint(raw string) (int64, error) { + i, err := strconv.ParseInt(raw[2:], 10, 32) if err != nil { return 0, fmt.Errorf("nmea: tagblock unable to parse uint32 [%s]", raw) } - return uint32(i), nil + return i, nil } // parseTagBlock adds support for tagblocks // https://rietman.wordpress.com/2016/09/17/nemastudio-now-supports-the-nmea-0183-tag-block/ func parseTagBlock(raw string) (TagBlock, string, error) { - matches := TagBlockRegexp.FindStringSubmatch(raw) + matches := tagBlockRegexp.FindStringSubmatch(raw) if matches == nil { return TagBlock{}, raw, nil } @@ -64,7 +64,7 @@ func parseTagBlock(raw string) (TagBlock, string, error) { sumSepIndex := strings.Index(tags, ChecksumSep) if sumSepIndex == -1 { - return tagBlock, raw, fmt.Errorf("nmea: tagblock does not contain checksum separator") + return tagBlock, "", fmt.Errorf("nmea: tagblock does not contain checksum separator") } var ( @@ -76,12 +76,15 @@ func parseTagBlock(raw string) (TagBlock, string, error) { // Validate the checksum if checksum != checksumRaw { - return tagBlock, raw, fmt.Errorf("nmea: tagblock checksum mismatch [%s != %s]", checksum, checksumRaw) + return tagBlock, "", fmt.Errorf("nmea: tagblock checksum mismatch [%s != %s]", checksum, checksumRaw) } - data := strings.Split(tags[:sumSepIndex], ",") - for _, item := range data { - switch item[0:1] { + items := strings.Split(tags[:sumSepIndex], ",") + for _, item := range items { + if len(item) == 0 { + continue + } + switch item[:1] { case TypeUnixTime: tagBlock.Time, err = parseUint(item) if err != nil { diff --git a/tagblock_test.go b/tagblock_test.go index 0696473..37c20cc 100644 --- a/tagblock_test.go +++ b/tagblock_test.go @@ -7,8 +7,6 @@ import ( ) var tagblocktests = []struct { - //name: "Tagblock ok", - //raw: "", name string raw string err string @@ -58,6 +56,22 @@ var tagblocktests = []struct { LineCount: 13, }, }, + { + + name: "Test empty tag in tagblock", + raw: "UdPbC?\\s:satelite,,r:1553390539,d:ara,g:bulk,n:13,t:helloworld*68\\!AIVDM,1,1,,A,19NSRaP02A0fo91kwnaMKbjR08:J,0*15", + msg: TagBlock{ + Time: 0, + RelativeTime: 1553390539, + Destination: "ara", + Grouping: "bulk", + Source: "satelite", + Head: "UdPbC?", + Text: "helloworld", + LineCount: 13, + }, + //err: "nmea: tagblock checksum mismatch [25 != 49]", + }, { name: "Test Invalid checksum", From d2c4cad826485fc1d963132c1746ac19a7dc63a3 Mon Sep 17 00:00:00 2001 From: Bjarte Klyve Larsen Date: Thu, 8 Aug 2019 17:30:12 +0200 Subject: [PATCH 5/8] Renamed parseUint to parseInt64 --- tagblock.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tagblock.go b/tagblock.go index 90120d1..44f2a60 100644 --- a/tagblock.go +++ b/tagblock.go @@ -41,7 +41,7 @@ type TagBlock struct { Text string // -t Variable length text } -func parseUint(raw string) (int64, error) { +func parseInt64(raw string) (int64, error) { i, err := strconv.ParseInt(raw[2:], 10, 32) if err != nil { return 0, fmt.Errorf("nmea: tagblock unable to parse uint32 [%s]", raw) @@ -86,7 +86,7 @@ func parseTagBlock(raw string) (TagBlock, string, error) { } switch item[:1] { case TypeUnixTime: - tagBlock.Time, err = parseUint(item) + tagBlock.Time, err = parseInt64(item) if err != nil { return tagBlock, raw, err } @@ -95,12 +95,12 @@ func parseTagBlock(raw string) (TagBlock, string, error) { case TypeGrouping: tagBlock.Grouping = item[2:] case TypeLineCount: - tagBlock.LineCount, err = parseUint(item) + tagBlock.LineCount, err = parseInt64(item) if err != nil { return tagBlock, raw, err } case TypeRelativeTime: - tagBlock.RelativeTime, err = parseUint(item) + tagBlock.RelativeTime, err = parseInt64(item) if err != nil { return tagBlock, raw, err } From 60b352056c4f829676e8bf60e165a58b686d95d7 Mon Sep 17 00:00:00 2001 From: Bjarte Klyve Larsen Date: Thu, 8 Aug 2019 18:17:32 +0200 Subject: [PATCH 6/8] Added validation for timestamp according to nmea spec --- tagblock.go | 25 ++++++++++++++++++++++++- tagblock_test.go | 31 +++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/tagblock.go b/tagblock.go index 44f2a60..d7f7a07 100644 --- a/tagblock.go +++ b/tagblock.go @@ -1,10 +1,12 @@ package nmea import ( + "errors" "fmt" "regexp" "strconv" "strings" + "time" ) const ( @@ -42,13 +44,30 @@ type TagBlock struct { } func parseInt64(raw string) (int64, error) { - i, err := strconv.ParseInt(raw[2:], 10, 32) + i, err := strconv.ParseInt(raw[2:], 10, 64) if err != nil { return 0, fmt.Errorf("nmea: tagblock unable to parse uint32 [%s]", raw) } return i, nil } +// Timestamp can come as milliseconds or seconds +func validUnixTimestamp(timestamp int64) (int64, error) { + if timestamp < 0 { + return 0, errors.New("nmea: Tagblock timestamp is not valid must be between 0 and now + 24h") + } + now := time.Now() + unix := now.Unix() + 24*3600 + if timestamp > unix { + if timestamp > unix*1000 { + return 0, errors.New("nmea: Tagblock timestamp is not valid") + } + return timestamp / 1000, nil + } + + return timestamp, nil +} + // parseTagBlock adds support for tagblocks // https://rietman.wordpress.com/2016/09/17/nemastudio-now-supports-the-nmea-0183-tag-block/ func parseTagBlock(raw string) (TagBlock, string, error) { @@ -90,6 +109,10 @@ func parseTagBlock(raw string) (TagBlock, string, error) { if err != nil { return tagBlock, raw, err } + tagBlock.Time, err = validUnixTimestamp(tagBlock.Time) + if err != nil { + return tagBlock, raw, err + } case TypeDestinationID: tagBlock.Destination = item[2:] case TypeGrouping: diff --git a/tagblock_test.go b/tagblock_test.go index 37c20cc..7d5cc42 100644 --- a/tagblock_test.go +++ b/tagblock_test.go @@ -41,6 +41,37 @@ var tagblocktests = []struct { Head: "UdPbC?", }, }, + { + name: "Test unix timestamp", + raw: "UdPbC?\\x:NorSat_1,c:1564827317*42\\!AIVDM,1,1,,A,19NSRaP02A0fo91kwnaMKbjR08:J,0*15", + msg: TagBlock{ + Time: 1564827317, + Source: "", + Head: "UdPbC?", + }, + }, + { + + name: "Test milliseconds timestamp", + raw: "UdPbC?\\x:NorSat_1,c:1564827317000*72\\!AIVDM,1,1,,A,19NSRaP02A0fo91kwnaMKbjR08:J,0*15", + msg: TagBlock{ + Time: 1564827317, + Source: "", + Head: "UdPbC?", + }, + }, + { + + name: "Test invalid high timestamp", + raw: "UdPbC?\\x:NorSat_1,c:25648273170000000*71\\!AIVDM,1,1,,A,19NSRaP02A0fo91kwnaMKbjR08:J,0*15", + err: "nmea: Tagblock timestamp is not valid", + }, + { + + name: "Test invalid low timestamp", + raw: "UdPbC?\\x:NorSat_1,c:-10*60\\!AIVDM,1,1,,A,19NSRaP02A0fo91kwnaMKbjR08:J,0*15", + err: "nmea: Tagblock timestamp is not valid must be between 0 and now + 24h", + }, { name: "Test all input types", From 7ae4adf73682dce67ba3f3445a930662749e50b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Moreno?= Date: Thu, 13 Feb 2020 11:02:23 +0100 Subject: [PATCH 7/8] Fix checksum ref after branch update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Adrián Moreno --- tagblock.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tagblock.go b/tagblock.go index d7f7a07..864b34c 100644 --- a/tagblock.go +++ b/tagblock.go @@ -89,7 +89,7 @@ func parseTagBlock(raw string) (TagBlock, string, error) { var ( fieldsRaw = tags[0:sumSepIndex] checksumRaw = strings.ToUpper(tags[sumSepIndex+1:]) - checksum = xorChecksum(fieldsRaw) + checksum = Checksum(fieldsRaw) err error ) From 75d6121e4aaaf0a0fae6b8a791c011662b051cfc Mon Sep 17 00:00:00 2001 From: bjarte Date: Sat, 22 Feb 2020 01:49:27 +0100 Subject: [PATCH 8/8] changed go mod to fork --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index c3bbdfe..3226c22 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/adrianmo/go-nmea +module github.com/klyve/go-nmea require github.com/stretchr/testify v1.2.1