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 the port to PortConfigSuffix or the configuration file.

To test that everything is working you can send a test message using our hex.sh shell script.