Activating locks using TestStand API

Hello,
I have a question... how do I lock and unlock a lock, created in TestStand, in Visual Basic (by using the teststand API)?
Greetz Jan Toebes

Hello,
To understand you correctly you are trying to perform a lock or unlock through Visual Basic. For this you have to use the synchronization server, which has a different API for itself. You can get more information about this under "TestStand Supplemental Reference Help" section in the TestStand Help.
For simplicity sake, lets assume that you have a lock step created in teststand and you want to perform an unlock using Visual Basic.
To perform this task, you need the SyncManager. This is the main class for all Synchronization objects. This class helps manage the creation and sharing of the different Synchronization objects between threads. You must create all Synchronization objects using this class.
To get the appropriate instance of the TestStand Synchronization Manager call the Engine.GetSyncManager TestStand API method. The Engine.GetSyncManager method returns the TestStand Synchronization Manager for the appropriate process based on the name of the Synchronization object. So the call would be
SyncManager = Engine.GetSyncManager(* Name_of_the_lock_Step)
where the Name_of_the_Step is the actual name of the lock step that we created in TestStand. The "*" before that indicates that this lock step was created in a separate thread and is being shared.
Now Mutex is the class that implements the Lock synchronization and is used to implement the Lock step type in TestStand. So using the SynCManager will get an instance of this Mutex class by using:
Mutex = SyncManager.GetMutex(* Mame_of_the_lock_step)
Now using Mutex you can perform an unlock by using:
Mutex.EarlyUnlockMutex ( threadId)
Please refer to the help for more information regarding these functions. I hope this helps.
SijinK
National Instruments

