Giter Club home page Giter Club logo

aislib's Introduction

AisLib Build Status

Introduction

DMA AisLib is a Java library for handling AIS messages. This include

  • Reading from AIS sources e.g. serial connection, TCP connection or file
  • Handling of proprietary source tagging sentences
  • Message filtering like doublet filtering and down sampling
  • Decoding sentences and AIS messages
  • Encoding sentences and AIS messages
  • Sending AIS messages #6, #8, #12 and #14
  • Handling application specific messages

The library contains test code and utility applications demonstrating the use.

Prerequisites

  • Java 8
  • Maven 3

Building

To build

mvn clean install

To run tests

mvn test

NOTE: Temporary manual build procedure described here: #48 (comment).


Developing in Eclipse

Use M2 plugin or

mvn eclipse:eclipse

and import as regular project.

Contributing

You're encouraged to contribute to AisLib. Fork the code from https://github.com/dma-ais/AisLib and submit pull requests.

License

This library is licensed under the Apache License, Version 2.0.

Examples

Simple read and message handling

Reading an AisMessage from an sentence in code is easily done with the Vdm object whether it it is a single message or multiple.

For single messages (AisPositionMessage)
String aisSentence = "!AIVDM,1,1,,A,181:Jqh02c1Qra`E46I<@9n@059l,0*30";

Vdm vdm = new Vdm();
vdm.parse(aisSentence);

AisMessage aisMessage = AisMessage.getInstance(vdm);
For multiple messages (AisMessage5)
String aisSentence1 = "!AIVDM,2,1,9,B,53nFBv01SJ<thHp6220H4heHTf2222222222221?50:454o<`9QSlUDp,0*09"; 
String aisSentence2 = "!AIVDM,2,2,9,B,888888888888880,2*2E";

Vdm vdm = new Vdm();
vdm.parse(aisSentence1);
vdm.parse(aisSentence2);

AisMessage aisMessage = AisMessage.getInstance(vdm);

Reading from files or TCP/UDP connections is very simple with AisLib. In the example below messages are read from a file.

AisReader reader = AisReaders.createReaderFromInputStream(new FileInputStream("sentences.txt"));
reader.registerHandler(new Consumer<AisMessage>() {
	@Override
	public void accept(AisMessage aisMessage) {
		System.out.println("message id: " + aisMessage.getMsgId());
	}
});
reader.start();
reader.join();

Reading using a TCP connection:

AisReader reader = AisReaders.createReader("localhost", 4001);
reader.registerHandler(new Consumer<AisMessage>() {
	@Override
	public void accept(AisMessage aisMessage) {
		System.out.println("message id: " + aisMessage.getMsgId());
	}
});
reader.start();
reader.join();

If the connection is broken the reader will try to reconnect after a certain amount of time that can be set with:

reader.setReconnectInterval(1000);

A read timeout can be defined for the reader. If no data is received within this period the connection will be closed and a reconnect will be tried.

Reading using an UDP connection:

AisReader reader = AisReaders.createUdpReader(8888);
reader.registerHandler(new Consumer<AisMessage>() {
	@Override
	public void accept(AisMessage aisMessage) {
		System.out.println("message id: " + aisMessage.getMsgId());
	}
});
reader.start();
reader.join();

Reading raw message packets

