11-23-2016 04:48 AM
Hello,
I want to get the value of few variables (type number) fro the Station Globals of TestStand.
I have CVI 2013 / WIN7
I did this :
TSerrChk(TS_SeqContextGetStationGlobals (rSequenceContext, NULL, &rStationGlobalsLocalsObject)); //Chech if C1_CTR_LSR_POW_A is liseted on TestStand TSerrChk(TS_PropertyExists (rStationGlobalsLocalsObject, &errorInfo, "C1_CTR_LSR_POW_A", 0, &iExists)); if(iExists == -1) { TSerrChk(TS_PropertyGetValNumber (rStationGlobalsLocalsObject, &errorInfo, "C1_CTR_LSR_POW_A", 0, &gPowA)); } else //Variable doesn't exist { sprintf(&pcReportTxt[strlen(pcReportTxt)], "Var not found : %s\n", "C1_CTR_LSR_POW_A"); *piStepResult = FAIL; error = -1; goto Error; }
The problem is that I get always Zero in my variable gPowA.
Any idea please ?
11-28-2016 11:22 AM
Hi Houssam_AZ,
I found another forum post that might be helpful. Basically it says that you can access Station Globals using the Engine API commands (EngineGetGlobals or SeqContextGetStationGlobals). I've included the link below
http://forums.ni.com/ni/board/crawl_message?board.id=330&message.id=14008
This is an Example VI draft about using these functions as well that might give some more context:
11-30-2016 11:58 AM
Hi,
You can use the get val variant call
tsErrChk (TS_PropertyGetValVariant(sequence, &errorInfo, "StationGlobals.StationInfo.TestStationSerialNumber", 0, &stationNum)); CA_VariantConvertToType(&stationNum, CAVT_CSTRING,&strTmp); sprintf(szStationNum, "%s",strTmp);CA_FreeMemory(strTmp);
Hope this helps,
Curt
12-02-2016 02:57 AM
Hello,
@Jorr-El, Thank you but both links are dead.
12-02-2016 02:59 AM
Hello Curt_C,
Thank you. I'm using exclusively string properties, to get value the faster way possible.
I will try this any way, Variant are much more powerfull.
12-02-2016 06:08 PM
Hi Houssam_AZ
Hopefully this link will still work after I've posted my reply. This is an example program demonstrating how to access TestStand Station Globals in CVI.
This link is a related forum post regarding accessing StationGlobals, which may be helpful to look through as well.
This is the example from the first link if the link doesn't work again for some reason.
#include "tsadpcvi.h" TSObj_PropertyObject TS_Globals; char* LastUserName; //accessing TS StationGlobals tsErrChk(TS_EngineGetGlobals (gMainWindow.engine, &errorInfo, &TS_Globals)); tsErrChk(TS_PropertyGetValString (TS_Globals, &errorInfo, "TS.LastUserName", 0, &LastUserName)); Note that the handle to the engine has already been created in the example TestExec.c source file tsErrChk( TSUI_ApplicationMgrGetEngine(gMainWindow.applicationMgr, &errorInfo, &gMainWindow.engine));
12-06-2016 02:45 AM
Hello Jorr-El,
Thank you for your reply.
New links works good. I'm gonna try that and make a feedback.