It can be done using TestStand UI message. Following steps will help you to implement passing data from LabVIEW to TestStand using UI messages event callback:
1. Add a new Statement Step in your TestStand sequence and update the expression as shown below.
2. In this section, we will modify the simple Operator Interface to handle the Custom UI message . The simple Operator Interface is located in the following directory: <TestStand Public>\UserInterfaces\Simple\LabVIEW\TestExec.llb. To implement code to execute when a custom UI message is received, first we need to implement a callback VI for the UserMessage Event:
- Expand the Reg Event Callback node to contain an additional event. You should see three additional inputs
- Wire the Application Manager reference to the first new input. This specifies that we are handling an event of the Application Manager
- Left-click the first input to select the User Message event from the list of Application Manager events
- Right-click the node of the second input (VI Ref), and select Create Callback VI from the context menu. This creates a new callback VI which runs whenever a custom UI message is received
- Pass any additional data to be used by the callback into the User Parameter node (in this case no additional data is needed)
3. We now need to implement the code within the callback VI that should execute when the custom UI message is received:
- Open the callback VI created in step 2 above by double clicking it. Note that the parameters of the VI are created for you based on the event
- To access the UI message data, unbundle the Event Data parameter to access the uiMsg object, then create a Property Node from this object. This object represents the data of the UI message that fired the UserMessage event
- Since this event callback will run for any custom UI message, first we need to check the ID of the message. To do this, use the Event property as the case selector for the case structure. Add a case for the ID of the custom event (10010)
- Within the case structure, create the code to execute. In this case, we use the TestStand - Set Property Value VI to set the value of the SequenceContext property the Lookup String parameter specifies. The data type you wire to the New Value input determines the polymorphic instance to use as shown below.
- In above figure we are updating the FileGlobals.UISupportsCustomMessages variable value to TRUE based on custom UI message event generated by the TestStand.
Additional Information
TestStand uses UI message objects to pass information about the state of the engine and the current executions to the Operator Interface or Sequence Editor. For example, the TestStand engine posts a UI message to notify the Operator Interface when a step has completed. The Operator Interface can then perform actions in response to this UI message, such as refreshing or updating variable values on the execution window control to show updated step results.
In the simple Operator Interface, the TestStand events are registered in the Simple OI - Configure Event Callbacks subVI. In this VI, we set what action to take when an event occurs by specifying a callback VI to run when the event occurs. Configuring the event handling callbacks is accomplished using the Register Event Callback Node.