LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I would like to know how to handle ASN.1 encoding/decoding in LabView?

Solved!
Go to solution
I would like to know how to handle ASN.1 encoding/decoding in LabView?
0 Kudos
Message 1 of 13
(6,445 Views)
Solution
Accepted by J_Bangasser

Hi J,

 

from the example given here it looks like a simple bytestream format...

 

You have to read the byte stream, get the first and second byte to decode the datatype and length and then read&typecast the according number of bytes. Then again reading 2 bytes and so on...

 

Encoding will work the same but in reverse order Smiley Wink

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 13
(6,442 Views)

Hi all,

 

I want to read TLV (ASN.1) format files with Labview and extarct the data from it.

 

Please help me if anyone knows any information about this.

 

Thanks & Regards,

Guru

Munna
0 Kudos
Message 3 of 13
(6,181 Views)

Hi Guru,

 

did you even read the linked article? It's quiet easy to decode the data once you know the code table...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 13
(6,170 Views)

It seems like a homework, huh

Greets, Dave
0 Kudos
Message 5 of 13
(6,166 Views)

Hello GerdW,

Thank you so much for your reply.

 

I read that article (i.e. ASN.1 Str) but I don't know how to read my file for decoding.

I don't know the code table present in my file.

Please provide me sample VI.

 

Thanks & Regards,

Guru

Munna
0 Kudos
Message 6 of 13
(6,164 Views)

Hi Guru,

 

- use ReadBinaryFile to read the ASN file as a bytestream.

- Try to find more documentation about ASN specification. I don't use such files nor do I have any intention to do your work (and so I don't have any VIs). You will need such a document to fully understand the file format...

 

It's your task, so do your work. It's a perfect example to learn to use file read functions and type conversions...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 13
(6,156 Views)

Dear GerdW,

 

Thank you so much for your support and advice 🙂

 

I don't have any document for this file format.

Just I know that its TLV (ASN.1 with PER/BER str inside)format .

 

I guess ASN.1 standard format. I don't know how can I get the TLV (Tag length value) for every signal present in that file.

 

BR,

Guru

Munna
0 Kudos
Message 8 of 13
(6,147 Views)

Hi guru,

 

as said before:

- Use FileRead function to read the tag (byte) and the length (byte).

- Then read the value bytes (given by length) and parse it (information given by tag).

- Then continue with reading next tag and length...

 

Simplified example:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 13
(6,144 Views)

Dear GerdW,

 

Thank you so much for sharing sample VI.

 

I checked your VI with my sample file But, I'm not getting proper data.

I want to read CAN Frame (i.e. Timestamp ID and Payload) data from this file.

 

Thanks & Regards,

Guru

Munna
0 Kudos
Message 10 of 13
(6,136 Views)