HELP. OBD data in an OpenGTS integration

brianar6 years ago

Hello there, I hope that someone could help me with this issue that I'm facing.

The idea is to use the Traccar system as an DCS of the OpenGTS. But the problem is that the documentation for the integration of both systems is not supporting the OBD data.

I think that it should be fixed by adding some info into the config file from traccar:

<entry key='database.selectAllDevices'>
    SELECT CONCAT('1', imeiNumber) AS id, imeiNumber AS uniqueId FROM Device WHERE imeiNumber REGEXP '^[0-9]+$';
</entry>

<entry key='database.insertPosition'>
    START TRANSACTION;
        UPDATE Device SET lastValidLatitude = :latitude, lastValidLongitude = :longitude, lastGPSTimestamp = UNIX_TIMESTAMP(:fixTime), lastUpdateTime = UNIX_TIMESTAMP(NOW()) WHERE imeiNumber = SUBSTRING(CAST(:deviceId AS CHAR(32)), 2);
        SELECT @accountID := accountID, @deviceID := deviceID FROM Device WHERE imeiNumber = SUBSTRING(CAST(:deviceId AS CHAR(32)), 2);
        INSERT INTO EventData (accountID, deviceID, timestamp, statusCode, latitude, longitude, speedKPH, heading, altitude, rawData, creationTime, address)
        VALUES (@accountID, @deviceID, UNIX_TIMESTAMP(:fixTime), 0, :latitude, :longitude, :speed * 1.852, :course, :altitude, '', UNIX_TIMESTAMP(NOW()), :address);
    COMMIT;
</entry>

As you can see, there are fields for account, device, timestamp, speed, etc, but not for obd info.

I have to apologize for my lack of knowledge for solving this myself.

Thanks in advance for all the help you could give me!

PS: The protocol I'm using is the GPS103 in the 5001 port and the OBD model is TK306.

Feel free to send a message or answer this post, I hope that this could help others like me.

Anton Tananaev6 years ago

Provided config includes very basic support for GPS location data only. To add OBD data you would need to modify SQL queries. You might be able to find some examples on GitHub and forum.