
Description | Cautions | Example | Errors | See Also
Name: |
int cc_GetSAPI(sapip, evtdatap) | |
Inputs: |
char *sapip |
|
void *evtdatap |
| |
Returns: |
0 on success | |
Includes: |
cclib.h | |
Category: |
System tools | |
Mode: |
synchronous | |
Technology: |
BRI/SC | |
The cc_GetSAPI( ) function retrieves the service access point ID (SAPI) associated with the CCEV_D_CHAN_STATUS event received from the event queue.
Parameter |
Description |
sapip: |
The address of the location where the output service access point ID is returned. |
evtdatap: |
Pointer to the structure containing the event data. The pointer value is acquired through the Dialogic Standard Runtime Library (SRL) function sr_getevtdatap( ). |
The cc_GetSAPI( ) function applies only to BRI protocols. (This function is not supported for the BRI/2 board.)
#include <windows.h> /* For Windows applications only */
#include <stdio.h>
#include <errno.h>
#include "srllib.h"
#include "dtilib.h"
#include "cclib.h"
long EventHandler(event)
{
int rc;
L2_BLK frame;
unsigned int resultValue;
unsigned char sapi, ces;
int device;
void *datap;
device = sr_getevtdev();
datap = sr_getevtdatap();
...
switch(event)
{
case CCEV_D_CHAN_STATUS:
cc_GetSapi(&sapi, datap);
cc_GetCes(&ces, datap);
resultValue = cc_ResultValue(datap);
switch(resultValue & ~(ERR_ISDN_FW))
{
case E_LINKUP:
DataLinkState[SAPI_ID][CES_ID] = DATA_LINK_UP;
break;
case E_LINKDOWN:
DataLinkState[SAPI_ID][CES_ID] = DATA_LINK_DOWN;
break;
case E_LINKDISABLED:
DataLinkState[SAPI_ID][CES_ID] = DATA_LINK_DISABLED;
break;
default:
printf("Got a bad result value (0x%X)\n", resultValue);
}
break;
case CCEV_L2FRAME:
if(rc = cc_GetFrame (dev, &frame) == 0)
{
sapi = frame.sapi;
ces = frame.ces;
printf("Got a frame of length=%d for Sapi=%d Ces=%d\n", frame.length, sapi, ces);
}
else
printf("cc_GetFrame failed!\n");
break;
...
}
return 0;
}
If the function returns a value < 0 to indicate failure, use the cc_CauseValue( ) function to retrieve the reason code for the failure. The cc_ResultMsg( ) function can be used to interpret the reason code. Error codes are defined in the files ccerr.h, isdnerr.h, and isdncmd.h.
Error codes from the cc_GetSAPI( ) function include the following:
Error Code |
Description |
ERR_ISDN_LIB | E_ISNULLPTR |
Null pointer error |
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation