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
2,188 views
in Vehicle tracking by
Hi there.

My goal it's pretty simple. I want to connect two devices to one tcp server in order to create my own tracking software. The issue is the following, I need to know the IMEI of the device with every avl package in order to store it in my database and then being able to get all the geopositions of one specific device.

Is there any way to know the IMEI of the device once the connection is done?

Thanks in advance.

2 Answers

–2 votes
by anonymous

Hello,

Thank you for question.

First, when module connects to server, module sends its IMEI. First comes short identifying number of bytes written and then goes IMEI as text (bytes).
For example, IMEI 356307042441013 would be sent as 000F333536333037303432343431303133.
First two bytes denote IMEI length. In this case 0x000F means, that IMEI is 15 bytes long.
After receiving IMEI, server should determine if it would accept data from this module. If yes, server will reply to module 01, if not - 00. Note that confirmation should be sent as binary packet. I.e. 1 byte 0x01 or 0x00.
Then module starts to send first AVL data packet. After server receives packet and parses it, server must report to module number of data received as integer (four bytes).
If sent data number and reported by server doesn’t match module resends sent data.

What we want to say that before AVL data packet send to the server, device will always send his IMEI.

For AVL data sending are using three protocol types:

  • Codec8 is the main protocol;
  • Codec8 Extended is using for FMB family devices, which AVL IDs, which are higher than 255 and for Values which using more than 8 bytes for AVL ID value.
  • Codec16 is using FMB630 and FM6300 units which AVL ID's is higher than 255.

More information about them you will find here: https://wiki.teltonika.lt/view/Codec

Let us know if something was unclear, if we misunderstood your situation or you will have more questions.

Best regards,

Teltonika Support

by
Thank you so much for you answer.

The thing is, I'm able to make the tcp connection and I can also get the AVL package successfully. The problem is that if I have more then one connection I'm not sure from which device I'm getting it because after the connection is made I don't receive the IMEI with the AVL package.

Maybe you can explain me how can I have more than one connection and how to know from which device I'm getting the AVL package.

Thanks in advance.
0 votes
by anonymous

Hello,

My solution is pretty simple just create a List of models with IMEI ( String ) and Date ( timestamp maybe ) and save it to the list.
When you get the packet data filter the data by the oldest get the first IMEI and delete the IMEI model from the list and so on I wish you understand my solution.

Code example with Dart language: Code example