NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

how do i pass session handlers to test stand?

Solved!
Go to solution

I tried the examples, but couldn't learn anything useful.

 

I have a DLL from LabWindows/CVI of the following and I'm able to use (select) the DLL functions in Action Steps in TestStand.

 

int DLLEXPORT OpenSession (unsigned long *session, signed long *ErrorCode, char *ErrorMessage)
{
 
 *session = fnThatReturnsInt(0,OPT1,1,1);

 
 return 911;
}

 

int DLLEXPORT CloseSession (unsigned long sessionHandle, signed long *ErrorCode, char *ErrorMessage)
{

 deviceSessionCloserFn(sessionHandle, 0);
 
 return 912;
}

 

The C tester works excellent. How do I tell TestStand to store/use that session in following Action Steps from the same DLL?

 

Many thanks!

0 Kudos
Message 1 of 6
(4,461 Views)

Feeling more like Mr. Edison... "I have not failed. I've just found 10,000 ways that won't work."

 

Any guidance in the right direction or outright solution is 10000x appreciated!

0 Kudos
Message 2 of 6
(4,447 Views)

In LabVIEW there are two function to pass a session to teststand and back again called "Session to RefNum" and "RefNum to Session". Cannot remember if you have something similar for CVI. You can look in the Utilities library.

Regards
Ray Farmer
0 Kudos
Message 3 of 6
(4,438 Views)
Solution
Accepted by topic author ObiCaban

Hey ObiCaban,

 

Is it possible to pass in the session 'By Reference' as a parameter in the module settings of TestStand? 

 

Kind Regards, 

 

Luke W

0 Kudos
Message 4 of 6
(4,434 Views)

Checking both answers... Will let you know. Thanks!

0 Kudos
Message 5 of 6
(4,419 Views)

It is as easy as passing the referernce! Thanks!

 

I was doing it wrong. One has to make sure the session is being handled correclty in the dll.

 

Then, in TestStand one passes the session reference (aka pointer) as a PARAMETER variable. In my case it was a numeric reference. It ended up being something like "Parameter.session", Number (by reference)

 

I called the DLL function that assigned the value to the session before calling the other functions, of course.

 

Thanks, all!

 

Please forgive my ridiculous delay to reply back.

0 Kudos
Message 6 of 6
(4,369 Views)