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,814 views
in Vehicle tracking by

Hello !

I am able to decode ACK of each command I have send.
However, data from decoded ACK are difficult to exploit.

Is there a way to extract them properly from a Codec 12 ACK ?

Personnaly, I have think to use space character like a delimiter and split the string into an array.

But, the problem is to recognize which initial command was sent.
For example, I can't extract data of the same maner if the command was getstatus or setparam #:#;#:#.

In fact, my goal is to make ACK readable for simple users.

Is there a way to do this ?

Thanks a lot for you help.
Sincerely.

2 Answers

0 votes
by anonymous

Hello,

Thank you for your question,

Could you confirm you are having issues with parsing the responses to your GPRS commands?

If you are required to read the data you should implement a script/parsing tool to transcribe the hexadecimal data to ASCII.

As for example if "getio" GPRS command is sent to the device you would receive a response:

000000000000002C0C0106000000244449313A30204449323A30204449333A302041494E3A323420444F313A3020444F323A30010000F925

In this packet there would be the following:

Parsed:

  • Zero: 0x00000000
  • Packet Length: 0x0000002C
  • Codec: 0C
  • Quantity of commands: 01
  • Command type: 06
  • Command size: 0x00000024
  • Command response in ASCII after conversion: DI1:0 DI2:0 DI3:0 AIN:24 DO1:0 DO2:0 (without <CR><LF>)
  • Quantity of commands: 01
  • CRC: 0x0000F925

The data part: 4449313A30204449323A30204449333A302041494E3A323420444F313A3020444F323A30 is the required to be converted to ASCII

Starting from the right side:

00 - 0

3A - :

32 - 2

4F - O

44 - D

20 - (space)

etc.

By this logic you should be able to read any response in the server side.

More information could be found wiki page:

https://wiki.teltonika.lt/view/Codec_12

Hope this helps,

Regards.

by

Hello !

Thanks for your answer.

In fact, in you example, I managed to get your part : 4449313A30204449323A30204449333A302041494E3A323420444F313A3020444F323A30.
And then, to convert it into ASCII message like yours : DI1:0 DI2:0 DI3:0 AIN:24 DO1:0 DO2:0.

However, I would like to know if there is a way to extract some informations of this ASCII message depending of which command was sent. Like new "DI1" or "DI2" value.
For example, I found that the ASCII result of this command "setparam 2001:wap;2002:user;2003:pass" is a little bit different than the "getio" command.

Finally, extract some specific data from ASCII response seems to be possible, but, I don't know which type of command's ACK I am decoding. Because ACK is not associated to the command sent.

For example in a fictive ACK packet it might look like : Command ID (based on timestamp for example) | Command sent | ACK (ASCII).
It should be a great improvement for a lot of people I think.

I am sorry for this post. Also, It's complicated to express it in english.

Sincerely,

EDIT :
I have tried the getstatus command. The result is : Data Link: 1 GPRS: 1 Phone: 0 SIM: 0 OP: 20820 Signal: 4 NewSMS: 0 Roaming: 1 SMSFull: 0 LAC: 5 Cell ID: 31814 NetType: 1 FwUpd:-65536

Here I have a problem because unlike to getio, the values are separated by spaces (Data Link: 1).
But with getio command, there is no space (DI1:0).

So my method to extract data from ASCII string can't be the same accordind to the commands sent.
Thus, I can't integrate clear custom ACK with language translation into my user interface.

by

Hello,

Excuse me but can you help me and tell me how i determine the Command Size and the Packet Lenght?

I hope you can help me.

Regards.

by

Hello Lazo,

I am not a professional, but I will try to help you.

This subject was about Codec 12.

But you can find all informations about Codecs here :https://wiki.teltonika.lt/view/Codec.

I have just saw that "Packet Lenght" is about UDP communication.

I have got some questions for you :

  • Which Codec are you talking about ? Codec 8/8E, 12, an other ?
  • Do you want to communicate with TCP or UDP for communication protocol ?
In addition, maybe it can be better to open a new post. More persons could help you. :)
And finally, Tetonika made a great tool that helped me a lot ! The name is "Teltonika.Parser (source code)". You can see how Teltonika made a basic server. It was written with the C# language. Take some time to read it. It's very interesting. You will understandood how Teltonika decode their frames made of unsigned Bytes (hexadecimal numbers).
All the elements in the received data have a specific place. For Codec 8 in exemple :
  • You can read 4 Bytes of 4 Zeros.
  • Then you go forward.
  • You read the Data Length (4 Bytes).
  • Then Codec ID (1 Byte).
So you have to move forward by tanking into account the element order and their size ind bytes.
I expect my intervention will help you a little bit.
Sincerely,
Do not hesitate to ask more questions.
+1 vote
by anonymous
Hi, AlliageSphere.

Yes, the lack of command ID/type in responses could be considered a flaw. The good news are that most commands has unique format of response. And Teltonika does not change those formats either much or often.  So at least you can always find out, to what type of command every response belongs. Technically it could be implemented with the help of regular expressions.
by
Hello Kino atlet,

I did not think to regular expression.
However, I only know how to make basic regular expression.

I will try to see how to do it.

Thanks a lot for your help !
Sincerely,