User`s guide

Programming with VISA 3
Agilent VISA User’s Guide 65
Sample: Reading Event Attributes
Once you have decided which attribute to check, you can
read the attribute using the viGetAttribute function. The
following sample shows one way you could check which
trigger line fired when the VI_EVENT_TRIG event was
delivered.
Note that the context parameter is either the event context
passed to your event handler, or the outcontext specified
when doing a wait on event. See “VISA Attributes” in this
chapter for more information on reading attribute states.
ViInt16 state;
.
.
viGetAttribute(context, VI_ATTR_RECV_TRIG_ID,
&state)
Using the Callback Method
The callback method of event notification is used when an
immediate response to an event is required. To use the
callback method for receiving notification that an event has
occurred, you must do the following.
Install an event handler with the viInstallHandler
function
Enable one or several events with the viEnableEvent
function
When the enabled event occurs, the installed event handler
is called.
Sample: Using the Callback Method
This sample shows one way you can use the callback
method.
VI_ATTR_OPER_NAME Name of the operation generating
the event.
RO ViString N/A
Table 20 TCPIP Socket (SOCKET) Resource Event