Synchronous vs. Asynchronous Method Calls
A traditional remote control application consists of a list of
actions that you send to the instrument, expecting it to execute
them in that order and to tell you when it is done. This makes
programming easy - you can do your whole measurement in a
single function or sub-routine.
In this approach you send the actions to the instrument in
synchronous mode. This means that an action you send to the
instrument blocks the program flow of the calling thread until it
finishes. The advantage is that your program structure is very
simple. The drawback is that you have to wait for the instrument
to finish the action. For example this could lead to an
unresponsive user interface.
This can be solved using multithreading . Run the measurement
sequence in a new thread while the main thread handles other
things like running the user interface.
A third possibility is to call potentially time consuming actions
asynchronously. The LCA Remote Client lets you call some
commands in asynchronous mode. This means that the call
returns immediately, even before the action on the instrument
has finished execution.
In such cases you need an additional method to determine,
when an action finishes. The LCA Remote Client offers two
different methods to accomplish this.
• The first is the property OperationComplete().
This property value is True, when the last asynchronously
called operation on the LCA has finished execution.
Otherwise the property value is False.
• The other method is named WaitForOPC().
This method blocks program execution on the calling thread
until the operation on the instrument finishes.
Here are two short examples in VB.NET syntax, showing the
usage of asynchronous calls:
Remote Operation
Keysight N437x Series Lightwave Component Analyzer, Programmer’s Guide
21
Содержание N437 Series
Страница 1: ...Keysight N437x Series Lightwave Component Analyzer Programmer s Guide ...
Страница 2: ......
Страница 3: ......
Страница 78: ...Programming Examples 78 Keysight N437x Series Lightwave Component Analyzer Programmer s Guide ...