How to Extend a Callback Instead of Replacing a Callback in TestStand
Overview
This example demonstrates how to easily run the process model’s callback sequence from the client sequence file’s overriding callback by using a custom step type. This document will cover the benefits of using this step type along with how to use and how to download this step type.
Downloads
Filename: parentcallback.zip
Requirements: View
When a client sequence file overrides a callback defined in the process model, the overriding callback sequence is called in place of the process model’s callback sequence. This can be undesirable behavior in cases where the overriding callback sequence needs to extend or add to the existing behavior defined in the process model’s callback sequence. If this is the case, then the desired behavior is to run the callback sequence defined in the process model, and then run any steps needed to extend the functionality.
The Call Parent Callback step, run from a client sequence file callback sequence, will load and run the matching process model’s callback sequence. This step can be used in conjunction with additional steps, either before or after the Call Parent Callback step, to effectively extend the functionality of process model’s callback sequence.
Why is this better than just copying all of the steps from the process model’s callback sequence into the client sequence file’s callback sequence? The copy approach will not allow any future changes made to process model’s callback sequence to propagate to the client sequence file’s callback sequence. Using the Call Parent Callback step allows the client sequence file to always use the most current copy of the process model’s callback sequence.
How is the Call Parent Callback step used? Just drag the Call Parent Callback step from the insertion palette into any client sequence file callback sequence. For example, the screen shot below shows the Call Parent Callback step in the PreUUT callback sequence in a client sequence file. When this client sequence file is called with the Test UUTs execution entry point from the SequentialModel.seq, the “UUT Information” dialog box appears (behavior defined by SequentialModel.seq) and then the “My Extended Functionality” message popup box appears (extended behavior defined by the client sequence file).
To get access to this new Call Parent Callback step type, open the attached sequence file (ParentCallbackExample.seq); this sequence file has a copy of the step type in it. Then, open up the Types Palette (View » Types) and copy the step type from the ParentCallbackExample.seq to MyTypes.ini. Now the Call Parent Callback step will be available in any sequence file you create on that station. Lastly, the attached SubStepCode.dll needs to be copied to the <TestStand Public>\Components\StepTypes\CommonSubsteps\ folder (you may need to create this folder). The <TestStand Public> directory is different depending on the version of TestStand; see KnowledgeBase 4LK9L6T3: What is New For TestStand 4.1? for more details. The source code for this dll is also attached, and it shows how to use the TestStand Core API along with the TestStand Adapter API in VC++.
Requirements
Filename: parentcallback.zip
Software Requirements
Application Software: NI TestStand Development System 4.0
Language(s): C++
Reader Comments | Submit a comment »
Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).

