NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Using .NET Controller created types in TestStand

Hi,

 

I have a LabWindows/CVI created dll, which includes methods that contain types created by a .NET controller as parameters and return values. Ideally I would like to be able to hold onto a reference to these values in TestStand between steps in a sequence, but these types are obviously not supported in the TestStand environment. Does anyone know any/the best way to hold onto a reference to these types in TestStand?

Cheers

Chris 

0 Kudos
Message 1 of 15
(1,926 Views)

Chris,

 

what do you understand under the term "type"?

There are couple of possible solutions:

- Object reference (if the term "type" refers to handles of C# objects)

- Numeric (if the "type" is a handle to a memory address, this might be sufficient)

- String (using flatten/unflatten should work for any data type, but unflatten can lead to access violation and other blue screen issues if done inappropriatly)

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 15
(1,920 Views)

Sorry I don't think I was too clear in my first post. How do I get an object reference from CVI into TestStand. I have a method in my dll built in CVI which returns a .NET object in the form of the .NET assembly's ".NET controller" wrapper. I wish to call this method from TestStand and hold a reference to this object there. When selecting the method in TestStand I get this message:

 

"This function either does not have parameter information in the DLL or uses types not recognized by TestStand"

 

How do I teach TesStand about this type? Or do I have to convert it's form in the CVI code to some other recognized type then retrieve the object reference in TestStand.

 

I'm unfamiliar with both CVI and TestStand so am looking for some convention in how to do this.

 

Cheers

Chris

0 Kudos
Message 3 of 15
(1,917 Views)

Chris,

 

you have to populate the parameters on your own in this case. Using the C/C++ DLL or CVI adapter, you click the '+' symbol for adding a new parameter. Make sure that the data type matches the header information of the function.

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 15
(1,915 Views)

I can see how this is done for input parameters (Infact it is done for me).  However for the return value I do not have the option to define the data type to the type defined in the header information (C Struct). Am I missing something?

 

Cheers

Chris

0 Kudos
Message 5 of 15
(1,913 Views)

Chris,

 

you can build "containers" in TestStand as type definition. After creating a variable of this type, you should be able to use this as parameter.

Read the TestStand help regarding creating custom data types. Please remember to configure the data type to be compatible to C/C++ structs.

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 15
(1,909 Views)

The return value parameter will not let me specify any type that isn't void, int or a handle. Handle lets me define an value expression that is an object reference, however this is not assigned when the sequence is run. The method signiture will not allow me to put a custom type as a return value either. So I'm still unable to get the return object of my method into TestStand.

 

Is there any more information I can give to help?

 

Cheers

Chris

0 Kudos
Message 7 of 15
(1,903 Views)

Chris,

 

1) Are you wanting to use the .NET object with the .NET Adapter, or just hold onto it in TestStand for use with a later CVI step?

2) Return values are limited to the types you described, output parameters are less limited, but I'm not sure passing a .NET object as a struct is really going to work.

3) What versions of TestStand and CVI are you using?

 

-Doug

0 Kudos
Message 8 of 15
(1,901 Views)

1) Hold it in TestStand for use with a later CVI step.

2) I was thinking about trying this as my next step. But wanted to know if I could do it with a regular return value first.

3) TestStand 2010 SP1 & CVI 2010 SP1

0 Kudos
Message 9 of 15
(1,899 Views)

Chris,

 

can you post the prototype of the CVI DLL function you want to call (header information)?

It is important that we can see what type of data you configured in your CVI code.

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 10 of 15
(1,872 Views)