When server have changed default speed units Client is reporting wrong speed

When I change on server osmand.speed to kmh Client is reporting wrong speed to server.
I have clients using osmand protocol on Mikrotik Routers with GPS modules and at the same time I would like to have tracking for traccar client.
One way would be to add option to choose speed unit in Client ? or is there an option to deploy two ports with the same protocol but with different configurations (one with knots and second with kmh) ?

Anton Tananaev5 years ago

I have assumed that previous thread was closed as there was no reply.
Proposed resolution (write a code yourself) is not applicable for me as I don't write in Java.

Szeth4 years ago

@Przemyslaw
Assumption: your tracking device gives speed in kmh but traccar takes it to be knots. Therefore, this is doing sort of double conversion when you change speed on the client to km/h.

You don't need knowledge of Java to handle this. Best you leave traccar's defaut speed unit as knots in the code. Rather convert the speed from your tracking device at the protocol decoder level.

Steps:

  1. Go to the OsmandProtocolDecoder or find the file decoding tracking device attributes. Look for the line where speed is being decoded. My current traccar server is showing line 125 in OsmanAndProtocolDecoder file.

  2. Change "kn" to "kmh". This tells traccar that your device speed is in km/h but it should convert it to knots.

  3. Go to your web client and change the units to km/h. Account->Attribute-> + -> Name = <Speed Unit> and Value = <km/h>

Summary.

  1. Convert speed coming from your device to knots
  2. Send it to client in knots
  3. Convert speed to km/h in client using traccar interface for units.