viDiscardEvents

Agilent VISA.NET

viDiscardEvents

Syntax

viDiscardEvents(ViSession vi, ViEventType eventType, ViUInt16 mechanism);

Description

This function discards all pending occurrences of the specified event types for the mechanisms specified in a given session. The information about all the event occurrences that have not yet been handled is discarded. This function is useful to remove event occurrences that an application no longer needs.

The event occurrences discarded by applications are not available to a session at a later time. This operation causes loss of event occurrences. The viDiscardEvents operation does not apply to event contexts that have already been delivered to the application.

Parameters

Name

Dir

Type

Description

vi

IN

ViSession

Unique logical identifier to a session.

eventType

IN

ViEventType

Logical event identifier. (See the following tables.)

mechanism

IN

ViUInt16

Specifies the mechanisms for which the events are to be discarded. VI_QUEUE is specified for the queuing mechanism and VI_SUSPEND_HNDLR is specified for the pending events in the callback mechanism. It is possible to specify both mechanisms simultaneously by specifying VI_ALL_MECH.

Special Values for eventType Parameter

Value

 

 

Action Description

VI_ALL_ENABLED_EVENTS

 

 

Discard events of every type that is enabled.

The following events can be discarded:

Event Name

 

 

Description

VI_EVENT_IO_COMPLETION

 

 

Notification that an asynchronous operation has completed.

VI_EVENT_TRIG

 

 

Notification that a hardware trigger was received from a device.

VI_EVENT_SERVICE_REQ

 

 

Notification that a device is requesting service.

VI_EVENT_CLEAR

 

 

Notification that the local controller has been sent a device clear message

VI_EVENT_EXCEPTION

 

 

Notification that an error condition has occurred during an operation invocation. (Note: the VI_QUEUE and VI_SUSPEND_HNDLR mechanisms cannot be used with this event.)

VI_EVENT_GPIB_CIC

 

 

Notification that the GPIB controller has gained or lost CIC (controller in charge) status.

VI_EVENT_GPIB_TALK

 

 

Notification that the GPIB controller has been addressed to talk.

VI_EVENT_GPIB_LISTEN

 

 

Notification that the GPIB controller has been addressed to listen.

VI_EVENT_PXI_INTR

 

 

Notification that a vendor-specific PXI interrupt was received from the device.

VI_EVENT_VXI_VME_SYSFAIL

 

 

Notification that the VXI/VME SYSFAIL* line has been asserted.

VI_EVENT_VXI_VME_SYSRESET

 

 

Notification that the VXI/VME SYSRESET* line has been asserted

VI_EVENT_VXI_SIGP

 

 

Notification that a VXI signal or VXI interrupt has been received from a device.

VI_EVENT_VXI_VME_INTR

 

 

Notification that a VXIbus interrupt was received from the device.

Not supported by Agilent VISA:

     

VI_EVENT_TCPIP_CONNECT

 

 

Notification that a TCP/IP connection has been made.

VI_EVENT_USB_INTR

 

 

 

Notification that a vendor-specific USB interrupt was received from the device.

Note: Refer to the viEventHandler topic and the VISA Attributes topics for information on the event types that are available for various VISA resource classes (e.g. INSTR, INTFC …).

Special Values for mechanism Parameter

Value

 

 

Action Description

VI_ALL_MECH

 

 

Discard the specified event(s) from all mechanisms.

VI_QUEUE

 

 

Discard the specified event(s) from the waiting queue.

VI_SUSPEND_HNDLR

 

 

Discard the specified event(s) from the callback queue.

Return Values

Type ViStatus

This is the function return status. It returns either a completion code or an error code as follows.

Completion Codes

Description

VI_SUCCESS

Event queue flushed successfully.

VI_SUCCESS_QUEUE_EMPTY

Operation completed successfully, but queue was empty.

Error Codes

Description

VI_ERROR_INV_EVENT

Specified event type is not supported by the resource.

VI_ERROR_INV_MECH

Invalid mechanism specified.

VI_ERROR_INV_SESSION
VI_ERROR_INV_OBJECT

The given session or object reference is invalid (both are the same value).

See Also

viEnableEvent, viWaitOnEvent, viInstallHandler