NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to obtain a socket execution reference in CVI?

Hi:

I'm trying to set run time variables for socket executions from the controlling Test UUTs execution of the parallel model. I'm trying to do this in the panel callbacks of modelsupport2.dll in CVI. Here is the code snippet:

    TSObj_Property rtvobj;
    char varPath[512];
    CAObjHandle execution = 0;
 
    sprintf(varPath,"FileGlobals.TestSocketExecutions[%i]",testSocket); // testSocket number passed in as a parameter
    TS_PropertyGetPropertyObject(seqContext, NULL, varPath, 0, &execution); // sequence context passed in as reference
    TS_ExecutionGetRunTimeVariables (execution, NULL, &rtvobj);    

    When run in debug mode, I can see a reference number is returned for the execution handle. However, rtvobj is always zero.
   
    What am I missing?

Thanks,
Dave
0 Kudos
Message 1 of 6
(3,639 Views)
Hey Dave,
 
What is being printed for you varPath when you call the sprintf function?  Can you stop and see what it is set to right before you call the TS_ExecutionGetRunTimeVariables? 
 
Thanks,
 

Message Edited by Sam R on 09-06-2007 11:46 AM

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 6
(3,610 Views)

Sam,

The reason you can't find GetRunTimeVariables is that RunTimeVariables is an Execution property.  The Get is added by the CVI API wrapper (tsapicvi.*) when it wraps the property-read with a C function.

Search the help for RunTimeVariables or just look at the properties of the Execution class.

0 Kudos
Message 3 of 6
(3,606 Views)
Hi:

> What is being printed for your varPath when you call the sprintf function? 
'FileGlobals.TestSocketExecutions[1]' if I'm using test socket 1.

> Also, what version of TS are you using?  I don't see the ExecutionGetRunTimeVariables function in 3.5 or 4.0.
I'm using Teststand 3.5, and we're moving to Teststand 4 next month, so this needs to work in either one. The TS_ExecutionGetRunTimeVariables function is in the NI Teststand API 3.5 instrument.

Thanks,
Dave
0 Kudos
Message 4 of 6
(3,594 Views)

Hey Dave,

My Bad!!  I see that function now. 

So basically, and I haven't tried this yet, I'm wondering why you wouldn't use the GetValIDispatch function instead of the GetPropertyObject function.  This will give you a handle to the execution as opposed to the property object value of the execution.

I got it to work in LabVIEW (I know I'm just not good with CVI 🙂 using the IDispatch.  What I did was add a variable and then read that variable's value and send it back to my process model.

Regards,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 5 of 6
(3,587 Views)
I changed
    TS_PropertyGetPropertyObject(seqContext, NULL, varPath, 0, &execution);
to
    TS_PropertyGetValIDispatch (seqContext, NULL, varPath, 0, &execution);

and now everything works. Thanks for your help!
- Dave
0 Kudos
Message 6 of 6
(3,581 Views)