-
Notifications
You must be signed in to change notification settings - Fork 105
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
[WIP] AIS message type 8 #84
base: master
Are you sure you want to change the base?
Conversation
@@ -36,23 +34,16 @@ | |||
public class AISMessageFactory { | |||
|
|||
private static AISMessageFactory instance; | |||
private Map<Integer, Class<? extends AISMessage>> parsers; | |||
private List<AISMessageParserFactory> parserFactories; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I like your approach and the architecture improvement, I must note that the AISMessageFactory
isn't as ready as SentenceFactory
where you can replace any of the provided parsers with your own custom implementation at runtime, so I'm a little worried this change would prevent or make it more difficult.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have better idea tell me and I can refactor code. This change (probably subconsciously inspired by some code from Spring Framework) allowed me to solve my problem without changing too much existing code.
Another option I considered was making AISXParser
s to act as factories and return instances of AISMessageX
instead of implementing AISMessageX
. Then I could use another map (or just if/else) in AISMessage08Parser
to decide which instance of AISMessage
to return. But that looked like big change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it's a nice solution as such, not critizing but rather just thinking about the bigger picture. On the other hand, I'm not sure if AIS parsers need to be replaced that often.. what do you think? For plain NMEA it's probably more handy, because there are known different implementations (e.g. XDR), so you can roll your own parser to handle those.
Anyways, the DAC/FIC seems a bit tricky as it is yet another layer of encoding on top of AIS, so it could probably be handled similarly like AIS over NMEA, but then again that would require repeating the event/listener pattern we have for NMEA and AIS.
I guess this needs a bit of thinking, but don't hesitate to continue your work meanwhile, looking good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The funny thing is that I'm not very familiar with AIS or NMEA. I just get many .txt files from friend of mine and convert them to .csv (somehow they are more readable for normal people than sixbit... 😛). But...
It looks like that AIS standard is closed, so users won't need to create custom parsers when all of message types will be supported. Except for messages 6, 8, 25, and 26 that have subtypes based on DAC/FID or ApplicationID. I have no idea how many different subtypes are there. Maybe 99% of users would be interested in few combinations of DAC/FID and there is no point of making it extendable/replaceable?
Maybe event/listener approach is good. Can't tell, because didn't used them in my application. I just call SentenceFactory
directly.
This pull requests changes
Adds support for AIS message Type 8: Binary Broadcast Message based on: http://catb.org/gpsd/AIVDM.html#_type_8_binary_broadcast_message
For now there is one parser for DAC = 200, FID = 10: Ship static and voyage related data.
I will probably add another parser for DAC = 001, FID = 31: Meteorological and Hydrological soon.