NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

[Problem] Cannot get TS_EngineCommitGlobalsToDisk to work (TestStand 3.5)...

Solved!
Go to solution

I have CVI based DLL that displays a panel for operator entered values.  I then store these in a StationGlobal structure.  It seems that the actual ini file is not updated unless you complete the sequence.  If terminate it, it does not get the latest memory version of the StationGlobals.  I found the function TS_EngineCommitGlobalsToDisk and added the following function to my DLL which I then call after the panel has closed:

 

void  CommitInformation (int promptOnSaveConflicts,
                         CAObjHandle seqContextCVI,
                         char *reportText,
                         short *errorOccurred,
                         long *errorCode,
                         char errorMsg [1024])
{
  int error = 0;
  ERRORINFO errorInfo;
  ErrMsg errMsg = {'\0'};
 
  tsErrChk (TS_EngineCommitGlobalsToDisk (seqContextCVI, &errorInfo, (VBOOL)promptOnSaveConflicts));
 
Error:
  // If an error occurred, set the error flag to cause a run-time error in TestStand.
  if (errorInfo.wCode < 0)
  {
    *errorOccurred = TRUE;
    *errorCode = errorInfo.wCode;
    sprintf (errorMsg,
             "Source     : %s\n"
             "Description: %s\n",
             errorInfo.source,
             errorInfo.description);
  }
}

Now when it runs "error" contains a massive negative number, but errorInfo does not contain any errors.  The StationGlobals are also not saved.  What am I doing wrong?

Christopher Povey

Principle Test Systems Engineer for BAE Systems.
0 Kudos
Message 1 of 3
(2,876 Views)
Solution
Accepted by topic author ChristopherPovey
Fixed it.  Well kind off.  I deleted the function from the CVI DLL and used an ActiveX/COM step in TestStand and called the CommitGlobalsToDisk from there!
Christopher Povey

Principle Test Systems Engineer for BAE Systems.
0 Kudos
Message 2 of 3
(2,867 Views)

It looks like your problem was that you were passing a SequenceContext to an Engine method. You have to pass a handle to the Engine. If you don't have an Engine handle handy, you can always get it from the context.

 

In general, the name of a CVI function for a TestStand method  is TS_<interface name><method name>, though in some cases the it might be abbreviated. As an example of abbreviation, TS_PropertyGetValBoolean is a method on the PropertyObject interface, there is no Property interface.

0 Kudos
Message 3 of 3
(2,862 Views)