Is it possible to change command type for Teltonika Devices?

MikeSargent2 years ago

Hi,

Im currently trying to get message to parse through the RS232 port on a Teltonika FMC125. Quite handily for all other commands, the server prepacks the data into the Codec12 packet but I can't seem to find where to change the command type from a 0x05 (ID: 5) to a 0x0E (ID: 14) as stated in the link below:
https://wiki.teltonika-gps.com/view/FMC125_RS-232_and_RS-485

Any assistance would be apricated.

Thanks in advance.

Anton Tananaev2 years ago

You would have to change the protocol encoder to do this.

MikeSargent2 years ago

Where would I find the encoder in the maze of folders. Im currently running the traccar server on linux. I have seen previous posts of folder locations for the protocols but I have been unable to find them.

Anton Tananaev2 years ago

It's in the source code. You won't find it on a server installed from an installer because it's already compiled into a binary.

MikeSargent2 years ago

I see. Thanks for the reply. Ill have a go at looking for the source code and modifying it. Would you recommend I follow the points in the following link for compiling etc.. https://www.traccar.org/build/

Anton Tananaev2 years ago

Yes.

MikeSargent2 years ago

Hi Anton,

Ive modified the code and recompiled and ran the server from a localhost via IntelliJ IDEA but as soon as I transfer the .jar file as stated in that web document to the ubuntu server it no longer loads and produces the following errors:

sudo systemctl status traccar

● traccar.service - traccar
     Loaded: loaded (/etc/systemd/system/traccar.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-05-17 10:43:44 UTC; 1min 7s ago
   Main PID: 109733 (java)
      Tasks: 31 (limit: 2334)
     Memory: 223.0M
     CGroup: /system.slice/traccar.service
             └─109733 /opt/traccar/jre/bin/java -jar tracker-server.jar conf/traccar.xml

May 17 10:43:56 sargent-dev-server traccar[109733]:         at org.eclipse.jetty.server.Server.doStart(Server.java:414)
May 17 10:43:56 sargent-dev-server traccar[109733]:         at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
May 17 10:43:56 sargent-dev-server traccar[109733]:         at org.traccar.web.WebServer.start(WebServer.java:245)
May 17 10:43:56 sargent-dev-server traccar[109733]:         at org.traccar.Main.run(Main.java:127)
May 17 10:43:56 sargent-dev-server traccar[109733]:         at org.traccar.Main.main(Main.java:107)
May 17 10:43:56 sargent-dev-server traccar[109733]: Caused by: java.lang.ClassNotFoundException: org.jvnet.hk2.guice.bridge.api.GuiceBridge
May 17 10:43:56 sargent-dev-server traccar[109733]:         at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
May 17 10:43:56 sargent-dev-server traccar[109733]:         at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
May 17 10:43:56 sargent-dev-server traccar[109733]:         at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
May 17 10:43:56 sargent-dev-server traccar[109733]:         ... 32 more

The files all compiled/built fine and does run in IntelliJ IDEA.

Any thoughts as i have only changed the 5 to a 14 in the TeltonikaProtocolEncoder.java file?

MikeSargent2 years ago

Hi, just a further update. When i change the .java for the encoder on the linux server via the source code and compile then run the ./gradlew assemble, the web app will boot to the loading screen before the login page but will display the following error

Column "DISABLEREPORTS" not found; SQL statement:
SELECT map, latitude, longitude, readonly, zoom, twelvehourformat, coordinateformat, devicereadonly, limitcommands, disablereports, poilayer, registration, bingkey, mapurl, forcesettings, announcement, attributes, id FROM tc_servers [42122-206] - JdbcSQLSyntaxErrorException (... < QueryBuilder:63 < *:129 < DatabaseStorage:35 < Storage:26 < ...)
Anton Tananaev2 years ago

You should use the tag corresponding to your version of Traccar.

MikeSargent2 years ago

Hi,

Im not sure what you mean by tag?

I have manged to sort the lib problem by replacing both the .jar and the lib folder and now get this error when loading the webpage

Unknown column 'disablereports' in 'field list' - SQLSyntaxErrorException (... < QueryBuilder:405 < DatabaseStorage:39 < Storage:26 < ...)

Im currently using the traccar-linux-64-4.15.zip.

Any thoughts?

Anton Tananaev2 years ago

I'm talking about git tag.

MikeSargent2 years ago

Im currently running a traccar-linux-64-4.15 linux server. I used Intellij to modify the traccar-linux-64-4.15 source code to change the encoder from 5 to 14. The .jar was made and the lib folder and the .jar file was replaced on the server. To my knowledge all of this have been done on the same versions of Traccar. Im not sure how changing this value has managed to break the SQL.

Anton Tananaev2 years ago

How did you modify the traccar-linux-64-4.15 source code? How did you get the source code for that version specifically?

MikeSargent2 years ago

Using the sourcecode.zip from your github releases : https://github.com/traccar/traccar/releases

I assumed this would be the source code for 4.15.

Anton Tananaev2 years ago

Interesting. The error actually indicates that you're not using that.