-
Notifications
You must be signed in to change notification settings - Fork 80
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
processing multiline / segmented messages #98
Comments
Same here, I am not able to parse AIS 5 messages of this kind |
Since this issue is solved in the master branch, could you add a new tag? |
cc @adrianmo |
@nilsmagnus Could you point me to where this is solved? I haven't found any facilities in go-nmea for multiline reassembly, and I'm curious if I've just been looking in the wrong places. Thanks! |
Try this func TestName(t *testing.T) {
var tagBlocks []TagBlock
p := SentenceParser{
OnTagBlock: func(tb TagBlock) error { // one way
tagBlocks = append(tagBlocks, tb)
return nil
},
}
m, err := p.Parse("\\g:1-2-73874,n:157036,s:r003669945,c:1241544035*4A\\!AIVDM,1,1,,B,15N4cJ`005Jrek0H@9n`DW5608EP,0*13")
if err != nil {
t.Fatal(err)
}
bs, ok := m.(BaseSentence) // another way
if ok {
fmt.Printf("Tagblock: %+v\n", bs.TagBlock)
}
fmt.Printf("Tagblocks: %+v\n", tagBlocks)
} This should output that single parsed tag block as
assembly is up to you to implement. |
@aldas Thanks --
Ah, yeah, then I hadn't missed anything. I got the impression from above that there was reassembly support built in somewhere. Thanks for clarifying. |
I could not find an example for processing AIS 5 message here. This type of message has more than one line for example:
\g:1-2-3730,s:43576,c:1654340281,t:165434038119!AIVDM,2,1,7,,569EH`8000009aGUB20IF1UD4r1UF3OK7>22220N4PT38t0000000000,042
\g:2-2-37305A!AIVDM,2,2,7,,000000000000000,262
Is there any way to process such cases?
The text was updated successfully, but these errors were encountered: