All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.esi.metis.aisparser.impl.AISMessage15UnitImpl Maven / Gradle / Ivy

Go to download

This package supports the parsing of AIS messages in Java. AIS, the Automatic Identification System, is a system aiming at improving maritime safety by exchanging messages between ships, other vehicles in particular aircraft involved in search-and-rescue (SAR), and (fixed) base stations. To be precise, this package support the ITU-R M.1371-4 AIS standard. See our extensive javadoc and in particular the class AISParser for more information on how to use this package. The parser was used in the Poseidon project, and is improved in the Metis project to better handle uncertain information. Both projects were led by the Embedded Systems Institute. In both projects Thales Nederlands was the carrying industrial partner, and multiple Dutch universities participated.

The newest version!
package nl.esi.metis.aisparser.impl;

import nl.esi.metis.aisparser.AISMessage15Message;
import nl.esi.metis.aisparser.AISMessage15Unit;
import nl.esi.metis.aisparser.Sixbit;

/**
 * Field Nr     Field Name                          NrOf Bits   (from, to )
 * ------------------------------------------------------------------------
 *  1	destinationID                          	  30	(  0,  29)
 *  2	Message1                                  18	(  30,  47)
 *      "conditional spare"  
 *  3	Message2                              	  18	(  50,  67)
 */
class AISMessage15UnitImpl implements AISMessage15Unit {
	private static final int DESTINATIONID_FROM = 0;
	private static final int DESTINATIONID_TO = 29;

	private int destinationID;
	/** destinationID
	 * @return int value of destinationID1 (30 bits offset+[0,29])
	 */
	public int getDestinationID() { return destinationID; }

	private AISMessage15Message[] messages;
	/** messages
	 * @return AISMessage15Message[] value of messages
	 */
	public AISMessage15Message[] getMessages() { return messages; }


	public AISMessage15UnitImpl (int offset, int nrofMessages, Sixbit content)
	{
		assert(content.length() >= offset + 17 + nrofMessages*20);
		assert(nrofMessages ==1 || nrofMessages ==2);
		destinationID = content.getIntFromTo(offset+DESTINATIONID_FROM,offset+DESTINATIONID_TO);
		messages = new AISMessage15Message[nrofMessages];
		messages[0] = new AISMessage15MessageImpl(offset + 30, content);
		if (nrofMessages == 2 )
		{
			messages[1] = new AISMessage15MessageImpl(offset + 50, content);
		}
		//TODO: should we remove a second message with all parameters set to zero?
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy