viDiscardEvents

NI-VISA

viDiscardEvents

Purpose

Discards event occurrences for specified event types and mechanisms in a session.

C Syntax

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

Visual Basic Syntax

viDiscardEvents&(ByVal vi&, ByVal eventType&, ByVal mechanism%)

Resource Classes

All I/O session types

Parameters

Name Direction Description

vi

IN

Unique logical identifier to a session.

eventType

IN

Logical event identifier.

mechanism

IN

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

Return Values

Completion Codes Description

VI_SUCCESS

Event queue flushed successfully.

VI_SUCCESS_QUEUE_EMPTY

Operation completed successfully, but queue was already empty.

 

Error Codes Description

VI_ERROR_INV_OBJECT

The given session reference is invalid.

VI_ERROR_INV_EVENT

Specified eventType is not supported by the resource.

VI_ERROR_INV_MECH

Invalid mechanism specified.

Description

The viDiscardEvents() operation discards all pending occurrences of the specified event types and mechanisms from the specified session. Specifying VI_ALL_ENABLED_EVENTS for the eventType parameter discards events of every type that is enabled for the given session. The information about all the event occurrences which have not yet been handled is discarded. This operation is useful to remove event occurrences that an application no longer needs. The discarded event occurrences are not available to a session at a later time. This operation does not apply to event contexts that have already been delivered to the application.

Related Topics

viDisableEvent

viEnableEvent

VISA Resource Template

viWaitOnEvent