Agilent Technologies 86038A User Manual page 176

Optical dispersion analyzer
Table of Contents

Advertisement

Remote Operation
176
4 Now, register the handler when the connection to the ODA is opened. Find the
pbConnect_Click method, and add the following lines
// Create our event handlers
this.NewStatusHandler = new ODARemoting.NewStatusDelegate(
this.NewStatusEvent );
// Register event handlers
odaClient.NewStatus += this.NewStatusHandler;
5 Since you registered the handler, you have to be careful to unregister it when you
are done talking to the ODA. Find the Form1_Closing function, and insert the
following lines before terminating the session:
// Unregister our status handler
odaClient.NewStatus - = this.NewStatusHandler;
6 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 can see
the progress messages appearing on the application as the measurement
progresses. When you exit the application, it will release the ODA.
ll of the ODA events follow a similar pattern. The most useful events will be
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.
Take Sweep and Transfer Data
In this exercise, you will trigger a sweep from the application, and when
the sweep completes, transfer the data across and save it in a file. This
consists of adding a button to trigger the sweep, adding an event handler
for the TriggerProgress event to detect when the sweep is finished, and
saving the data in C:\mydata.txt.
1 Add a button to the UI and name it pbSweep, caption Take Sweep.
2 Double click the button to go to the pbSweep_Click function, and insert the
following lines to make sure you are connected before actually starting a
measurement:
// Don't do anything if not connected to ODA
if (odaClient.Connectivity.IsConnected() == false)
{
MessageBox.Show("Can't take a measurement yet - not con-
nected.");
return;
}
odaClient.Measure();
3 Run the software, click Connect and wait for the connection to complete. Then
click Take Sweep, and watch the sweep progress on both the ODA and on the
application message bar.
Add an event handler to TriggerProgress. This involves declaring the
delegate, instantiating the delegate, then adding and removing the handler from
odaClient.
Example 1: Simple Application for Controlling the ODA
Agilent 86038A Optical Dispersion Analyzer, Third Edition

Advertisement

Table of Contents
loading

Table of Contents