use of au.gov.amsa.ais.message.AisPositionGPS in project risky by amsa-code.
the class AisMessageParser method parse.
/**
* Returns an {@link AisMessage} from the string representation of the
* message as per 1371-4 IMO specification (as per the appropriate column in
* the NMEA message).
*
* @param message
* @param source
* @return
*/
public AisMessage parse(String message, String source, int padBits) {
AisExtractor extractor = factory.create(message, 0, padBits);
int id = extractor.getMessageId();
if (Util.isClassAPositionReport(id)) {
return new AisPositionA(message, source, padBits);
} else if (id == 4)
return new AisBaseStation(message, source, padBits);
else if (id == 5)
return new AisShipStaticA(message, source, padBits);
else if (id == 18)
return new AisPositionB(message, source, padBits);
else if (id == 19)
return new AisPositionBExtended(message, source, padBits);
else if (id == 21)
return new AisAidToNavigation(message, source, padBits);
else if (id == AisMessageType.STATIC_DATA_REPORT.getId()) {
int partNumber = AbstractAisBStaticDataReport.extractPartNumber(factory, message, padBits);
return parseStaticDataReport(partNumber, id, message, source, padBits);
} else if (id == 27)
return new AisPositionGPS(message, source, padBits);
else
return new AisMessageOther(id, source, padBits);
}
Aggregations