LBS for tlt2h protocol

code_af2 years ago

Hi,
I have a device which uses tlt2h protocol, it has LBS enabled, the LBS data within data packet looks like:

#867198059727390#MT700#0000#AUTO#1

#40#262,03,8CE6,A641$WIFI,123532.00,A,-62,D8325A0ABADD,-64,EC172F8965BC,,,260321*07
##

This part #262,03,8CE6,A641 used for LBS, if LBS is disabled in device then this part would not be reported, if it is enabled then device will report this part also.

I tried to build bellow Pattern for it, but unfortunately it doesn't works, can somebody tells where I made mistake?

private static final Pattern PATTERN_WIFI = new PatternBuilder()
            .text("#")
            .number("(?:(dd)|x+)")               // cell or voltage
            .groupBegin()
            .number("#(d+),")                     // mcc
            .number("(d+),")                     // mnc
            .number("(x+),")                     // lac
            .number("(x+)")                      // cell id
            .groupEnd("?")
            .text("$WIFI,")
            .number("(dd)(dd)(dd).d+,")          // time (hhmmss.sss)
            .expression("[AVL],")                // validity
            .expression("(.*)")                  // access points
            .number("(dd)(dd)(dd)")              // date (ddmmyy)
            .text("*")
            .number("xx")                        // checksum
            .compile();

The error I am getting is:

 error - Cannot invoke "java.util.Date.getTime()" because the return value of "org.traccar.model.Position.getFixTime()" is null - NullPointerException (FilterHandler:118 < *:191 < *:247 < BaseDataHandler:27 < ... < RemoteAddressHandler:53 < ...)
Anton Tananaev2 years ago

Can you please provide original logs.

code_af2 years ago

Here is original logs:

2023-01-05 18:37:47  INFO: [Te803af38] connected
2023-01-05 18:37:48  INFO: [Te803af38: tlt2h < 2.xx.xx.xx] 23383630313836303538313030303030234d543730302330303030234155544f23310a233339233236322c30332c384345362c4136373224574946492c3135343932382e30302c412c2d37342c3343413632463532363135422c2d38322c4130453443423833383532442c2c2c3035303132332a32380a2323
2023-01-05 18:37:48  INFO: [Te803af38] error - Cannot invoke "java.util.Date.getTime()" because the return value of "org.traccar.model.Position.getFixTime()" is null - NullPointerException (FilterHandler:118 < *:191 < *:247 < BaseDataHandler:27 < ... < RemoteAddressHandler:53 < ...)
2023-01-05 18:37:48  INFO: [Te803af38] disconnected
Anton Tananaev2 years ago

In your log I don't see that extra line break. Did you modify the original packet?

code_af2 years ago

If you mean in my first post, the extra line break between header and WiFi packet is extra, as I modified that packet for better understanding.

Anton Tananaev2 years ago

Do you want to create a PR with your changes?

code_af2 years ago

Hi Anton,

I was able to fix the issue, a PR has been created.

Thanks

Meir99 2 years ago

Hello code-af I have a tracker LBS only, no GPS module on board. Which protocol is best to use. I have source codes of the tracker,I can change the firmware codes.

Thank you

code_af2 years ago

@Meir99,
Your question is not related to this post, I think you need to create a new post.
By the way, every tracker has its own TCP protocols which is provided by the manufacturer.

Meir99 2 years ago

@code_af,
Thank you for reply. As I have the source codes and compilier , i can modify the protocol and functions or rewrite all from scratch.
I will open new post