Read structure another value within script

0 votes
asked Nov 13 in Generic by mrtuborg (190 points)

Hi,

I have a structure with name "TLLV", that splits on 2 substructures: "Header" and "Payload".

Payload has "Value" and "padding", that is very depends on the length of the "Value", specified in Header. And I want to calculate "padding" length in the custom datatype with writing the script:

    currentGrammar = currentMapper.getCurrentGrammar()
    headerStruct = currentGrammar.getStructureByName("TLLV_Header")
    offset = currentMapper.getCurrentOffset()
    bytesProcessed = currentMapper.mapStructureAtPosition(headerStruct, offset, 16)

    length = headerStruct.getElementByName("valueLength")

So, currently, I am able to reach out length, as an element.

But how to convert element to a "Number" type to be able to use it?

Please log in or register to answer this question.

...