LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading variables from TS sequence

I have a CVI program that starts TestStand engine and then executes a sequence. I try to read and set variable values in sequence that I want to execute from CVI code. However TS_PropertySetValString returns error and I suspect it is because of wrong object handle.
 
Examples I have seen about TS_PropertySetValString so far use seqContextCVI of CAObjHandle type, for example:
 
void __declspec(dllexport) __stdcall NumericLimitTest( CAObjHandle seqContextCVI, short *errorOccurred,
    long *errorCode, char errorMsg[1024])
{
    int         error = 0;
    ErrMsg      errMsg = {'\0'};
    ERRORINFO   errorInfo;
   
        // This accesses the Numeric Result of the step that called this function.    
    tsErrChk(TS_PropertySetValNumber(seqContextCVI, &errorInfo, "Step.Result.Numeric", 0, (10 * rand()) / RAND_MAX));
Error: 
        // If an error occurred, set the error flag to cause a run-time error in TestStand.
    if (error < 0)
        {
        *errorOccurred = TRUE;
   
        *errorCode = error;
        strcpy(errorMsg, errMsg);
        }
}
 
 
I think here seqContextCVI is passed from calling TestStand sequence that uses this DLL. But what if I start the sequence from my executable? Is there Sequence Context available in that sequence and if there is, how can I access it so I could use it to read/set other sequence variable values? Or do I need Sequence Context at all, can I use some other way?
 
Best regards,
 
Jan
0 Kudos
Message 1 of 2
(3,013 Views)
I have studied this but no luck so far 😞
 
This is what I want to do:
 
1. start CVI executable
2. CVI executable starts Teststand engine
3. CVI executable loads sequence
4. CVI executable sets several locals and fileglobals on sequence
5. CVI executable starts sequence execution
 
Now I'm stuck at 4 because I think I need Sequence Context of sequence to be able to access the locals and fileglobals. And I have not figured out how to obtain the Sequence Context to CVI executable.
 
I think this might be alternative:
 
1. start CVI executable
2. CVI executable starts Teststand engine
3. CVI executable loads sequence
4. CVI executable executes sequence
5. sequence calls CVI DLL (User interface) and passes Sequence Context to it
6. CVI DLL sets several locals and fileglobals on sequence
7. CVI DLL starts sequence execution
 
But I have no idea if that works any better.
0 Kudos
Message 2 of 2
(2,979 Views)