Instead of working with AisMessage objects, it is possible to work with unparsed raw message packets (proprietary tags, comment blocks and VDM's). A packet consumer is registred in a reader.

AisReader reader = AisReaders.createReader("localhost", 4001);
reader.registerPacketHandler(new Consumer<AisPacket>() {
	@Override
	public void accept(AisPacket packet) {
		try {
			AisMessage message = packet.getAisMessage();
		} catch (AisMessageException | SixbitException e) {
			// Handle
            		return;
		}
		// Alternative returning null if no valid AIS message
		AisMessage message = packet.tryGetAisMessage();

		Date timestamp = packet.getTimestamp();
		CommentBlock cb = packet.getVdm().getCommentBlock();
	}
});
reader.start();
reader.join();

Alternatively packets can be read as a packet stream.

Path path = ...
try (AisPacketReader pReader = AisPacketReader.createFromFile(path, true)) {
	AisPacket p;
	while ((p = pReader.readPacket()) != null) {
		count++;
		// Handle packet
		...
	}
}

If the filename has '.zip' suffix decompression will automatically be applied.

Reader factory methods

An AisReader instance is created using factory methods in AisReaders. The following methods can be used.

  • createReader(String hostname, int port) - Creates a reader connection to host:port.
  • createReader(String commaHostPort) - Creates a {@link AisTcpReader} from a list of one or more hosts on the form: host1:port1,...,hostN:portN. If more than one host/port round robin will be used.
  • createUdpReader(int port) - Creates a UDP reader reading from port on any interface.
  • createUdpReader(String address, int port) - Creates a UDP reader reading from port on interface with address.
  • createReaderFromInputStream(InputStream inputStream) - Creates a reader reading from an input stream.
  • createReaderFromFile(String filename) - Creates a reader reading from a file. If the filename suffix is '.zip' or '.gz', zip or gzip decompression will be applied respectively.

Reader group

A collection of readers can be organized in an AisReaderGroup that will deliver packets in a single join packet stream. Sources are defined by a commaseparated list of host:port. If more than one host for each source, round robin reading is used.

List<String> sources = ...
sources.add("s1host1:s1port1,s1host2:s1port2,s1host3:s1port3);
sources.add("s2host1:s1port1,s2host2:s2port2);
...
AisReaderGroup g = AisReaders.createGroup("name", sources);

TBD

Working with messages

To determine what messages are received the instanceof operator can be used. The example below shows how to test and cast, and take advantage of the object oriented design where related messages shares parents.

@Override
public void accept(AisMessage aisMessage) {
	// Handle AtoN message
	if (aisMessage instanceof AisMessage21) {
		AisMessage21 msg21 = (AisMessage21) aisMessage;
		System.out.println("AtoN name: " + msg21.getName());
	}
	// Handle position messages 1,2 and 3 (class A) by using their shared parent
	if (aisMessage instanceof AisPositionMessage) {
		AisPositionMessage posMessage = (AisPositionMessage)aisMessage;
		System.out.println("speed over ground: " + posMessage.getSog());
	}
	// Handle position messages 1,2,3 and 18 (class A and B)
	if (aisMessage instanceof IGeneralPositionMessage) {
		IGeneralPositionMessage posMessage = (IGeneralPositionMessage)aisMessage;
		System.out.println("course over ground: " + posMessage.getCog());
	}
	// Handle static reports for both class A and B vessels (msg 5 + 24)
	if (aisMessage instanceof AisStaticCommon) {
		AisStaticCommon staticMessage = (AisStaticCommon)aisMessage;
		System.out.println("vessel name: " + staticMessage.getName());
	}
}

See UML diagram of messages

Outputting Human Readable JSON

AisMessages can be decoded to human readable JSON messages automatically with a single handler.

String aisSentence = "!AIVDM,1,1,,A,181:Jqh02c1Qra`E46I<@9n@059l,0*30";
Decoder decoder = new Decoder(aisSentence);
String json = decoder.decode(true);

outputs

{
  "msgId": 1,
  "repeatDFO": {
    "ais_value": 0,
    "decoded_text": "Message has been repeated 0 times"
  },
  "userId": 0,
  "navStatusDFO": {
    "ais_value": 0,
    "decoded_text": "Under way using engine"
  },
  "rotDFO": {
    "ais_value": 0,
    "decoded_text": "Turning right at 0.0 degrees/ min"
  },
  "sogDFO": {
    "ais_value": 171,
    "decoded_text": "17.1 knots"
  },
  "posAccDFO": {
    "ais_value": 0,
    "decoded_text": "Low (> 10 m) (default)"
  },
  "position": {
    "latitude": 36.8121133,
    "longitude": 21.3901667
  },
  "cogDFO": {
    "ais_value": 3136,
    "decoded_text": "313.6 degrees"
  },
  "trueHeadingDFO": {
    "ais_value": 315,
    "decoded_text": "315 degrees"
  },
  "utcSecDFO": {
    "ais_value": 8,
    "decoded_text": "8"
  },
  "specialManIndicatorDFO": {
    "ais_value": 0,
    "decoded_text": "Not available"
  },
  "raimDFO": {
    "ais_value": 0,
    "decoded_text": "Raim not in use"
  },
  "syncStateDFO": {
    "ais_value": 0,
    "decoded_text": "Utc direct"
  }
}

With the decoder you can also pass in any AisMessage data type for the same result

Multiple sources

The example below shows how messages from multiple sources can be handled by a single handler.

// Make a handler
Consumer<AisMessage> handler = new Consumer<AisMessage>() {
	@Override
	public void accept(AisMessage aisMessage) {
		System.out.println("aisMessage: " + aisMessage);
	}
};

// Make readers and register handler
AisReader reader1 = AisReaders.createReader("host1", 4001);
AisReader reader2 = AisReaders.createReader("host2", 4001);
AisReader reader3 = AisReaders.createReader("host3", 4001);
reader1.registerHandler(handler);
reader2.registerHandler(handler);
reader3.registerHandler(handler);

// Start readers
reader1.start(); reader2.start(); reader3.start();

Alternatively an AisReaderGroup can be used.

Round robin reading

The example below shows how to round robin between TCP hosts. If one goes down, the re-connect will be to the next on the list.

AisReader reader = AisReaders.createReader("host1:port1,host2:port2,host3:port3");
reader.registerHandler(new Consumer<AisMessage>() {
	@Override
	public void accept(AisMessage aisMessage) {
		System.out.println("message id: " + aisMessage.getMsgId());
	}
});
reader.start();
reader.join();

Message filtering

Message filters implement a single method

 boolean rejectedByFilter(AisMessage message);

Down sample example:

AisReader reader = AisReaders.createReader("ais163.sealan.dk:4712");
reader.registerHandler(new Consumer<AisMessage>() {
	DownSampleFilter downSampleFilter = new DownSampleFilter(60);
	@Override
	public void accept(AisMessage aisMessage) {
		if (downSampleFilter.rejectedFilter(aisMessage)) {
			return;
		}
		// Handle message
	}
});
reader.start();
reader.join();

A MessageHandlerFilter can be used to put in between readers and handlers. In the example below two filters are used. A doublet filter and a down sampling filter.

Consumer<AisMessage> handler = new Consumer<AisMessage>() {
	@Override
	public void accept(AisMessage aisMessage) {
		// Handle doublet filtered down sampled messages
	}
};

// Make down sampling filter with sampling rate 1 min and
// make handler the recipient of down sampled messages
MessageHandlerFilter downsampleFilter = new MessageHandlerFilter(new DownSampleFilter());
downsampleFilter.registerReceiver(handler);

// Make doublet filter with default window of 10 secs.
// Set down sample filter as recipient of doublet filered messages
MessageHandlerFilter doubletFilter = new MessageHandlerFilter(new DuplicateFilter());
doubletFilter.registerReceiver(downsampleFilter);

// Make reader
AisReader reader = AisReaders.createReader(host, port);
reader.registerHandler(doubletFilter);
reader.start();

Expression based packet filtering

It is also possible to perform packet filtering based on packet sources and contents using free-text expressions. These expressions must comply with a specified grammar.

Using the filter

The expression filter can be used programmatically like this:

Filtering on packets source
import static dk.dma.ais.packet.AisPacketFiltersExpressionFilterParser.parseExpressionFilter;
...
parseExpressionFilter("s.country = DNK & s.type = LIVE").test(aisPacket);

In this example the test method wll return true for all packets received from a source in Denmark ('DNK') and coming from a terrestrial source (typically a VHF base station as opposed to e.g. data received via satellite). For packets coming sources not fulfilling this expression the test method will return false.

Filtering on source attributes is indicated by the 's' in front of the field ('country').

Filtering on message contents
import static dk.dma.ais.packet.AisPacketFiltersExpressionFilterParser.parseExpressionFilter;
...
parseExpressionFilter("m.pos witin circle(37.9121, -122.4229, 2000)").test(aisPacket);

In this example the test method will return false for packets containing a position outside a cartesian circle centered in 37.912 degrees north (37ยฐN54'44"), 122.4229 degrees west (22ยฐW25'22"), and with a radius of 2000 meters. For other packets (including packets without any position information) the method will return true.

Filtering on message (~packet) attributes is indicated by the 'm.' in front of the field ('pos').

Filtering on targets

In some cases it is insufficient to filter on packet sources and content alone. For instance it may be desirable to block AIS packets with static and voyage related data (see class AisStaticCommon) for vessels which are outside a given area. Since the AisStaticCommon messages do not contain any position information, it is not possible to filter on these packets alone.

Instead, it is possible to use an expression filter which will "remember" all AIS packets it has previously been served. It uses these messages to track all AIS targets and keep a cache of the latest known positions, speeds, and other characteristis. This why, it is possible to filter on the target's characteristics rather than the latest packet received.

As an example:

import static dk.dma.ais.packet.AisPacketFiltersExpressionFilterParser.parseExpressionFilter;
...
parseExpresionFiter("t.sog > 10").test(aisPacket);

Of all packets send to the test-method only those which are related to a vesel with a speed over ground larger than 10 knots will result in true being returned from test. This is true even for e.g. AIS messages of type 5 which contain no speed information.

Filtering on target attributes is indicated by the 't.' in front of the field ('sog').

Example application

An example of an existing application which uses the expression filter is AisFilter which is based on main class dk.dma.ais.utils.filter.AisFilter:

java dk.dma.ais.utils.filter.Aisilter -t localhost:4001 -exp ".sog in 2..8"

This will make the application connect via TCP to localhost:4001 to receive AIS packets, filter them using the supplied expression (so that packets with speed over ground outside the range 2 to 8 knots are rejected), and output the remaining packets on the standard output.

Grammar

The full grammar is specified usit ANTLR notation in file expresionFilter.g4.

The following are examples of filter expressions:

Simple comparisons
  • m.sog = 0
  • m.sog != 0
  • m.sog > 6.0
  • m.sog < 7.0
  • m.sog >= 6.6
  • m.sog <= 6.6
In lists
  • m.month = jan,feb,mar

  • m.month = (jan,feb,mar)

  • m.month in jan,feb,mar

  • m.month in (jan,feb,mar)

  • m.month @ jan,feb,mar

  • m.month @ (jan,feb,mar)

  • m.mmsi in 220431000,220435325,220430999

  • m.mmsi in (220431000,220435325,220430999)

  • m.month != jan,feb,mar

  • m.month != (jan,feb,mar)

  • m.month not in jan,feb,mar

  • m.month not in (jan,feb,mar)

  • m.month !@ jan,feb,mar

  • m.month !@ (jan,feb,mar)

  • m.mmsi not in 220431000,220435325,220430999

  • m.mmsi not in (220431000,220435325,220430999)

In ranges
  • m.id = 5..15

  • m.id in 5..15

  • m.id in (5..15)

  • m.id @ (5..15)

  • m.id != 5..15

  • m.id not in 5..15

  • m.id !@ (5..15)

Within geographical areas
  • m.pos within circle(37.9058, -122.4310, 1000)
  • m.pos within bbox(37.9058, -122.4310, 37.9185, -122.4149)
With string resembling glob
  • m.name like D*
  • m.name LIKE DI*
  • m.name LIKE DI?NA
  • m.name ~ D*A
  • m.name ~ 'DIA*'
Named values
  • m.type = TANKER
  • m.type = military
  • m.type in MILITARY, TANKER, HSC, FISHING
  • m.type in 'tanker', 'military', HSC
Composite expressions with boolean and/or
  • m.id = 1 & m.sog >= 6.1 & m.sog <= 6.9
  • m.sog > 6.6 | m.sog < 6.4
  • m.sog > 6.6 & m.sog < 6.7
  • s.type=SAT|s.id=AISD|s.id=MSSIS
Fields

The following fields can be used in filter expressions

Group Field Meaning Example values
sources s.id Source id
       | s.bs      | Source base station        |
       | s.country | Source country             | DNK
       | s.type    | Source type                | LIVE, SATย 
       | s.region  | Source region              | 0

|
|
|
messages | m.id | Message type | 1, 2, 3, 5 | m.mmsi | MMSI number | 219010123 | m.year | Msg recv'd in year | 2014 | m.month | Msg recv'd in month | jan, january, 1 | m.dom | Msg recv'd on day-of-month | 1, 31 | m.dow | Msg recv'd on day-of-week | mon, monday, 1 | m.hour | Msg recv'd on hour | 14 | m.minute | Msg recv'd on minute | 34
|
|ย 
ย |
| m.imo | IMO number | 6159463 | m.type | Ship type | tanker, 32 | m.navstat | Navigational status | AT_ANCHOR, 1 | m.name | Ship name | Maersk Alabama | m.cs | Radio call sign | XP1234 | m.sog | Speed over ground | 10.0 | m.cog | Course over ground | 234 | m.hdg | True heading | 180 | m.draught | Current draught | 4.6 | m.lat | Latitude | 56.1234 | m.lon | Longitude | 12.4321 | m.pos(*) | Position | (56.1234, 12.4321)
|
|
|
targets | t.imo | IMO number | 6159463 | t.type | Ship type | tanker, 32 | t.navstat | Navigational status | AT_ANCHOR, 1 | t.name | Ship name | Maersk Alabama | t.cs | Radio call sign | XP1234 | t.sog | Speed over ground | 10.0 | t.cog | Course over ground | 234 | t.hdg | True heading | 180 | t.draught | Current draught | 4.6 | t.lat | Latitude | 56.1234 | t.lon | Longitude | 12.4321 | t.pos(*) | Position | (56.1234, 12.4321)

(*) pos is represents same values as (lat, lon) but is used in contexts where complete position (not just latitude or longitude) is used.

Packet transformers

TBD. See dk.dma.ais.transform.*, dk.dma.ais.transform.TransformTest and dk.dma.ais.packet.AisPacketTagsTest.

Reading proprietary tags

AisLib can handle some proprietary tags inserted before VDM sentences, but implementations of factories must be given. In the example below Gatehouse source tags are handled.

Proprietary factories are defined in the file

ais-lib-messages/src/main/resources/META-INF/services/dk.dma.ais.proprietary.ProprietaryFactory
AisReader reader = AisReaders.createReaderFromInputStream(new FileInputStream("sentences.txt"));
reader.registerHandler(new Consumer<AisMessage>() {
	@Override
	public void accept(AisMessage aisMessage) {
		if (aisMessage.getSourceTag() != null) {
			IProprietarySourceTag sourceTag = aisMessage.getSourceTag();
			System.out.println("timestamp: " + sourceTag.getTimestamp());
		}
	}
});
reader.start();
reader.join();

AIS metadata

Besides from propritary tags, comment blocks carry metadata about the VDM sentences carrying the AIS message.

The example below shows how to handle comment blocks.

AisReader reader = ...
reader.registerPacketHandler(new Consumer<AisPacket>() {
    @Override
    public void accept(AisPacket aisPacket) {
    	Vdm vdm = packet.getVdm();
        if (vdm == null) {
            return;
        }
        CommentBlock cb = vdm.getCommentBlock();
        if (cb != null) {
        	String source = cb.getString();
        	Long cbTimestamp = cb.getTimestamp();
        }
    }
});
reader.start();
reader.join();

Common metadata has been standardized in the class AisPacketTags. The following attributes are used:

  • Timestamp
  • Source id
  • Source basestation
  • Source country (ISO three letter)
  • Source type SAT | LIVE

Example

AisPacketTags tags = packet.getTags();
Assert.assertEquals(tags.getTimestamp().getTime(), 1354719387000L);
Assert.assertEquals(tags.getSourceId(), "SISSM");
Assert.assertEquals(tags.getSourceBs().intValue(), 2190047);
Assert.assertEquals(tags.getSourceCountry().getThreeLetter(), "DNK");

Full timestamp of VDM sentences are done in different proprietary fashions. AisLib tries to get the timestamp in three ways

  1. Comment block key 'c'
  2. Gatehouse propritary source tag
  3. MSSIS timestamp appended to VDM sentence (the first occurence of a timestamp is used)

The timestamp is retrived from a packet using the following

Packet packet = ...
Date timestamp = packet.getTimestamp();

AisBus

TBD. See dk.dma.ais.bus.AisBusTest.

Sending a message

Example of sending an addressed text message in an ABM sentence. See test cases on how to send application specific message. See AisReader for different sending options. In the example below all ABM packaging is handled by AisReader.

AisReader aisReader = AisReaders.createReader(host, port);
aisReader.start();
...
// Make AIS message 12
AisMessage12 msg12 = new AisMessage12();
msg12.setDestination(destination);
msg12.setMessage(message);

// Send using a blocking call
Abk abk = aisReader.send(msg12, 1, destination);
if (abk.isSuccess()) {
	...
} else {
	...
}

aislib's People

Contributors

babisk avatar borchsenius avatar bushaev avatar christopherlakey avatar clupprich avatar darius-wattimena avatar dependabot[bot] avatar dimitrispallas avatar dvm-ed avatar githubcx avatar jenstuxen avatar johnmartel avatar kaspernielsen avatar kottmann avatar mablae avatar mikaelulvesjo avatar mvlcek avatar oteken avatar peder280370 avatar rutsky avatar sastafford avatar serializingme avatar steen-elv avatar tbsalling avatar tejl avatar wojciechk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aislib's Issues

cannot complete build using manual build process

good evening; cannot complete the build process using the instructions from #48 (comment)

E:\development\opt\nbspace-mars\AisLib\AisLib>mvn -e clean install -DargLine="-Djdk.net.URLClassPath.disableClassPathURLCheck=true"
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for dk.dma.ais.lib:ais-lib-messages:jar:2.4
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. @ dk.dma.ais.lib:ais-parent:2.4, E:\development\opt\nbspa
ce-mars\AisLib\AisLib\pom.xml, line 70, column 14
[WARNING]
[WARNING] Some problems were encountered while building the effective model for dk.dma.ais.lib:ais-lib-communication:jar:2.4
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. @ dk.dma.ais.lib:ais-parent:2.4, E:\development\opt\nbspa
ce-mars\AisLib\AisLib\pom.xml, line 70, column 14
[WARNING]
[WARNING] Some problems were encountered while building the effective model for dk.dma.ais.lib:ais-lib-utils:jar:2.4
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. @ dk.dma.ais.lib:ais-parent:2.4, E:\development\opt\nbspa
ce-mars\AisLib\AisLib\pom.xml, line 70, column 14
[WARNING]
[WARNING] Some problems were encountered while building the effective model for dk.dma.ais.lib:ais-lib-cli:jar:2.4
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. @ dk.dma.ais.lib:ais-parent:2.4, E:\development\opt\nbspa
ce-mars\AisLib\AisLib\pom.xml, line 70, column 14
[WARNING]
[WARNING] Some problems were encountered while building the effective model for dk.dma.ais.lib:ais-lib-json:jar:2.4
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. @ dk.dma.ais.lib:ais-parent:2.4, E:\development\opt\nbspa
ce-mars\AisLib\AisLib\pom.xml, line 70, column 14
[WARNING]
[WARNING] Some problems were encountered while building the effective model for dk.dma.ais.lib:ais-parent:pom:2.4
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. @ line 70, column 14
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] AIS Parent [pom]
[INFO] AIS Messages [jar]
[INFO] AIS Communication [jar]
[INFO] AIS utils [jar]
[INFO] AisLib CLI [jar]
[INFO] AIS JSON Decoders [jar]
[INFO]
[INFO] ---------------------< dk.dma.ais.lib:ais-parent >----------------------
[INFO] Building AIS Parent 2.4 [1/6]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ ais-parent ---
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M2:enforce (enforce-maven) @ ais-parent ---
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ ais-parent ---
[INFO] Installing E:\development\opt\nbspace-mars\AisLib\AisLib\pom.xml to C:\Users\ssdhaliwal.m2\repository\dk\dma\ais\lib\ais-parent\2.4\ais-parent-2.4.pom
[INFO]
[INFO] ------------------< dk.dma.ais.lib:ais-lib-messages >-------------------
[INFO] Building AIS Messages 2.4 [2/6]
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for dk.dma.commons:dma-commons-util:jar:0.5-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for AIS Parent 2.4:
[INFO]
[INFO] AIS Parent ......................................... SUCCESS [ 0.864 s]
[INFO] AIS Messages ....................................... FAILURE [ 0.114 s]
[INFO] AIS Communication .................................. SKIPPED
[INFO] AIS utils .......................................... SKIPPED
[INFO] AisLib CLI ......................................... SKIPPED
[INFO] AIS JSON Decoders .................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.753 s
[INFO] Finished at: 2020-06-22T22:04:42-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project ais-lib-messages: Could not resolve dependencies for project dk.dma.ais.lib:ais-lib-messages:jar:2.4: Failure to find
dk.dma.commons:dma-commons-util:jar:0.5-SNAPSHOT in http://oss.sonatype.org/content/repositories/snapshots was cached in the local repository, resolution will n
ot be reattempted until the update interval of oss.sonatype.org-snapshot has elapsed or updates are forced -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project ais-lib-messages: Could not resolve dependencies for project dk.dma.ai
s.lib:ais-lib-messages:jar:2.4: Failure to find dk.dma.commons:dma-commons-util:jar:0.5-SNAPSHOT in http://oss.sonatype.org/content/repositories/snapshots was c
ached in the local repository, resolution will not be reattempted until the update interval of oss.sonatype.org-snapshot has elapsed or updates are forced
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies (LifecycleDependencyResolver.java:269)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies (LifecycleDependencyResolver.java:147)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved (MojoExecutor.java:248)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:202)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project dk.dma.ais.lib:ais-lib-messages:jar:2.4: Failure t
o find dk.dma.commons:dma-commons-util:jar:0.5-SNAPSHOT in http://oss.sonatype.org/content/repositories/snapshots was cached in the local repository, resolution
will not be reattempted until the update interval of oss.sonatype.org-snapshot has elapsed or updates are forced
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve (DefaultProjectDependenciesResolver.java:209)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies (LifecycleDependencyResolver.java:243)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies (LifecycleDependencyResolver.java:147)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved (MojoExecutor.java:248)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:202)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.eclipse.aether.resolution.DependencyResolutionException: Failure to find dk.dma.commons:dma-commons-util:jar:0.5-SNAPSHOT in http://oss.sonatype.
org/content/repositories/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of oss.sonatype.org-snapshot
has elapsed or updates are forced
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies (DefaultRepositorySystem.java:357)
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve (DefaultProjectDependenciesResolver.java:202)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies (LifecycleDependencyResolver.java:243)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies (LifecycleDependencyResolver.java:147)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved (MojoExecutor.java:248)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:202)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Failure to find dk.dma.commons:dma-commons-util:jar:0.5-SNAPSHOT in http://oss.sonatype.or
g/content/repositories/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of oss.sonatype.org-snapshot h
as elapsed or updates are forced
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve (DefaultArtifactResolver.java:424)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts (DefaultArtifactResolver.java:229)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies (DefaultRepositorySystem.java:340)
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve (DefaultProjectDependenciesResolver.java:202)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies (LifecycleDependencyResolver.java:243)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies (LifecycleDependencyResolver.java:147)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved (MojoExecutor.java:248)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:202)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Failure to find dk.dma.commons:dma-commons-util:jar:0.5-SNAPSHOT in http://oss.sonatype.org/co
ntent/repositories/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of oss.sonatype.org-snapshot has e
lapsed or updates are forced
at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException (DefaultUpdateCheckManager.java:218)
at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact (DefaultUpdateCheckManager.java:193)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads (DefaultArtifactResolver.java:559)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads (DefaultArtifactResolver.java:483)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve (DefaultArtifactResolver.java:401)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts (DefaultArtifactResolver.java:229)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies (DefaultRepositorySystem.java:340)
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve (DefaultProjectDependenciesResolver.java:202)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies (LifecycleDependencyResolver.java:243)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies (LifecycleDependencyResolver.java:147)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved (MojoExecutor.java:248)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:202)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :ais-lib-messages

