Agilent Technologies 86038A User Manual page 175

Optical dispersion analyzer
Table of Contents

Advertisement

Example 1: Simple Application for Controlling the ODA
Agilent 86038A Optical Dispersion Analyzer, Third Edition
To see the values defined in the enumeration, find the InstrumentObjects
object in the left hand pane of the object browser. Expand that entry, and
find Agilent.LWD.Ag86038x.InstrumentObjects, and expand that. Scan
down the resultant list to find ODACommon.eEventLogType, and click on
that. It shows the five different possible values. It turns out the
FailureAudit and SuccessAudit are unused default log values. The only
values we will ever see are EventError (something bad happened and ODA
could not do what you asked), Information (simple status update, like
Sweep Started) or Warning (ODA was still able to make a measurement,
but wasn't able to do precisely as asked.)
The first pass parameter is the text of the message displayed to the user
on the ODA front panel. So, to be informed of a new status message,
implement a function like this:
private void NewStatusEvent( string msg, ODACommon.eEventLogType
e )
{
// Let the user know something happened
lblStatus.Text=msg;
}
Note that because of the 'using' statement at the head of the file, you did
not have to type the whole root to eEventLogType – a considerable typing
savings.
Now you need to tell the odaClient about the new function. First you have
to find the delegate that knows how to handle NewStatus events. The
delegates are also found underneath the ODACommon object where you
found the eEventLogType. Return to the Object Browser window and scroll
down to find the ODARemoting.NewStatusDelegate object. That is the
delegate you need to use for this event, and you will find delegates for all
the ODA events in the same place, with the same name as the event with
the word Delegate appended. Note that several similarly spelled versions
appear, but you only want the one spelled exactly the same as the event
with the word Delegate appended.
The steps below walk you through adding the appropriate declarations to
create the delegate and register our event handler.
1 Add a display line to show a user status messages. Add a text label as wide as
the form, and call it lblStatus. Default the text to "ODA Status."
2 Go to the code window and find where you declared the odaClient. Add the
declaration of a local copy of the delegate here:
// Declare event handlers for ODA all!
private ODARemoting.NewStatusDelegate NewStatusHandler;
3 Find the declaration of Form1_Closing, and insert this routine after it:
private void NewStatusEvent( string msg, ODACommon.eEventLogType e )
{
// Let the user know something happened
lblStatus.Text=msg;
}
Remote Operation
175

Advertisement

Table of Contents
loading

Table of Contents