08-31-2022 10:53 AM
Dear all,
Working with CAN communication, I am trying send an array of CAN message objects between my C# dll and TestStand.
The message object is a struct:
public struct MessageForTestStandBis
{
public Int64 msgSize;
public String msgID;
public String msgName;
public String msgNode;
public String[] timestamp;
public SignalForTestStand[] signals;
}
And the message object contains an array of signals, a signal is defined as:
public struct SignalForTestStand
{
public UInt16 sigStartBit;
public UInt16 sigLength;
public Decimal[] sigValue;
public Double sigLimitMinimum;
public Decimal sigLimitMaximum;
public Decimal sigFactor;
public Decimal sigOffset;
public String sigName;
public String sigUnit;
public String sigByteOrder;
public Int32 countOfBytesContainingData;
public UInt16 indexOfTheStartByte;
public UInt16 indexOfTheEndByte;
}
When trying to get an array of MessageForTestStandBis into TestStand, I am getting this error:
But I did create the SignalForTestStand type and MessageForTestStandBis type with the "Create custom data" button from the function and I am sure both types are created properly.
At first, with MessageForTestStandBis type, TestStand had created automatically an array of Containers for the "Signals" field but I have manually changed it into an array of SignalForTestStand.
If I try to get only the array of SignalForTestStand with another function into TestStand, it works good.
If I remove the array of SignalForTestStand from the MessageForTestStandBis, then I can also successfully get an array of MessageForTestStandBis into TestStand.
However it seems impossible to transfer the array of MessageForTestStandBis when each MessageForTestStandBis includes an array of SignalForTestStand.
I can of course get both arrays (MessageForTestStandBis (without signals) and SignalForTestStand) separately and build them again together into TestStand but it's quite an ugly solution and more time consuming which is an important matter for my application.
A colleague of mine has told me it's not possible to transfer an array of an array between a C# dll and TestStand (which is basically what I am trying to do).
I would like to check with the NI community whether someone knows if and how it would be possible?
Best regards,
Ludovic
08-31-2022 06:00 PM
AFAIK, you cannot pass complex data structures between C# dll and TestStand