VL502 - Huabao protocol - Latitude out of range error

SwayDev2 years ago

Hello,

Traccar: v5.6
Device Model: VL502 OBD II Tracker
IMEI: 868935060010210
Protocol: Huabao
Port: 5015

Not sure if this is an issue/bug or if I am doing something wrong.

  1. Based on GitHub issue #4843.
  • Used the id 4f07788ef87d. It returned an unknown device
  • So used the IMEI displayed in the log (shared below), which also was missing one character from the end.
2023-02-23 17:13:13  INFO: [T2d584d6a: huabao < 145.40.69.39] 7e010200144f07788ef87d01021e4f4459344f544d314d4459774d4445774d6a4577387e
2023-02-23 17:13:13  WARN: Unknown device - 86893506001021 (145.40.69.39)

After adding the partial IMEI from the log (shared below), got the latitude range error:

2023-02-23 17:18:22  INFO: [T98a1e5e3] connected
2023-02-23 17:18:22  INFO: [T98a1e5e3: huabao < 145.40.69.39] 7e010200144f07788ef87d0102314f4459344f544d314d4459774d4445774d6a4577177e
2023-02-23 17:18:23  INFO: [T98a1e5e3: huabao > 145.40.69.39] 7e800100054f07788ef87d000002310102008f7e
2023-02-23 17:18:23  INFO: [T98a1e5e3: huabao < 145.40.69.39] 7e000200004f07788ef87d010232097e
2023-02-23 17:18:23  INFO: [T98a1e5e3: huabao > 145.40.69.39] 7e800100054f07788ef87d000002320002008d7e
2023-02-23 17:18:23  INFO: [T98a1e5e3: huabao < 145.40.69.39] 7e0900001f4f07788ef87d01000cf0230223150215010203013800000c000b029dc58c04b99b60230223171822507e
2023-02-23 17:18:23  INFO: [T98a1e5e3] error - Latitude out of range - IllegalArgumentException (Position:231 < HuabaoProtocolDecoder:402 < *:875 < *:297 < ExtendedObjectDecoder:72 < ...)
2023-02-23 17:18:23  INFO: [T98a1e5e3] disconnected
Anton Tananaev2 years ago

Looks like either the data is invalid or it's not decoded correctly. Do you have the protocol documentation for your device?

SwayDev2 years ago

Sure, this is the protocol document. VL502 Protocol Document

Anton Tananaev2 years ago

Great. You can use that documentation to break down the sample and see what the issue is. Feel free to post the breakdown here afterwards.

SwayDev2 years ago

Here is my attempt at the breakdown of the sample, to the best of my ability.

9.14 Data uplink transparent transmission—0x0900 (Page 32)
7e0900001f4f07788ef87d01000cf0230223150215010203013800000c000b029dc58c04b99b60230223171822507e

7e
0900
001f
4f07788ef87d
0100
0cf0
230223150215 (Event time)
01 (buffered data)
02 (Vehicle type)
03 (upload data related with alarm messages and driving behavior - Page 32) I believe this is where we hit line #L847
013800000c000b029dc58c04b99b6023022317182250
7e

At this point, I am stuck on page 33, Section 9.14.1.1 due to limited know-how on this.

SwayDev2 years ago

7e
0900
001f
4f07788ef87d
0100
0cf0
230223150215 (Event time)
01 (buffered data)
02 (Vehicle type)
03 (upload data related with alarm messages and driving behavior) "9.14.1.3 Report of alarm and driving behavior data 0x03: Page 44"
01
38
00
000c000b (status)
029dc58c (latitude)
04b99b60 (longitude)
230223171822
50
7e

Tried a little more and was able to get the status, latitude, and longitude breakdown as well. Hope this helps.

I am not able to figure out what the issue is, but can you please help?

Anton Tananaev2 years ago

Looks like you've missed the part where 7d01 should be replaced with 7d, so I think the rest of your breakdown is incorrect. See the "5.4.2 Identifier" section for more details.

SwayDev2 years ago

I hope, I am close.

9.14 Data uplink transparent transmission—0x0900 (Page 32)

7e
0900 (message id)
001f (message body property)
4f07788ef87d (sn)
000c (sequenc number)
f0 (Terminal data uplink transparent transmission--0x0900F0)
230223150215 (Event time)
01 (buffered data)
02 (Vehicle type)
03 (upload data related with alarm messages and driving behavior)
013800
000c000b (status)
029dc58c (latitude)
04b99b60 (longitude)
230223171822
50
7e

For the latitude, longitude, and status value above I did a breakdown based on the document, not based on what the code does.

It seems like the After 0x03 (the alarm message and driving behavior) is where the problem is @ line 852 the switch case in the decoder the default case is executed.

I like to believe the problem is there.

I will contact via support email for this.

Anton Tananaev2 years ago

This was helpful. The issue was actually on line 850, not with the switch case itself. The id is one byte long instead of two bytes, like other types.

Fixed it here:

https://github.com/traccar/traccar/commit/3331593759a21a1fa36cb64332e14828f7e522f0

SwayDev2 years ago

Thank you very much Anton, really appreciate your help.