E:\development\opt\nbspace-mars\AisLib\AisLib>

Multiple Line Messages

Does this API support messages that are more than one line long? It looks like it should in the SentenceLine.java class but I cannot figure out how to send the encoded data into it to make it work. Perhaps documentation or code comments to suppliment?

Group tag block is only partially read since 0bba7e1

The properties on CommentBlockLine besides the parameterMap (e.g. groupId) aren't populated anymore since commit "Correct parsing of the messages in comment block parameters that contains G and g" / 0bba7e1. I discovered this when upgrading in a unit test that checked those values on example nmea lines.

I don't understand that commit. The commit message claims it affects lines containing g and G, but it actually acts on comments that start with \g:. And the new code seems to be an alernative implementation of the same thing (extract tag keys and values, old code by iteration, new code using String.split), with the difference that it skips handling g, G specially, checksum handling and group-id.

From my understanding the old code was working correctly, however I assume something was fixed by that commit - could you please explain what that is.

AisLib 2.3 release?

Hi

It is 10 months since 2.2 release, my question is when 2.3 is due to be released.
I know that there are not any big changes but I need the two I have sent pull requests on ( #18 and #23 ).

Serial Connection?

The README Introduction suggests AisLib can handle AIS data arriving on a serial connection. Yet I don't see any classes anywhere that do indeed handle serial. Am I missing something here? I know Java's serial reading support is not perfect, and myself have used rxtx in the past, so expected to see use of that lib or similar in the AisLib dependency tree.

VDM parser and decimal places

Hello,

I've been looking at AisLib, specially the vdm parser and have some questions regarding decimal values.
When parsing latitude/longitude i get int/long but there is a field resolution which i believe can be used to obtain the proper value of lat/lon. For other cases i don't see the same, things like rog, sog, heading, etc. How can i know the decimal parts? Is it like a convention that, example, the first 2 digits are the integer part and the others the decimal?
If you could point me to some documentation, that would help.

AisMessage27 does not encode gnssPosStatus

AisMessage27::getEncoded returns a SixbitEncoder with 95 bits, missing the 1 bit gnssPosStatus field. Given AisMessage27::parse expects a BinArray with 96 bits, and reads gnssPosStatus, it seems this was an accidental omission, and it likely missed discovery due to #38.

Ais Message 1 not parsed properly

Following is the message I'm trying to parse:
!BSVDM,1,1,,B,33@nl?@01EPk<FDPw<2qW7`B07kh,0*5E

However, I keep getting an exception because the binArray is less than 168 in length. All other online decoders, decode this message properly.

Following is my code:

String msgNmea = "!BSVDM,1,1,,B,33@nl?@01EPk<FDPw<2qW7`B07kh,0*5E";
AisPacket packet = AisPacket.readFromString(msgNmea);
AisMessage msg = packet.tryGetAisMessage();

AisMessage1 msg1 = new AisMessage1(msg.getVdm());

Outdated README

In the last section of the README file (Sending a message), the AisTcpReader is created with:

AisReader aisReader = new AisTcpReader(host, port);

But it's not working with the last version, it should be:

AisReader aisReader = AisReaders.createReader(host, port);

AisMessage19 has duplicate property names AisStaticCommon

AisMessage19 has duplicate property names/is hiding several protected properties of its super class AisStaticCommon.
I consider this a bug since

  1. it breaks json serialization libraries such as Gson for no good reason.
  2. it is bad practice.

Out of sequence Error

Can someone tell me why I'm getting a sentence out of order error for the following messages?? This error happens on about 10% of my multi-line messages, and appears to be random.

Error is at dk.dma.ais.sentence.EncapsulatedSentence.baseParse(EncapsulatedSentence.java:98) (sorry, markup is affecting the strings, please see the attached text file)

multiline-errors.txt

Failed to parse AIS message: [!AIVDM,2,1,2,B,5815Lcp2DqaeKL7;O;45<j1=Tm0PtqV222222216ChPF:5oA0N5Dp40m888,0\*08, !AIVDM,2,2,6,B,p0kk3k8880,2*61]
dk.dma.ais.sentence.SentenceException: Out of sequence sentence: !AIVDM,2,2,6,B,p0kk3k`8880,2*61

Failed to parse AIS message: [!AIVDO,2,1,3,B,5EAP2F000000h5FT4MD4MD6222222222222220m0h:32000000<`0@0000,0*69, !AIVDO,2,2,4,B,88888888880,2*21]
dk.dma.ais.sentence.SentenceException: Out of sequence sentence: !AIVDO,2,2,4,B,88888888880,2*21

