Implementing a New Protocol

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

The project is written in Java, using gradle build system. For more details on development environment setup please check the build documentation.

To implement a protocol you would need at least a class extending BaseProtocol and a class extending BaseProtocolDecoder. In some complicated cases you might also need a class extending FrameDecoder. In most cases for frame decoder you can use classes provided by the Netty framework (e.g. LineBasedFrameDecoder).

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

As an example for binary protocol you can use GT02 protocol decoder: Gt02ProtocolDecoder.

As an example for text protocol you can use GPS103 protocol decoder: Gps103ProtocolDecoder.

To enable protocol you also need to add a line to configuration file, similar to existing protocols: debug.xml.

To test that everything is working you can send a test message using our hex.sh shell script. We also have a useful online tool to convert hex to text.