Previous PageTable Of ContentsHomeIndexNext Page

sr_putevt( )

Description | Cautions | Example | Errors | See Also

Name:

long sr_putevt(dev, evttype, evtlen, evtdatap, errcode)

Inputs:

long dev

  device

 

unsigned long evttype

  event type ID

 

long evtlen

  data block size

 

void *evtdatap

  data block pointer

 

long errcode

  error code

Returns:

0 if successful

 

-1 if error

 

 

Includes:

srllib.h

 

dxxxlib.h

Type:

Event Management function

Mode:

Synchronous

Top Of PageDescription

The sr_putevt( ) function allows the application to add an event to the SRL event queue within the same process. If event data is to be passed through the evtdatap parameter, the evtlen parameter should be set to its corresponding length. The SRL makes of a copy of the user's data that is pointed to by the evtdatap parameter. Therefore, the caller can dispose of the event data immediately after calling the sr_putevt( ) function. The function parameters are described as follows:

Parameter

Description

dev

Valid device handle of the device opened through either setting the dev parameter to SRL_DEVICE or calling one of the xx_open( ) functions. Use the sr_getevtdev( ) function to retrieve this value when an event occurs.

evttype

User-supplied event type. This can be any unique event number. Use the sr_getevttype( ) function to retrieve this value when an event occurs.

evtlen

Length of variable-length data associated with the event. Use the sr_getevtlen( ) function to retrieve this value when the event occurs. If no data is associated with an event, set evtlen to zero, and set the evtdatap parameter to NULL.

evtdatap

Pointer to the variable-length data of the size in the evtlen parameter. The SRL makes a copy of this data and attaches it to the event. The sr_getevtdatap( ) function returns a pointer to the memory containing the variable-length information. If no data is associated with an event, set this parameter to NULL, and set the evtlen parameter to zero.

errcode

Specifies an error code that can be set when the event is posted. Calling the ATDV_LASTERR( ) function on the device handle on which the event is posted returns this error. Set to zero if no error is to be reported on this device. If non-zero, you can use the ATDV_LASTERR( ) function on this device to retrieve the error.

Use either the sr_waitevt( ) function or the sr_waitevt(Ex) function to retrieve the events generated by the sr_putevt( ) function. The sr_putevt( ) function can also unblock synchronous functions that are blocked waiting for certain events. For example, if a Voice library dx_getevt( ) or dx_wtring( ) function is waiting for CST events to be posted to the queue, you can simulate incoming calls by posting TDX_CST events to the queue.

Top Of PageCautions

This function fails if you specify an invalid device handle.

Top Of PageExample

Top Of PageErrors

The sr_putevt( ) function returns SR_NOMEM if memory cannot be allocated to store the event on the SRL event queue.

Top Of PageSee Also


Previous PageTable Of ContentsTop Of PageIndexNext Page

Click here to contact Dialogic Customer Engineering

Copyright 2001, Dialogic Corporation
All rights reserved
This page generated January, 2001