ipm_Listen( )
Termination Events | Cautions | Errors | Example | See Also
Name: int ipm_Listen(nDeviceHandle, *pTimeslotInfo, usMode) Inputs:
Returns: Includes: Category: Mode: Platform: Description
The ipm_Listen( ) function connects an IP channel to a TDM time slot, enabling data to flow between the TDM time slot and the IP network or the host.
If ipm_Listen( ) is called to connect to a different TDM time slot, the firmware automatically breaks an existing connection and reconnects it to the new time slot. In this case, the application does not need to call the ipm_UnListen( ) function.
ipm_Listen( ) uses the information stored in the SC_TSINFO structure to connect the receive channel on the device to an available TDM bus time slot. The time slot number is returned in the SC_TSINFO structure. The receive channel remains connected to the TDM bus time slot until ipm_UnListen( ) is called or ipm_Listen( ) is called with a different time slot.
nDeviceHandle handle of the IP Media device pTimeslotInfo pointer to structure that describes the time slot number, time slot type, and bus encoding format; see SC_TSINFO for details. usMode operation mode. Set to EV_ASYNC for asynchronous execution or to EV_SYNC for synchronous execution. Termination Events
- IPMEV_LISTEN
- indicates successful completion, that is, an IP channel was connected to the specified TDM time slot. This event does not return any data.
- IPMEV_ERROR
- indicates the function failed.
Cautions
The IP Media library allows ipm_Listen( ) and ipm_UnListen( ) to be called either synchronously or asynchronously. Other Intel libraries may not support asynchronous execution of the similar xx_Listen and xx_UnListen functions.
Errors
If the function returns -1 to indicate failure, call ATDV_LASTERR( ) and ATDV_ERRMSGP( ) to return one of the following errors:
- EIPM_BADPARM
- Invalid parameter
- EIPM_FWERROR
- Firmware error
- EIPM_INTERNAL
- Internal error
- EIPM_INV_STATE
- Invalid state. Initial command did not complete before another function call was made.
- EIPM_SYSTEM
- System error
Example
#include <stdio.h> #include <srllib.h> #include <ipmlib.h> typedef long int(*HDLR)(unsigned long); void CheckEvent(); void main() { int nDeviceHandle; SC_TSINFO IPTimeSlotInfo; long lTimeSlot; // Register event handler function with srl sr_enbhdlr( EV_ANYDEV ,EV_ANYEVT ,(HDLR)CheckEvent); /* . . Main Processing . . . */ /* Tell IP device handle, nDeviceHandle, to listen to timeslot 10. ASSUMPTION: A valid nDeviceHandle was obtained from prior call to ipm_Open(). */ lTimeSlot = 10; IPTimeSlotInfo.sc_tsarrayp = &lTimeSlot; IPTimeSlotInfo.sc_numts = 1; if(ipm_Listen(nDeviceHandle, &IPTimeSlotInfo, EV_ASYNC) == -1) { printf("ipm_Listen failed for device name = %s with error = %d\n", ATDV_NAMEP(nDeviceHandle), ATDV_LASTERR(nDeviceHandle)); /* . . Perform Error Processing . . */ } /* . . Continue processing . */ } void CheckEvent() { int nDeviceID = sr_getevtdev(); int nEventType = sr_getevttype(); switch(nEventType) { /* . . . Other events . . */ /* Expected reply to ipm_Listen */ case IPMEV_LISTEN: printf("Received IPMEV_LISTEN for device = %s\n", ATDV_NAMEP(nDeviceID)); break; default: printf("Received unknown event = %d for device = %s\n", nEventType, ATDV_NAMEP(nDeviceID)); break; } }See Also
Click here to contact Telecom Support Resources
Copyright 2002, Intel Corporation