Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linecount and sequence number #19

Open
amasanell-kineis opened this issue Jan 7, 2025 · 0 comments
Open

Linecount and sequence number #19

amasanell-kineis opened this issue Jan 7, 2025 · 0 comments

Comments

@amasanell-kineis
Copy link

Hello,
I'm currently doing consulting work for Kineis and your library is used there.
We have 2 requirements for the ais/nmea that this library does not cover:

here is the modified code we currently use for the sequence number (original code: https://github.com/BertoldVdb/go-ais/blob/master/aisnmea/nmea.go#L181-L198):

			sentence := fmt.Sprintf("!%s%s,%d,%d,%d,%c,%s,%d", p.TalkerID, p.MessageType, msgNum, msgIndex, nc.seqNo%10, channel, sub, suffix)

			sentence = addChecksum(sentence)

			tagBlock := encodeTagBlock(&p.TagBlock, msgIndex, msgNum, nc.seqNo)
			if tagBlock != "" {
				sentence = fmt.Sprintf("%s%s", tagBlock, sentence)
			}

			output = append(output, sentence)

			msgIndex++
		}

		nc.seqNo++
		if nc.seqNo == 10000 {
			nc.seqNo = 0
		}

this modification is quick & dirty but does the job.

From what I understand of the code, those 2 modifications could be optional and integrated in the codec here: https://github.com/BertoldVdb/go-ais/blob/master/codec.go

Are you interested in a contribution with those 2 elements ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant