Buy an off-the-shelf fleet system and you're usually limited to the vendor's devices. For the fleet platform we built for Yong Fan, we chose to build our own device data-receiving server, integrating two kinds of devices: JT808-protocol trackers, and environmental-agency devices that report trajectories to the authorities. Here are the details that are easiest to get wrong.

Why build your own receiving server

A tracking device only sends its position periodically; where it goes and how it's interpreted is up to the server. With your own receiving server, devices from different brands and protocols are normalized into one format and feed the same maps, dispatch and reports — and when you switch devices or add a protocol, the systems downstream don't need to change.

JT808: get the framing right first

JT/T 808 is a very common tracker protocol. Before parsing any data, three things must be right — otherwise you get the hard-to-debug "most packets are fine, a few fail to parse" problem.

1. Flag byte and escaping

Every frame starts and ends with 0x7e. If 0x7e happens to appear inside the frame (header, body or checksum), it must be escaped, or it will be mistaken for the end of the frame:

The order matters:

For example, content 0x30 0x7e 0x08 0x7d 0x55 is sent as 0x7e 0x30 0x7d 0x02 0x08 0x7d 0x01 0x55 0x7e.

2. Checksum

The checksum is one byte: XOR every byte from the start of the message header up to the byte just before the checksum. Remember to verify it after unescaping.

3. Every message needs a reply

JT808 requires a reply to every frame. If a command defines a specific reply message, use it; otherwise the platform uses the general reply 0x8001 and the device uses the general reply 0x0001. If the platform misses a reply, some devices keep resending the same data.

Also, bits 10–12 of the message attributes are the encryption flags: all three zero means no encryption, and bit 10 set means the body is RSA-encrypted. Check these bits before deciding how to parse.

Environmental-agency devices: replies and configuration

Some vehicles are required to carry an environmental-agency device that reports trajectories to the authorities. The device we integrated uses a text-based protocol.

What the server must reply

After the device sends trajectory data, the server replies:

$,<device ID><date-time>,#

The date-time is year-month-day-hour-minute-second (14 digits). If the data includes a barcode, an extra line is returned:

$,<device ID>,<barcode>,<date-time>,#

Configuration commands

The device can be configured over an RS-232 terminal (38400 bps, 8 data bits, no parity, 1 stop bit). Common commands:

The mobile-network APN is set by SMS, in the format $gprs,<APN>,,. One trap: you first connect to the server with the SIM that already works, send the SMS to change the APN, then swap in the new SIM. If the new SIM then fails, you can't change it back — so confirm the new SIM's APN before swapping.

Reading the LEDs

Common cases: power LED off or blinking — check the main power wire (red). Power and GPS both steady — no fix yet; check the GPS antenna is screwed on tightly. GSM blinking quickly once every four seconds while the status LED stays steady — can't reach the server; try unplugging and reconnecting power.

Wiring

The essentials: pin 1 (red) to battery positive, pin 2 (black) to negative/ground, pin 6 (orange) to ACC (ignition), pin 8 (green) to the SOS button. The remaining pins are digital inputs/outputs and an analog input, used as needed.

Forwarding data to the authorities

Besides showing on our platform, environmental-agency device trajectories must be forwarded to the authorities as required. We handle this at the receiving-server layer, so operators meet both daily operational and regulatory needs with one system instead of maintaining two.

If you're building your own receiving server: get escaping, checksums and general replies right before anything else. Mistakes there usually don't show up immediately — they surface occasionally once you have more devices and more data, which is exactly when they're hardest to track down.

If you want to connect your devices to your own system, or evaluate whether another brand of device can be integrated, we'd be glad to talk. See also our Fleet GPS & Video Management page.

Let's talk