Implement Protocol

This page contains information about implementing new protocol support for Traccar server.

Project is written in Java, using maven build system. I recommend to use latest version of NetBeans or IntelliJ IDEA for development. To do your changes you can fork GitHub repository:

To implement protocol you need a class derived from BaseProtocol and a class derived from BaseProtocolDecoder. In some complicated cases you might also need a class derived from FrameDecoder. In most cases for frame decoder you can use existing classes from Netty (FrameDecoder).

There are two main types of protocols: text and binary.

As a base/example for binary protocol you can use GT02 protocol decoder:

As a base/example for text protocol you can use GPS103 protocol decoder:

To enable protocol you also need to add lines to configuration file (again look at other protocols and do similar thing for your protocol): debug.xml.

To test that everything works you need to send test message to the server. Some protocol documentations might include example messages, for others you need to create one based on protocol specification. To send message you can use the following shell script (it creates message from hex string and sends it to specified port):

Useful online tool to convert hex to text.