10-10-2006 04:19 AM
TS_SeqFileGetSequenceByName(ModelFileObj, &errorInfo, "Single Pass", &SequenceObj);There is no problem starting it without a ProcessModel this way:
if (SequenceObj != 0) {
TS_EngineNewEditArgs(hEngine, &errorInfo, &EditArgsObj);
if (EditArgsObj != 0) {
TS_EditArgsSetSelectedSeqFile(EditArgsObj, &errorInfo, SequenceObj);
errChk(CA_GetInterfaceFromObjHandle(EditArgsObj, &IID_IDispatch, 0, &EditArgsPtr, NULL));
EditArgsParam = CA_VariantDispatch(EditArgsPtr);
tsErrChk(TS_EngineNewExecution(hEngine, &errorInfo, TestSeqObj, "Single Pass",
ModelFileObj, VTRUE, TS_ExecTypeMask_Normal|TS_ExecTypeMask_NotRestartable, CA_DEFAULT_VAL,
EditArgsParam, CA_DEFAULT_VAL, &ExecutionObj));
....
tsErrChk(TS_ExecutionAddPostStepCustomUIMessage(ExecutionObj, &errorInfo, TS_UIMsg_PostStep, "True",
TS_CustomUIMsgOptions_AppliesToAllThreads));
tsErrChk(TS_ExecutionGetForegroundThread(ExecutionObj, &errorInfo, &ThreadObj));
tsErrChk(TSUI_SequenceFileViewMgrRun(hSequenceFileViewMgr, &errorInfo, CA_DEFAULT_VAL, &ExecutionObj));But this is only a fallback and I need the ProcessModel.
tsErrChk(TSUI_ExecutionViewMgrTerminateExecution(hExecutionViewMgr, &errorInfo));Before shutting down the Engine all objects will be released like that (in the reverse order of creation):
tsErrChk(TS_EngineAbortAll(hEngine, &errorInfo));
tsErrChk(TS_EngineTerminateAll(hEngine, &errorInfo));
tsErrChk(TSUI_ApplicationMgrCloseAllExecutions(hApplicationMgr, &errorInfo));
if (hSequenceContext) CA_DiscardObjHandle(hSequenceContext);Next section won't close the SequenceFile, although it say CanUnload=ok:
if (CommandObj) CA_DiscardObjHandle(CommandObj);
if (ThreadObj) CA_DiscardObjHandle(ThreadObj);
if (EditArgsObj) CA_DiscardObjHandle(EditArgsObj);
if (TestSeqObj) {
error = TS_SeqFileGetCanUnload(TestSeqObj, &errorInfo, &ok);
error = TS_SeqFileUnloadModules(TestSeqObj, &errorInfo, &unloaded);
error = TS_EngineReleaseSeqFileEx(hEngine,&errorInfo,TestSeqObj,
TS_ReleaseSeqFile_UnloadFileIfModified|TS_ReleaseSeqFile_DoNotRunUnloadCallback|TS_ReleaseSeqFile_UnloadFile, &removed);
error = TSUI_ApplicationMgrCloseSequenceFile(hApplicationMgr, &errorInfo, TestSeqObj, &closed);<<< Is closed properly
error = CA_DiscardObjHandle(TestSeqObj);
}
if (SequenceObj) {
error = TS_SequenceUnloadModules(SequenceObj, &errorInfo, &unloaded);
error = CA_DiscardObjHandle(SequenceObj);
}
TSUI_ApplicationMgrOpenSequenceFile(hApplicationMgr, &errorInfo, filename, &TestSeqObj);Finally, the Engine will be shut down:
TS_SeqFileGetModelSeqFile(TestSeqObj, &errorInfo, &ModelDescription, &ModelFileObj);
if (ModelFileObj) {
TS_SeqFileGetCanUnload(ModelFileObj, &errorInfo, &ok);
TS_SeqFileUnloadModules(ModelFileObj, &errorInfo, &unloaded);
TS_EngineReleaseSeqFileEx(hEngine,&errorInfo,ModelFileObj,
TS_ReleaseSeqFile_UnloadFileIfModified|TS_ReleaseSeqFile_DoNotRunUnloadCallback|TS_ReleaseSeqFile_UnloadFile,
&removed);
TSUI_ApplicationMgrCloseSequenceFile(hApplicationMgr,&errorInfo,ModelFileObj,&closed); <<< always DISP_E_EXCEPTION
CA_DiscardObjHandle(ModelFileObj);
TSUI_ApplicationMgrGetExecutions(hApplicationMgr, &errorInfo, &hExecutions);
TSUI_ExecutionsGetNumIncomplete(hExecutions, &errorInfo, &num); <<< always 0
TSUI_ExecutionsGetNumPaused(hExecutions, &errorInfo, &num); <<< always 0
TSUI_ExecutionsGetNumRunning(hExecutions, &errorInfo, &num); <<< always 0
if (hExecutions) CA_DiscardObjHandle(hExecutions);
CA_DiscardObjHandle(hEngine); <<< this brings up the popupAdditionally, I use the ApplicationMgr->DisplayExecution Event and changed it like it was adviced in the LabView solution (which was my great hope but didn't change anything):
CA_DiscardObjHandle(hApplicationMgr);
ApplicationMgr_OnDisplaySequenceFile(...);If there is no solution to that, is there a workaround to get rid of this $%§& popup ?
ApplicationMgr_OnDisplayExecution(...);
ApplicationMgr_OnUIMessageEvent(...);
ApplicationMgr_AfterUIMessageEvent(...);
ApplicationMgr_OnExitApplication(...);
ExecutionViewMgr_OnRunStateChanged(...);
ExecutionViewMgr_OnEndExecution(...);
10-11-2006 02:09 PM
Hi,
Looking at the way you obatin your reference to the Model Process, I dont think this is the correct way.
You should get a reference to the SequenceFile you want to open, which would be the TestSequence file, then use this reference to get a reference to the Process Model sequence file by using TS_SeqFileGetModelSeqFile(). If the sequencefile you have opened has a Process Model SequenceFile associated with it then you can use the SequenceFile Object reference returned. If no Process Model associated with your Test Sequence File, you can only run the Sequences in the TestSequence file without the Process Model. eg "Run MainSequence"
You can then plug this into your NewExecution along with all the other references and the "Single Pass" name of the sequence to run.
I dont think you should be obtaining you reference to the Process Model by using the TS_SeqFileGetSequenceByName().
Any I shall keep looking.
Regards Ray Farmer
10-11-2006 02:10 PM
Hi (again),
Although this is CVI, its mainly a TestStand function and it would have been better to post this in the TestStand forum.
Regards
Ray Farmer
10-12-2006 03:50 AM
tsErrChk(TSUI_ApplicationMgrOpenSequenceFile(hApplicationMgr, &errorInfo, filename, &TestSeqObj));Next step is to prepare the TS_EngineNewExecution. My fault was to think it needs an EditArgsObj. I simply removed it with all the preparation before and...it works !!!
ModelFileObj = 0;
TS_SeqFileGetModelSeqFile(TestSeqObj, &errorInfo, &ModelDescription, &ModelFileObj);
if (ModelFileObj == 0) TS_EngineGetStationModelSeqFile(hEngine, &errorInfo, &ModelDescription, &ModelFileObj);
if (ModelFileObj != 0) { ...