This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DLPNIRNANOEVM: Structure of data returned by Read file data / NNO_CMD_FILE_GET_DATA

Part Number: DLPNIRNANOEVM

Hello,

during the last few weeks, I tried to access a NIRScan nano via C# using HID-USB. This works fine so far: Now it is possible to read temperatures, to set the lamp, to start scans, to read the scan results and so on.

But I have still one last problem to solve: After each scan, I receive e.g. 512 bytes of scan data. How should the scan data received using NNO_CMD_FILE_GET_DATA  be interpreted? I know, there is already a method called dlpspec_scan_interpret(). But I can neither find the source code of this method in the example project nor a description of the data model in the EVM User's Guide.

I would be very grateful for a file which describes the structure and the data types of the scan data. A code snippet with the implementation of dlpspec_scan_interpret() would also be very helpful. What I have to know is the meaning and the type of each position in the returned data.

Thanks & Regards,

Simon

  • Hello Simon,


    Please allow us a few days to look into this question.

    Thanks,

    Kyle

  • Hi Simon, 

    There are 3 steps to read out the scans:

    1. Readout the Scan File Size by using the NNO_CMD_FILE_GET_READSIZE command. 
    2. Repeatedly run NNO_CMD_FILE_GET_DATA command and assemble the DATA part of the packet sent until you get a blob of the size you read in step 1.

    3. Use dlpspec_deserialize() to deserialize this blob into scan structure. 

    Hope we were able to resolve your query.

    Thanks & Regards,

    Hirak.

  • Hi Hirak,

    Thank You. Reading out the file size is working fine. Also assembling the data is no problem. But how can I now interprete the data? I get 512 Bytes. Are this hex coded floating point values? Or rather hex coded integers which have to be divided by e.g. 1000? How many numbers are contained? Are there different types e.g. int and float mixed up with each other?

    Could You please provide me a document or a code snippet which explains how to convert the array of bytes to a spectrum or a scan structure? I need to understand how dlpspec_deserialize() works.

    Thanks & regards,

    Simon

  • Hi Simon, 

    Kindly note the following: 

    1. You need to send the "NNO_CMD_FILE_GET_DATA " command REPEATEDLY until you form the entire packet of the size you get from NNO_CMD_FILE_GET_READSIZE command. You get 512 bytes from each packet, but you need to assemble multiple packets like this to form the whole scandata blob.

    2. You can look at the NIRScanNANO GUI Source code to learn how to use the deserializing function. 

    The prototype of the function is:

    DLPSPEC_ERR_CODE dlpspec_deserialize(void* struct_p, const size_t buffer_size,
    BLOB_TYPES data_type)

    Desc:

    Deserializes a blob in place for the passed in struct pointer @p struct_p.
    Upon return, @p struct_p holds a struct of the type determined by @p data_type.

     @param[in,out] struct_p pointer to the blob of data, returned as applicable struct.
     @param[in] buffer_size size allocated to blob
     @param[in] data_type blob type to be deserialized in place

     @return Error code

    Hope this helps, 

    Thanks & Regards,

    Hirak.