Updating Teltonika Decoder for LBS tracking of 4G devices

Kaldek4 days ago

Planning on doing some pull requests for the 4G TAT series by Teltonika, covering the TAT140 (Cat-1), TAT141 (Cat-M1), and TAT240 (Cat1 with magnetic tamper detection). Just need a little advice on the alterations to the code, because the LTE data is similar but not exactly the same. A couple of the parameters are 4-bytes unsigned on the TATX4X series, and the signal is LTE specific in that it is RSRP, values 0-7 not RSSI, values 0-63.

This is the current code:

if ("TAT100".equals(model)) {
            Network network = new Network();
            decodeCell(position, network, "io1200", "io287", "io288", "io289");
            decodeCell(position, network, "io1201", "io290", "io291", "io292");
            decodeCell(position, network, "io1202", "io293", "io294", "io295");
            decodeCell(position, network, "io1203", "io296", "io297", "io298");

The new attributes would make this something like so:

if (model.matches("TAT[12]4[0-1]")) {
            Network network = new Network();
            decodeCell(position, network, "io25032", "io25020", "io25021", "io25022");
            decodeCell(position, network, "io25033", "io25023", "io25024", "io25025");
            decodeCell(position, network, "io25034", "io25026", "io25027", "io25028");
            decodeCell(position, network, "io25035", "io25029", "io25030", "io25031");

Hoping for a little guidance before I go and do some really deep dives on "decodeCell". Note my RegEx caters for an as-yet non-existent TAT241, which is likely to arrive at some point, given Teltonika's support for Cat-M1.

And yes, I'm aware I'm going to be told that the TATX4X series have 2G fallback and that we actually need to validate the connection type more than the model number. There is no 2G here anymore hence my personal focus on 4G.

Anton Tananaev4 days ago

It looks fine to me. What exactly are you worried about? Is something not working?

Kaldek3 days ago

I was mainly worried about the data type differences but I did a little digging and all I need to do is set the radio type to LTE.

Some interesting observations about the current state of the code for the TAT100: it's collecting the RSSI but not converting it into dBm. Whilst Google geolocation (as the example here), doesn't do anything with the "signal Strength" data, it does say it expects it in dBm.

I'll do some basic tests on our fork to make sure LBS works, and then alter the code to include a converter for GSM (values of 0-63) and LTE (RSRP, values of 0-7).