Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Bugfix-T800X Protocol) Fix messages response for 0x2323 #5192

Merged
merged 3 commits into from
Oct 6, 2023

Conversation

sherbinator
Copy link
Contributor

@sherbinator sherbinator commented Oct 5, 2023

Description

The problem

The devices that use header 0x2323 can't establish a stable TCP connection which can lead to unexpected behavior because the devices don't receive the correct response from the server for login/heartbeat messages.

The solution

According to the attached document, the devices of header 0x2323 are expecting the response to have the serial bytes to be 0x00 0x01 in response messages.

steps:

  1. the device sends a login message to the server ex. 232301001500030[IMEI]150208625020
  2. the server responds with 232301000f00010[IMEI] which is the same message that the device sent. note that the serial bytes are 0x00 0x01
  3. the device sends a heartbeat message to the server ex. 232303000f00b50[IMEI]
  4. the server responds with 232303000f00010[IMEI] which is the same message that the device sent. note that the serial bytes are 0x00 0x01, the correct response has to be sent other wise the device will store cache of GPS/ALARM messages and send them again. (this will dramatically increase the telemetry data usage)
  5. if the device send alarm message. then, the server has to respond or the device will cache the message and send it again.
  6. settings/forward messages also needs response.

notes:

  • we have tested the solution with real devices and it works fine. models:
    • T8808B
    • T8808+
  • according to the manufacture the header 0x2323 is EOL and we are not expecting new devices to use it. so, we are not expecting any side effects from this change.

PR Checklist

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

References

TOPFLYTECH T880X Protocol V6.2

Credits

Jaime Duardo - Hardware Engineer

Abdelrahman Mousa - Software Engineer

Copy link
Member

@tananaev tananaev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to provide a description.

@sherbinator
Copy link
Contributor Author

I have updated the PR. lemme know if you need more clarification.

sendResponse(channel, header, type, index, imei, 0);

if (header == 0x2323) {
sendResponse(channel, header, type, 0x0001, imei, 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we send 1 for other devices as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according the official documentation of the manufacturer, we believe that all devices use header 0x2323 will need to receive the serial 1.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant devices with other headers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess no, starting from header 0x2525 the serial will be computed depending on device info

We are testing some devices and I can confirm that it will not be the case in the following headers:

0x2525 gen 1 and gen 2
0x2626
0x2727

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Anton, it's not possible; it only applies to devices with header 0x2323. In other cases, you need to respond with the serial number that comes in the device's payload. The documentation regarding other headers from Topflytech can be found in the description of this pull request.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, can we do something like this then: header == 0x2323 ? 1 : index

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah sure, I'll add it

Copy link
Contributor Author

@sherbinator sherbinator Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 👍

@tananaev tananaev merged commit 0a5eb9c into traccar:master Oct 6, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants