FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

4167 questions

4739 answers

3460 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
878 views
in Vehicle tracking by anonymous

I looked at an example of parsing data in hexadecimal format at the link: https://wiki.teltonika-gps.com/view/Codec

I received data in hex stream via UDP protocol from fmb204:

3D8CAFE12D0F33353230393330383535303637373781000186E678B1F80166B39BB214FAAD009908EA000C6EF0F00500154C804516B50EB60B42308D180043DAC44080000186E641C3780166B39BB214FAAD00AC08EB000C6EF0F00500154C804516B50CB60942308D180043DA844080000186E6AD4F80166B39BB214FAAD00AC08E8000C6EF0F00500154C804516B50DB60A42308D180043DA844080000186E5D3E6780166B39BB214FAAD009D08EA00F0C6EF0F00501154C804516B50EB60B42308D180043DA844080000186E5D2D580166B41AC214FAC4F09D0B6B00F0C6EF0F01500155C804516B50EB60B42308D180043DA844080000186E59DD6A00166B41AC214FAC4F0970B6C000C6EF0F00500155C804516B50BB60942308D180043DA344080000186E566E8200166B41AC214FAC4F0A70B6C000C6EF0F00500155C804516B50CB60942308D180043DA244080000186E52FF9A00166B41AC214FAC4F09C0B69000C6EF0F00500154C804516B50FB60C42308D180043DA244080000186E4F9B200166B41AC214FAC4F0B50B65000C6EF0F00500155C804516B501DB601B42308F180043D9D44080000186E4C21CA00166B41AC214FAC4F0B80B6800F0C6EF0F00501155C804516B5013B601142308D180043D9D44080000186E4C11EB80166B3E8C214FA8CB0BA02D800F0C6EF0F01500155C804516B5014B601242308D180043D9D44080000186E4AA47100166B3E8C214FA8CB0AC02DA000C6EF0F00500155C804516B50DB60A42308E180043D9C44080000186E47358900166B3E8C214FA8CB09A02DA000C6EF0F00500155C804516B5011B60E42308D180043D9744080000186E43C6A100166B3E8C214FA8CB0A202DB00F0C6EF0F00501155C804516B50CB60942308D180043D9244080000186E43B54B80166B4285214FA59A0A006CA00F0C6EF0F01500155C804516B50CB60942308D180043D9244080000186E43250200166B4285214FA59A0A306CC00F0C6EF0F00501155C804516B50BB60842308D180043D9244080010

I highlighted the fake IMEI of my device. From the example linked above, the Priority attribute should be followed by the Longitude and Latitude attributes. I've highlighted the Longitude and Latitude attributes in light blue. This may be a mistake.

I don't understand how to decipher the latitude and longitude in the response from fmb204. Please help me with the example code above.

2 Answers

0 votes
by anonymous
Hello.

Please visit Teltonika Universal Device Test Guide Wiki:

https://wiki.teltonika-gps.com/view/Universal_Device_Test_Guide#Protocols_implementation

You can download a software pack with TCP and UDP listener and records parser, which will help you to parse records.

Regards
by anonymous
Thanks. I have downloaded the UDP parser. My string is not decrypted. Error: "Value does not fall within the expected range".

Could this be related to my tracker version? My FMB Ver: 03.10.08_00.
by anonymous
I encourage you to update tracker firmware, to the current version:

https://wiki.teltonika-gps.com/view/FMB204_firmware_errata

Presented UPD packet is not in accordance with codec 8 or codec 8 extended, for exmple Codec ID and Number Of data is not correct.

https://wiki.teltonika-gps.com/view/Teltonika_Data_Sending_Protocols#Codec_8

Please veify
0 votes
by anonymous
Hello , I have a suggestion for you

The FMB204 is a GPS tracker that can send location data in a hex stream format. To decode the latitude and longitude from this hex stream, you can follow these steps:

Convert the hex stream to binary format: Each hex digit represents four binary digits, so you need to convert the hex stream to binary format. You can use an online hex to binary converter for this.

Extract the latitude and longitude data: The latitude and longitude data are usually stored in a specific format in the binary data stream. For example, the latitude might be stored in bytes 11-14, while the longitude might be stored in bytes 15-18. Check the FMB204 user manual to determine the exact location of the latitude and longitude data in the binary stream.

Convert the latitude and longitude data to decimal format: Once you have extracted the latitude and longitude data from the binary stream, you need to convert it to decimal format. The conversion formula is:

Decimal value = (Binary value / (2 ^ number of bits)) * 360

For example, if the latitude is stored in 32 bits, the conversion formula would be:

Decimal latitude = (Binary latitude / (2^32)) * 360

Determine the direction: The direction of the latitude and longitude data (i.e. whether it is north or south, east or west) is usually stored in a separate byte or bit in the binary stream. Check the FMB204 user manual to determine the location of the direction data.

By following these steps, you should be able to decode the latitude and longitude data from the hex stream sent by the FMB204 GPS tracker.

Hope so it will helps.
by anonymous

Thank you very much for the detailed answer!!! The response from FMB204 comes to me in the format: "b'\x03\xd8\xca\xfe\x01\x0c\x00\x0f352093085506888\x08\x10\x00\x00\x01\x86\xe6A\xc3x\x00\x16k9\xbb! O\xaa\xd0\x00\...etc."

What parameter should be changed in the GPS tracker so that the response comes in hexadecimal format?

To transform my response, I write the data to a Python list. I get integers from 0 to 255. Then I convert them to hexadecimal system. That's right?

v_flex = b'\x03\xd8\xca\xfe\x01\x0c\x00\x0f352093085506888\x08\x10\x00\x00...etc.'
v_flex = list(v_flex)
v_str = ""
 
for i in v_flex:
    try:
        v_str += str(convert_base(i, to_base=16))+ ""
    except:
        pass
 
print(v_str)
 
# def convert_base(num, to_base=10, from_base=10):
#     # first convert to decimal number
#     if isinstance(num, str):
#         n = int(num, from_base)
#     else:
#         n = int(num)
#     # now convert decimal to 'to_base' base
#     alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#     if n < to_base:
#         return alphabet[n]
#     else:
#         return convert_base(n // to_base, to_base) + alphabet[n % to_base]