NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

NewExecution sequence arguments return parameter

In the Visual C++ Full-Festured Operator Interface, I am successfully calling NewExecution and passing input parameters to a sequence.  But I can find no examples of how to obtain return parameters that the sequence is setting.
For example, let's say my sequence takes in a numberOfSeconds parameter and returns a corresponding date/time string.  I assume the sequence arguments _variant_t parameter I pass to the NewExecution call will NOT have the returned string when NewExecution completes, so one must obtain the parameter elsewhere, possibly when the "execution completed" event is handled.  But I can't find anything obvious in the Execution object help that talks about return parameters.  I suppose the sequence could write the output parameter to the results context, and it appears the Execution object can get the results, but is that the only (best) way to do this??
 
Thanks in advance for any hints.
0 Kudos
Message 1 of 5
(3,284 Views)
My understanding is that you don't need return parameters in the traditional sense. You would pass the sequence a string value parameter by reference called "date-time-string". The sequence would then write the value to the parameter. When it finishes executing you would read the parameter value. This approach works well when you have a main sequence calling multiple sequences which is mostly the case. I have not tried this approach with executing a single sequence from the operator interfaces.

I hope this helps.


Michael Aivaliotis
VI Shots LLC
0 Kudos
Message 2 of 5
(3,282 Views)

Thanks for the reply, Michael, but maybe my question wasn't clear enough or more likely I don't understand enough yet.  I wasn't strictly speaking about a return parameter, but rather a sequence argument that the sequence set as output.  That said, my understanding was that NewExecution can/will return before the sequence completes executing.  If that is the case, then the sequence arguments parameter passed to NewExecution could not possibly have the sequence argument (date_time_string) set by the sequence.  My assumption for this is that there are methods to call to determine whether the execution is complete or not after calling NewExecution to start the execution.

Even if NewExecution does wait until the sequence is complete before returning, how does one go about turning the _variant_t sequenceArgs parameter passed to NewExecution back into something like a PropertyObject where one can get at the parameters?  I can't find any examples about what to do with a _variant_t parameter, or even what a _variant_t type is.  Sounds like a void*, but it appears to be much more than that.

And you are correct -- I am calling the main sequence from the OI C++ code and not an entry point.

Hope this clarifies my question.

0 Kudos
Message 3 of 5
(3,276 Views)
Hi Barry,

Generally speaking the best way to communicate between a sequence execution and the operator interface is using custom UI Messages. The only return parameter I'm familiar with when calling the NewExecution method is the Execution object itself.

Maybe if you can give us a little more detail on what it is you're trying to do, we can figure out the best way to do it. With TestStand you can do just about anything, but sometimes figuring out the best way to do it can be a bit tricky. Smiley Wink

Let us know Barry, thanks!
Dan Weiland
0 Kudos
Message 4 of 5
(3,244 Views)
Dan, thanks for the reply.  I was using UI messages for other purposes already, so I just continued on that track to get the sequence's return values back into the Operator Interface (OI).  Since you asked for details.....
We have taken the full-featured C++ OI and wrapped it with a CORBA IDL interface so that other applications in our (or our customer's) systems can call to execute tests, import data into a DB, etc.  One part of this interface is for the client application to request a new test ID.  We have implemented that request in the OI using an Access DB table that records the time of the request in a new row of the table and generates a new ID.  We perform that task by using a sequence that writes the new record to the DB and gets the new ID and returns it as a parameter of the sequence.  So the optimal solution would be to received the test ID request from the client, call the sequence, wait for it to execute, somehow get the returned parameter (test ID), and then return it on the same called interface as the request.  Sort of a
int getTestID()
call from the client's perspective.  But since I couldn't find a way to get the return parameter, I now have two interfaces from the client's perspective:
void createTestID()
int getTestID()
where the first interface calls the sequence which sends a UI with the test ID that the OI captures and stores, and then returns that test ID on the second interface.
 
As I've mentioned before, I am relatively new to TestStand and every time I dive into some concept I'd like to implement, I find more and more engine API calls or other means of performing a task, so I was just hoping there was a way to call a sequence and get its return parameter rather than using the UI approach.
 
But it seems to be working fine, so unless there is some other slick way to get the return parameter other than how I've described above, then I'll assume this is an "OK" solution.
 
Thanks again for your responses.
0 Kudos
Message 5 of 5
(3,238 Views)