NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

TS_EngineGetProperty to get globals

Using Lab Windows CVI5.5 And TestStand
 
Creating dll in CVI and passing in RunState.Engine from teststand to the CVI routine.  The handle works fine to to access the sequence file name through the call:
TS_EngineGetSeqFile (objectHandle, &errorInfo, szSeqPath, 0, &seqFile);
 
I'm trying to use the same engine state context handle to access the teststand global variables.
 
int CVIFUNC SequenceCalculateCRC (CAObjHandle objectHandle, char szSeqPath[],
                          char szLimitsPath[], char szSupportPath[],
                          unsigned long *sw_checksum,
                          unsigned long *test_checksum, char szError[])
{
 int     error = 0;
 ERRORINFO    errorInfo = {0,0,'\0','\0','\0',0,0};
 char *    pszKeyName;
 CAObjHandle   GlobalsHandle;
    error = TS_EngineGetProperty (objectHandle, &errorInfo,
             TS_EngineGlobals, CAVT_OBJHANDLE,
             GlobalsHandle);
    error = TS_PropertyGetValString(GlobalsHandle, &errorInfo,
                "StationGlobals.SequenceFamily.Family", 0,&pszKeyName);
return 0;
}
 
***This compiles to an error ***
  196, 60  Type error in argument 5 to `TS_EngineGetProperty'; found 'CAObjHandle'
           expected 'pointer to void'.
If I force around by casting GlobalsHandle to a (void *) it will compile, but then the
TS_PropertyGetValString function results in an error of
0x80070006 "Invalid handle"
 
Does anybody have an example of how  TS_EngineGetProperty should be used?
0 Kudos
Message 1 of 3
(2,855 Views)
Nevermind:
 
 
showed the two problems:
#1) I didn't have "&" on the variable
#2) the global reference was "StationGlobals.SequenceFamily.Family" and it should be "SequenceFamily.Family"
 
Evidentally only stationglobals can be accessed.
 
Does anybody know if Fileglobals can be accessed through the Engine context handle?
0 Kudos
Message 2 of 3
(2,852 Views)
Hi,
 
From the engine handle, you will need to get a reference to the sequencefile and then an handle to the FileGlobals.
 
Alternatively, from the the engine handle, get a reference to an PropertryObject and use the full Lookup String to access the object vi GetVal and SetVal, eg "FileGlobals.MyString" when using PropertryObject.SetValString(engine, "FileGlobals.MyString", 0, "My New Value");
 
hope this helps
Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 3 of 3
(2,839 Views)