Similar Messages

  • Using ActiveX controls in GUI application, which uses TestStand API

    When using ActiveX controls in TestStand Operator Interface GUI,
    CVI reports User Interface Library error no.-143:
    "ActiveX control Error" on attempt to load panel, which contains ActiveX controls.
    The same code, which takes care of user interface, but not references
    TestStand ActiveX API (i.e. not creates TS Engine), works properly.
    What's wrong?

    Hello again Misha,
    Sorry about my previous answer, I overlooked the fact that you were saying this error was caused by placing ActiveX controls in your Operator Interface (OI) GUI (as my example shows I thought the problem was with GUIs displayed from step code modules).
    Nevertheless, the problem is still being caused by the same issue, and is solved in a similar fashion. The source for the CVI OI initializes the TestStand engine before it loads/displays the UI panels. The calls to initialize the engine seem to be CoInitializing the main GUI thread as multithreaded apartment (MTA) mode whereas you will need it to be single threaded apartment (STA) mode in order for the ActiveX control container to work properly. The TestStand engine is compatible with either modes, but only one can be in place at a given time. If we CoInitialize the OI's main GUI thread as STA this will solve the problem (the subsequent attempts of setting it to MTA will fail, but again this is ok since the engine is compatible with STA).
    In order to perform this functionality you will need to put a call to CoInitializeEx in the main function of the CVI OI source (this will also require that you #include the "windows.h" file at the top of the source also). Here is what the main function in your main.c file for the CVI OI will look like once you have done this:
    int main(int argc, char **argv)
    int retval = -1;
    sArgc = argc;
    sArgv = argv;
    if(InitCVIRTE(0, argv, 0) == 0) /* Initialize CVI libraries */
    goto Done; /* out of memory */
    // Intialize main GUI thread as STA to prevent other attempt to make it
    // MTA, which will not allow ActiveX controls to be used.
    CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
    /* initialize the test engine */
    if(!InitEngine())
    goto Done;
    if(!InitErrorDialogStrings())
    goto Done;
    if(!InStandaloneExecutable() && !DisplayRunningInEnvironmentWarning())
    goto Done; // get out now
    if(!ProcessPreLoginCmdlineArgs())
    goto Done;
    if(!CfgFile_Load())
    goto Done;
    if(!CfgFile_RestoreOptionSettings())
    goto Done;
    if(LoadGUIPanels() < 0)
    goto Done;
    if(!InitFileQuickList())
    goto Done;
    /* set initial gui state */
    if(!InitGUI())
    goto Done;
    RunUserInterface();
    retval = 0; /* normal exist status */
    Done:
    /* cleanup */
    SeqFileList_DeleteAllSequenceFileRecords();
    ExeList_DeleteAllRecords();
    IconList_DeleteIconList();
    SaveAndCleanupFileQuickList();
    CfgFile_SaveOptionSettings();
    CfgFile_WriteAndCleanupForExit();
    AdaptList_DeleteAdapterList();
    DestroyToolMenus();
    CloseEngine();
    FreeErrorDialogStrings();
    return retval;
    Note: Remember to #include "windows.h" at the very top of the main.c file and to include ole32.lib in your project file list in order to link in the definition for CoInitializeEx.
    Jason F.
    Applications Engineer
    National Instruments
    www.ni.com/ask

  • Using TestStand API Engine to programatically set watch expressions?

    I would like to auto populate the Watch Expression window when I start a sequence. This would allow the test developer to set up a list of variables once and have them available all the time, for troubleshooting. I see references in Test Stand help to insert, remove, clear, etc, but I haven't been able to figure out how to access them. Getwatchexpressions is all I can find, so far. I have looked in TS 3.5 and 4.

    That was the hint that I needed. I am attaching a simple sequence that populates a watch expression. May be useful for others.
    Attachments:
    testwatch.seq ‏20 KB

  • How can I create a custom data type that is a 2D array of string by using TestStand API?

    Hi all,
    I'm new in TestStand:
    I'm able to create a custom data type that is a 1D array of string but I cannot find the way to create a 2D array of string.
    Can anyone help me?
    Thank you in advance.
    Federico

    I made it!!
    Indeed my 2D array is an item of a container:
    /*  Create a new container */
    RunState.Engine.NewPropertyObject(Locals.NewDataType,PropValType_Container,False,"",0)
    /*  Create an array of strings as item of the container */
    Locals.NewDataType.NewSubProperty("Array_2D",PropValType_String,True,"",0)
    /*  Reshape the array as an empty 2D array */
    Locals.NewDataType.GetPropertyObject("Array_2D",0).Type.ArrayDimensions.SetBoundsByStrings("[0][0]","[][]")
    being:
    NewDataType a local property (type Object)
    Attachments:
    AddCustomTypeAndCreateFileGlobals.seq ‏11 KB

  • Due date update using GP APIs?

    Hi all
    I am working on the Due date update using GP APIs, I have done it at the "process" level. However I dont know how to trigger it at an activity level using GP APIs.
    Please tell me how to gain access to the Activity (Action) instance of the next processor from the current one? I have set the Due date statically at the process and activity level. Now I wish to allow the user to change the due date dynamically using GP APIs at the <b>activity</b> level.
    Ideas pls......
    regards
    LNV

    An other one!! I have set the due date manually in the process yet I dont see it in the UWL. Any thoughts on this? Thanks again.

  • Teststand api Creating/deleting Users

    Hi,
    I am using Teststand API with Labwindows and i have a problem with creating/deleting Users.
    In fact, to explain easily my problem when you use the full-featured Teststand  with the "CreateDeleteUsers.seq" sequence and create a user, then close the full-featured Teststand, you loose your new users in the previous opening.
    Whereas, with the Teststand 4.0, with the same "CreateDeleteUsers.seq", when you close, it propose to save the changed file "UserManagement" (Users.ini) and everything's fine...
    And as i am using a Labwindows project to login/logout to teststand, i am using TS_... functions i can't find a way to save or to have this save popup to keep my users.
    I hope that i am clear, and that someone will be able to help me ! 

    Hello,
    As you could see in the following KB: How Can I Edit and Save Changes for the Current User? you have to get the users file as a PropertyObjectFile as it's done in the CreateDeleteUsers sequence, and then use two methods, IncChangeCount() wich is also already done in the example sequence, and the SaveFileIfModified().
    See attached file below for the example sequence changed with the file saving.
    Regards,
    Olivier L. | Certified LabVIEW Developer
    Attachments:
    CreateDeleteUsersAndSave.seq ‏11 KB

  • Passing struct to DLL using TestStand

    I would like to pass structures to the function call in the DLL. Does Test stand supports passing structured.
    I have a function prototype like this
    LONG _stdcall ReadData(HANDLE hInstance, pDataStruct Trans);
    #pragma pack(push, 1)
    typedef struct _DataStruct {
    BYTE Type;
    BYTE DevAddr;
    WORD wMemoryAddr;
    WORD wCount;
    BYTE Data[256];
    } DataStruct , *pDataStruct ;
    #pragma pack(pop)
    I would like to display the Data filed after the function call.
    remaining parameters to the structure are inputs.
    Please point me to any tutorial on TestStand that can help me or Give me a detailed instructions on how to configure it.
    Thanks in advance.
    Lak

    There is a "StructPassing" example in the TestStand/examples folder. It shows how you can pass the struct to DLL function. Additionally, you can access the struct using TestStand API.
    Yevgeny

  • HT1920 I have got a Activation Lock on my iPhone and I need to get it activated. I don't know what Apple ID I was using with my iPhone. It shows as U***@h******.uk which is too short to be my email address. I have reset all my Apple ID passwords and none

    I have got a Activation Lock on my iPhone and I need to get it activated. I don't know what Apple ID I was using with my iPhone. It shows as U***@h******.uk which is too short to be my email address. I have reset all my Apple ID passwords and none are activating my iPhone. I have also been into the apple store and they have tried to find out the Apple ID my iPhone was using but this was not successful. The serial number of my iPhone is: C32JN641DTWF

    You are going to need to change the email address you use with your old ID. Once you have got access to your old account you will then log into both accounts at the same time on your Mac and transfer your data to a single account. We can do this later, but need you to get access to your old account first.
    My Apple ID

  • Plug_in:how to unlock a locked document use acrobat API

    how to unlock a locked document use acrobat API.in acrobat plug_in

    how to unlock a locked document use acrobat API.in acrobat plug_in(Which API can enter a password to unlock the locked document)

  • Hii all, I just bought an used iphone 5c from an user and only after a few weeks realised that it got activation locked. He might be unaware of that. Is it possible to get back to him and unlock the device for me as i have not contacts with him presently.

    Hii all, I just bought an used iphone 5c from an user and only after a few weeks realised that it got activation locked. He might be unaware of that. Is it possible to get back to him and unlock the device for me as i have not contacts with him presently.

    Well first you need to sync your iPhone 4 with your Mac/PC so that it will transfer all your music, apps, podcasts, etc. Then sync your iPod Touch and the media you selected during the sync should be there on your iPhone. If you have difficulty in transferring media from iPhone to your computer, try softwares like TransCopy. They will help in transferring data from your iphone to your computer. Dont forget to check that all the transferred data is in the iTunes media folder so that the iTunes can locate the files. Link to Transcopy software :
    http://www.copytrans.net/copytrans.php

  • How to use java api for function activity in embed oracle workflow?

    because i can't install standalone oracle workflow successfully.
    pls tell me how to use java api for function activity in embed oracle workflow?
    are there some patch or pulg-in package?
    ths a lot...........

    The Java Function Activity Agent is not certified for Oracle Workflow embedded in Oracle Applications. Installing standalone workflow should be a lot easier than what you have found, although it looks like you did hit a Pentium 4 issue with the Oracle Universal Installer. I suggest you contact Oracle Support or Oracle Consulting for assistance.
    because i can't install standalone oracle workflow successfully.
    pls tell me how to use java api for function activity in embed oracle workflow?
    are there some patch or pulg-in package?
    ths a lot...........

  • Using TestStand Engine API in LabVIEW

    Hi all,
    I am currently working for a proejct where automation of testing is involved, For which NI LabVIEW and TestStand are used. My previous experience is in LabVIEW only and not in TestStand. In the current project I have to develop a UI where user can select the test sequences and execute them  automatically with a simple start command. So I thought to develop a UI in LabVIEW where I will call TestStand APIs in LabVIEW. I have a developed a code by calling the TestStand APIs and able to execute the sequence, but unable to generate the report. Does  any have stuff where in TestStand APIs are called in LabVIEW and test report is generated.
    As I mentioned earlier I haven't worked much in TestStand. I have gone through the TestStand examples like Simple UI. But it didn't helped me much.
    To put our project requirement in simple.
    1.It should  have the UI to select the TestCases (Test Sequences) and an option to select the no.of times the test cases needd to be executed.
    2. It should generate the reports for all the test cases.
    3. UI should support localization.
    Considering the above requirements I have thought to develop UI in LabVIEW calling the TestStand APIs. I also got to know that UI can be developed using TestStand, but I am not sure whether the above mentioned requirments can be fullfilled or not.
    I am attaching the VI what I have developed in the LabVIEW with which I am able to execute the sequences, but unable to generate the report. Kindly look into the VI and let me know what need to be corrected to generate the report using the same VI.
    Thanks and Regards
    Giridhar
    Attachments:
    TestStand_Enginevi.vi ‏21 KB

    If you want to generate a report you'll have to choose an entry point. You should have a look at the LabVIEW OI (operator Interface) shipped with TestStand
    Rodéric L
    Certified LabVIEW Architect

  • Creating LabVIEW module adapter TestStand Steps using the API without loading module prototype???

    Is it possible to programatically create a TestStand step (using the API), that calls a LabVIEW module, without loading the prototype of the module to get a reference to the Module Parameters.
    I want to specify a VI Pathname, but I dont want to use that pathname to load the prototype.  I want to programatically specify the name, type, representation etc. of each of the controls and indicators.
    My reason for attempting this is that I only want the VIs called by the steps to exist on the target hardware not on the numerous development machines running my application.
    Any thoughts greatly appreciated.
    Steve  
    https://decibel.ni.com/content/blogs/DailyCLAD

    Hi Steve,
    Unfortunatly it is not possible to do what you want within Test Stand but I am not sure why it is necessary, I think I am understanding your application incorrectly.  The only time you will need to load the prototype is if you are creating the step but if you are creating the step you will need the VI that the step calls so that VI will need to be present on the system.  If you are not calling the step then you shouldn't need to load the VI prototype.  If this is how you program funtions it may be a problem with your architecture but if not please could you correct my misunderstanding so that I can go about finding a suitable solution.
    Regards,
    Tom
    Applications Engineer
    National Instruments UK & Ireland

  • How to use lock in TestStand for synchronization ?

    I am trying to implement the synchronizing techniques for the COM component. Through the document, I understood about Lock utility. But it was not clear that how should I release lock. Can anybody guide me in this issue ? My requirement is, even though 2-3 sequnces try to access same COM component, only one sequence should be able to access the COM component. Other sequences will wait till this time.

    After you create a TestStand lock using the Lock step type, you can then acquire the lock using the Lock operation of the Lock step type. When using the Lock operation of the step type, you have the option to specify the Lock Operation Lifetime. Options for this are:
    -Same as Sequence
    -Same as Thread
    -Use ActiveX reference
    The first two options are fairly explanatory; acquire lock until either the sequence or thead completes.
    The last option allows you to store an ActiveX reference to the lock operation in a TestStand variable. You can release the lock operation by setting this variable to value of Nothing (e.g. Locals.MyLock = Nothing). Or, you can release the lock by letting the variable go out of scope.
    Finally, you can release a lock using a Lock ste
    p configured for the Early Unlock operation. This allows you to release a lock before than the lifetime you configured when creating the lock.
    Hope this helps.

  • HT201441 If you've found an iPod that was locked using Find My Phone/Activation Lock, and cannot contact the previous owner, is there any way to activate it still?

    I came across a 5th gen iPod touch at a bus stop, and tried but cannot activate it, as it is under the Find My Phone/ Activation Lock.
    Since I do not know who the previous owner is, is it possible to get around this roadblock? Or is it just no good to try?

    There's no way to get around it.  Turn it into the police so they can find the rightful owner.  You won't be able to use it anyway.

Maybe you are looking for

  • Should I backup my hard drive before I do a disk repair in disk utility?

    I want to do a disk repair but I don't have an external hard drive to backup information on, so I'm wondering if I can just not back it up and do the disk repair? Does it kill information? How does disk repair even work? Is it a defragger?

  • My iMessage won't work

    The iMessage won't work between my friends iphone 5 and my ipod 5 the message is never delivered and help?

  • Error Occured in ALV : Due to Space

    Dear all, Actually one variable contain variable like this: DATA W_FNAME(18) TYPE C. " TO STORE FILED NAME w_name = Head Office  (which is fetch through select query) when i pass this for printing in ALV Report as a Lebel error is occured, i think th

  • How much to replace my screen onmy iPhone 4

    HOw much to replace my iPhone 4 screen?

  • ES Web services

    hi Guru's i am trying to Access ES web Servies in VC 7.0 SP 14 . when i try to Access the web service I am geting the following error . Ports 'PO' ,'PO' were omitted because they include nested tables. Please help me ..very urgent . full point will b