How to construct a message
How to construct a message using the MessageHelper class
In many cases when processing military messages, the message components will be taken directly from the wire format and passed into the MessageProcessor class for processing. Whilst this makes coding simple for this use-case, it makes creating messages from scratch more challenging as the developer needs to have a good understanding of the message format to make a valid message.
The MessageHelper class makes the process of creating a new message easier, but it should be understood that a reasonable level of understanding of the message type is still needed. The MessageHelper methods take a DictionaryType as their first parameter, specifying the symbology to be used, for example MIL-STD-2525C or APP-6B symbology.
The following example shows how to create a message to update an existing symbol on the map to a new position.
//make up a location for the symbol List<Point> controlPoints; Point pt = new Point(); pt.setX(-500000); pt.setY(0); //put it into a control point controlPoints = new ArrayList<Point>(); controlPoints.add(pt); //make a move message, specifying the dictionary type (App6B type shown below) Message message = MessageHelper.createUpdateMessage(DictionaryType.App6B, "1", "position_report", controlPoints); //process the message created messageProcessor.processMessage(message);