public abstract class AisMessage extends Object implements Serializable
| Modifier and Type | Field and Description |
|---|---|
protected int |
msgId
The Msg id.
|
protected int |
repeat
The Repeat.
|
protected int |
userId
The User id.
|
static Set<Integer> |
VALID_MESSAGE_TYPES
A set of all valid AIS message types.
|
protected Vdm |
vdm
The Vdm.
|
| Constructor and Description |
|---|
AisMessage(int msgId)
Constructor given message id
|
AisMessage(Vdm vdm)
Constructor given VDM with AIS message
|
| Modifier and Type | Method and Description |
|---|---|
protected SixbitEncoder |
encode()
Base encode method to be called by all extending classes
|
abstract SixbitEncoder |
getEncoded()
Abstract method to be implemented by all extending classes
|
static AisMessage |
getInstance(Vdm vdm)
Given VDM return the encapsulated AIS message.
|
int |
getMsgId()
Gets msg id.
|
int |
getRepeat()
Gets repeat.
|
IProprietarySourceTag |
getSourceTag()
Return the LAST source tag (closest to AIS sentence)
|
LinkedList<IProprietaryTag> |
getTags()
Get all tags
|
AisTargetType |
getTargetType()
Returns the target type of the message or
null if the message does not have a target type. |
int |
getUserId()
Gets user id.
|
dk.dma.enav.model.geometry.Position |
getValidPosition()
Returns a valid position if this message has a valid position, otherwise null.
|
Vdm |
getVdm()
Get VDM this message was encapsulated in
|
protected void |
parse(BinArray binArray)
Base parse method to be called by all extending classes
|
String |
reassemble()
Method for reassembling original message appending possible proprietary source tags
|
void |
setRepeat(int repeat)
Sets repeat.
|
void |
setTag(IProprietaryTag tag)
Add tag (to front)
|
void |
setTags(LinkedList<IProprietaryTag> tags)
Sets tags.
|
void |
setUserId(int userId)
Sets user id.
|
String |
toString() |
static String |
trimText(String text)
Utility to trim text from AIS message
|
public static final Set<Integer> VALID_MESSAGE_TYPES
protected int msgId
protected int repeat
protected int userId
protected transient Vdm vdm
public AisMessage(int msgId)
msgId - the msg idpublic AisMessage(Vdm vdm)
vdm - the vdmprotected void parse(BinArray binArray) throws AisMessageException, SixbitException
binArray - the bin arrayAisMessageException - the ais message exceptionSixbitException - the sixbit exceptionprotected SixbitEncoder encode()
public abstract SixbitEncoder getEncoded()
public int getMsgId()
public int getRepeat()
public void setRepeat(int repeat)
repeat - the repeatpublic int getUserId()
public void setUserId(int userId)
userId - the user idpublic IProprietarySourceTag getSourceTag()
public LinkedList<IProprietaryTag> getTags()
public void setTag(IProprietaryTag tag)
tag - the tagpublic void setTags(LinkedList<IProprietaryTag> tags)
tags - the tagspublic Vdm getVdm()
public dk.dma.enav.model.geometry.Position getValidPosition()
public AisTargetType getTargetType()
null if the message does not have a target type.null if the message does not have a target typepublic static AisMessage getInstance(Vdm vdm) throws AisMessageException, SixbitException
Example: AisMessage aisMessage = AisMessage.getInstance(vmd); if (aisMessage instanceof AisPositionMessage) { AisPositionMessage posMessage = (AisPositionMessage)aisMessage; } ...
vdm - the vdmAisMessageException - the ais message exceptionSixbitException - the sixbit exceptionpublic static String trimText(String text)
text - the textpublic String reassemble()
Copyright © 2011–2019 Danish Maritime Authority. All rights reserved.