Failed to parse AIS message: [!AIVDO,2,1,2,B,5EATk202=WLC222222222222221I<P:66400050UCRiDRCQs,0*60, !AIVDO,2,2,5,A,88888888880,2*23]
dk.dma.ais.sentence.SentenceException: Out of sequence sentence: !AIVDO,2,2,5,A,88888888880,2*23

Failed to parse AIS message: [!AIVDO,2,1,0,B,5C9QRdP2>MRL@@tc:21HDL60ITpDr2222222221702D0G5eC0>l0@m0`8888,039, !AIVDO,2,2,2,B,@PC0ShH8880,20F]
dk.dma.ais.sentence.SentenceException: Out of sequence sentence: !AIVDO,2,2,2,B,@PC0ShH8880,2*0F

AisLib v2.4 published with invalid dependencies to maven central repo

In the ais-parent-2.4 POM as being release and published to central maven repos, the dependency towards

  • dk.dma.enav:enav-util is defined with property dependencies.enav.version=0.6-SNAPSHOT and
  • dk.dma.commons:dma-commons-util is defined with property dependencies.dma.commons.version=0.5-SNAPSHOT

Please note the "-SNAPSHOT" suffixes, those are wrong. No such versions were published to maven central repos obviously, but the final ones, 0.6 (enav-util) and 0.5 (dma-commons-util).

This makes projects depending on AisLib 2.4 to fail on maven build.

This was fixed meanwhile with commit "Update dependencies" (8190d2c). But one is unable to pull the dependencies from the public maven repos as defined for the released version 2.4.

Please create and publish a new release having this fixed.

Message 24, Mothership MMSI

According to http://gpsd.berlios.de/AIVDM.html for auxiliary crafts, the mothership MMSI is transferred instead of the dimensions. Any support planned?

In order to read data in an extended Message class the message parsing should be done in parse(binArray), not parse() and BinArray should include methods reset() and skip(bits). Currently it is not practical to do the change in an extended class.

Build Issues

image

Today I downloaded and attempted to compile and got the error you see in the screenshot I took. Following the advice of the admin here:

#48

I am able to compile without issue using the following commands...

git clone https://github.com/dma-dk/dma-developers.git
cd dma-developers/rootpom/
mvn clean install -DskipTests
cd ../..
git clone https://github.com/dma-enav/e-Navigation.git
cd e-Navigation/
mvn clean install -DskipTests
cd ..
git clone https://github.com/dma-dk/dma-commons.git
cd dma-commons/
mvn clean install -DskipTests
cd ..
git clone https://github.com/kaspernielsen/codegen.git
cd codegen
mvn clean install -DskipTests
cd ..
git clone https://github.com/MaritimeConnectivityPlatform/MaritimeCloud.git
cd MaritimeCloud
sed -i 's/0.1/0.8-SNAPSHOT/' mc-msdl/mc-msdl-javagenerator/pom.xml
mvn clean install -DskipTests
cd ..
git clone https://github.com/dma-ais/AisLib.git
cd AisLib/
mvn clean install -DskipTests

Is there still an issue with the artifacts for this project? I'm on Centos 7.6 and I'm running maven v3.6.2.

What is destination?

From the examples, to send a message we need to do something like this:

var aisReader = AisReaders.createReader(host, port);
aisReader.start();

// Make AIS message 12
AisMessage12 msg12 = new AisMessage12();
msg12.setDestination(destination);
msg12.setMessage("Hello");

But what is destination and how to use it?

About AisReaders.class

Hey i downloaded jar of AisLib so, i was trying to execute all given example by you.
but i got to know in my jar AisReader class is not there when i was trying to create UPD of tcp connection to get MSG.
i am unable to do it please suggest me somthing

AisTcpReader has incomplete inheritance semantics

AisTcpReader has protected fields as well as important methods such as run() and connect(), indicating that it is intended to be inherited. But it has no way for an inheriting class to actually connect to a remote server as addHostPort() is package-private. This makes extending this class practically impossible.

The same applies for similar classes such as AisStreamReader.

Message Type 25 Not Implemented

I'm processing a satellite AIS feed (global coverage) and quite often we receive AIS Message 25 which fails to parse with an exception. Given that this is a valid AIS Message type I would think it should probably be implemented (unless there is a good reason not to).

Message24 modern format

With new ITU spec (version 5) which came out in 2014, Message24 part B has been changed, compared to previous version. Specifically last 6 bits of part B message had been spare bits, but with version 5 first 4 bits are now indicating epfd filled. Should AisLib be updated for these changes ? I'd be happy to do a pull-request.

fasterxml/jackson dependency update?

I've been trying to pipe AIS messages into AWS kinesis using the AisLib library (which is fantastic by the way - thank you!) and the AWS sdk (aws-java-sdk-bom, version 1.11.220). Consuming the messages using AisLib works great but the code fails on the aws sdk code calls. It seems the aws sdk probably uses a more updated version of fasterxml:

Exception in thread "main" java.lang.NoSuchMethodError: com.fasterxml.jackson.annotation.JsonProperty.access()Lcom/fasterxml/jackson/annotation/JsonProperty$Access;

When I build the project, the version of fasterxml installed is 2.4

<classpathentry kind="var" path="M2_REPO/com/fasterxml/jackson/core/jackson-annotations/2.4.0/jackson-annotations-2.4.0.jar"/>

It looks like 2.9.2 is the most up to date version, although I don't know which version the aws sdk is using. Are there plans to update the version of fasterxml/jackson that is being used? Or can you suggest a workaround that I could use?

Another error : AisLib building

I tried your solution on a closed issue "AisLib is not building". The different error came up.

[INFO] Scanning for projects...
Downloading from dma-releases: http://repository-dma.forge.cloudbees.com/release/dk/dma/dma-root-pom/24/dma-root-pom-24.pom
Downloading from central: https://repo.maven.apache.org/maven2/dk/dma/dma-root-pom/24/dma-root-pom-24.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for dk.dma.ais.lib:ais-parent:2.4-SNAPSHOT: Could not transfer artifact dk.dma:dma-root-pom:pom:24 from/to dma-releases (http://repository-dma.forge.cloudbees.com/release/): repository-dma.forge.cloudbees.com and 'parent.relativePath' points at wrong local POM @ line 5, column 10
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project dk.dma.ais.lib:ais-parent:2.4-SNAPSHOT (C:\Users\Kafilah\AisLib\pom.xml) has 1 error
[ERROR] Non-resolvable parent POM for dk.dma.ais.lib:ais-parent:2.4-SNAPSHOT: Could not transfer artifact dk.dma:dma-root-pom:pom:24 from/to dma-releases (http://repository-dma.forge.cloudbees.com/release/): repository-dma.forge.cloudbees.com and 'parent.relativePath' points at wrong local POM @ line 5, column 10: Unknown host repository-dma.forge.cloudbees.com -> [Help 2]
[ERROR]

Thanks

Regards,
Oki

Unconditional branch in EncodeTest::aisDecodeEncode

The following branch in EncodeTest::aisDecodeEncode is unconditional and prevents the test from verifying any message encodings:

if (!(msg instanceof AisPositionMessage) || !(msg instanceof AisMessage4)
        || !(msg instanceof AisStaticCommon)) {
    vdm = new Vdm();
    continue;
}

The branch is unconditional because the three classes are mutually exclusive subclasses of AisMessage, and the condition is equivalent to testing if msg is an instance of all three:

!(msg instanceof AisPositionMessage && msg instanceof AisMessage4
        && msg instanceof AisStaticCommon)

It appears the intention was:

if (!(msg instanceof AisPositionMessage || msg instanceof AisMessage4
        || msg instanceof AisStaticCommon)) {
    vdm = new Vdm();
    continue;
}

However, the purpose of this is conditional expression is unclear, so I cannot be certain this is correct.

Note:

Due to #35, the change above causes an exception when the test is executed, as one of the later statements calls msg.getEncoded() on an instance of AisMessage24.

AisLib packet.getTimestamp is null when used in spark environment

Hi,
I am using AisLib to parse Ais Messages in a apache spark environment backed by HDFS.
I am using few simple steps like

  1. parse the message.
  2. map only the timestamp and UserId of each message.
  3. Save it to HDFS.
    Result: I see that my timestamp(Date field) is null all along.
    PS: When I pretty print only few of my messages of the RDD the result looks just fine.

Question: Message Filtering

Hello dear Devs,

If I setup multiple readers without a AisReaderGroup and then register the same doupletFilter handler to all of them, are the messages synced?!

Like messageA sent to readerA is the same as messageA sent to readerB, would it be filtered out?! Or do I need both readers in a AisReaderGroup ?!

I am trying to listen on UDP Port for incoming Packets on that ports and additonally have some TCP Readers in ClientMode.

I am just building some Kind of AisUdpServer for that purpose. Are you interested in a PR for that?!

For the moment I created a UdpInputStream class because UdpDatagram does not have getInputStream() method like Socket has.

My weekend work will be intgrating UdpServerReader in ais-lib structure and extend from AisReader

Thanks in advance!

mablae

All is broken

Can't build or use the Maven version. Is there any alternative to this ?

Encoding ROT in messages 1,2,3

When encoding AIS messages using AisLib, (specifically for AIS Message 1,2,3). There's an inconsistency in ROT (Rate of Turn) value encoding and decoding. Despite setting ROT to a specific value (e.g., -4), the encoded message returns a different value (e.g., 1) after decoding.
Could you please confirm whether this inconsistency stems from a misuse of the library on my end, or is it an issue with the library?

Decoder null pointer exception with AIS message type 5

I found, what I believe, to be a bug while trying to decode ais 5 message type.
It seems if ETA is not present the decoder will not output a result and will return null due to a null pointer exception. Below you can see

image

image

AisLib is not building

While trying to build AisLib with maven, using the following command:
mvn clean install
I encountered some errors about the repository for parent pom project not being available:

[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for dk.dma.ais.lib:ais-parent:2.4-SNAPSHOT: Could not find artifact dk.dma:dma-root-pom:pom:24 in dma-releases (http://repository-dma.
forge.cloudbees.com/release/) and 'parent.relativePath' points at wrong local POM @ line 5, column 10
 @
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project dk.dma.ais.lib:ais-parent:2.4-SNAPSHOT (/home/bushaev/dev/ais/AisLib/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for dk.dma.ais.lib:ais-parent:2.4-SNAPSHOT: Could not find artifact dk.dma:dma-root-pom:pom:24 in dma-releases (http://repository-
dma.forge.cloudbees.com/release/) and 'parent.relativePath' points at wrong local POM @ line 5, column 10 -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

Sending messages as a server

In our use case we want to set up a server for sending AIS message to 1 or more clients.
The server obtains the AIS data from a simulator. The messages are converted in the AIS format ans transmitted to any connected client. The client can be an operational system.

There is one small example at the end of the readme file using the AisTcpReader that sends a message to a given client with a known host and port number. We couldn't make this example working but we also searching for a simple setup for our use case. Can you provide an example on how to do this ?

Error creating reader? Guava?

Hi,

Using AisLib for the first time, the build process seemed to work well, but upon creating the reader I'm getting an error:

(AisReader reader = AisReaders.createReader("localhost", 4001);)

Exception in thread "Thread-0" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;I)V
at com.google.common.net.HostAndPort.fromParts(HostAndPort.java:143)
at dk.dma.ais.reader.AisReaders.createReader(AisReaders.java:92)

Googling, seems like the culprit could be Guava, the version 21 is the one which seemed to have been installed... Is this a result from something on my end (used M2Eclipse to import and build) or is this an issue with AisLib and its dependencies?

Thanks!

Ha... It appears that it's caused by a class conflict, when run with only the jars generated by this project it works, but not within my greater project... So it's not an issue with AisLib.

AisMessage::getEncoded is largely untested

The test suite does not cover the getEncoded method of most messages, and the tests which call that method are heavily obfuscated, making it unclear what messages are being tested without debugging the tests as they run.
During debugging, aisDecodeEncode only tested getEncoded in messages 1, 3, 4, 5, and 24 (assuming the changes in #37), and the rest of EncodeTest only covered getEncoded in the above messages and message 12. Overall, only messages 1, 3, 4, 5, 6, 8, 12, 18, and 24 had their getEncoded methods called in any test methods.

Decoder issue with user Id (MMSI) and MsgId

When i run the sample in your documentation:

`Vdm vdm = new Vdm();

    vdm.parse("!AIVDM,2,1,9,B,53nFBv01SJ<thHp6220H4heHTf2222222222221?50:454o<`9QSlUDp,0*09");
    vdm.parse("!AIVDM,2,2,9,B,888888888888880,2*2E");
    
    AisMessage message = AisMessage.getInstance(vdm);
    Decoder decoder = new Decoder(message);
    String json = decoder.decode(false);
    System.out.println(json);`

I get the following

{"msgId":0,"repeatDFO":{"ais_value":0,"decoded_text":"Message has been repeated 0 times"},"userId":0,"callsign":"LFNA ","name":"FALKVIK ","shipTypeDFO":{"ais_value":79,"decoded_text":"Cargo-no-additional-information"},"dimBowDFO":{"ais_value":40,"decoded_text":"Distance from GPS antenna to bow 40 m"},"dimSternDFO":{"ais_value":10,"decoded_text":"Distance from GPS antenna to stern 10 m"},"dimPortDFO":{"ais_value":4,"decoded_text":"Distance from GPS antenna to port 4 m"},"dimStarboardDFO":{"ais_value":5,"decoded_text":"Distance from GPS antenna to starboard 5 m"},"versionDFO":{"ais_value":0,"decoded_text":"Station compliant with Recommendation ITU-R M.1371-1"},"imo":6514895,"posTypeDFO":{"ais_value":1,"decoded_text":"Gps"},"etaDFO":{"dateInMillis":1584189600000,"textDate":"Sat 2020 Mar 14 12:40:00 GMT "},"draughtDFO":{"ais_value":38,"decoded_text":"Draught is 3.8 m"},"dest":"FORUS ","dteDFO":{"ais_value":0,"decoded_text":"Available"}}

From several executions, this happens all the time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.