Agilent Technologies 86038A User Manual page 166

Optical dispersion analyzer
Table of Contents

Advertisement

Remote Operation
166
Event Handling
Event handling is added to monitor the ODA events. A very useful event is
a new status message. The status message is shown on the bottom of the
ODA display, which indicates when a sweep has begun, sweep ended, and
so on. By reflecting those messages on the remote application, you
provide invaluable feedback to a user, particularly if they cannot see the
ODA display.
When an event like a new status message occurs, the ODA informs you by
calling a method on your object. Visual Basic presents a list of available
events in the function list. When you select the event, it creates the
function to hold your event handling code.
In
Step 7
above, the odaClient was declared using the keyword
"WithEvents". This instructs Visual Basic to find the events and make
them available to you. Go into the code window and click on the selector in
the upper left corner (it probably says Form1 now.) It presents a list of
objects you have available. Select the odaClient. Now click on the selector
in the upper right corner (it probably says Declarations). It presents a list of
events you can choose to receive and write code for. If the event is in light
gray, you have not implemented it yet. If it is in
for it. You do not have to implement all the events, just the ones you find
useful.
The steps below walk through adding an event handler for NewStatus.
1 Add a display line to show user status messages. Add a text label as wide as the
form, and call it lblStatus. Default the text to ODA Status.
2 Create the event function. Go to the code window. Click the object selector in the
upper left corner of the window, and select odaClient. Now click the event
method selector in the upper right corner of the display, and click NewStatus.
This will take you to a function called odaClient_NewStatus, which will be called
when a new status message is displayed on the ODA. The first pass parameter
is the message itself, the second pass parameter is an enumerated type telling
you if the message was an error, informational or a warning. To display the
status, insert the following line inside:
Private Sub odaClient_NewStatus( ...
' Let the user know something happened
lblStatus.Text = Message
End Sub
3 Click the Run button, and connect to the ODA. The first message you will see is
the Connected message. Press Local on the ODA and take a sweep. You will see
the progress messages appearing on the application as the measurement
progresses. When you exit the application, it will release the ODA.
All of the ODA events follow a similar pattern. The most useful events are
TriggerProgress, which tells you when a measurement or normalization is
complete, and TLSSettlingProbability, which warns you how long until the
laser needs to perform a temperature settling.
Example 1: Simple Application for Controlling the ODA
bold
Agilent 86038A Optical Dispersion Analyzer, Third Edition
type face, there is code

Advertisement

Table of Contents
loading

Table of Contents