Download V-Link32 Voice Development Kit User's Manual

Transcript
Event Management
Specifies the message value which is defined by the dwCSTMsg parameter of
vocOpenChn() function.
dwUserData
A 32-bit user-instance data which is defined by the dwCSTCallbackInst parameter of
vocOpenChn() function.
dwParam1
Reserved.
dwParam2
Reserved.
A sample code of the Function Callback Model is shown below:
main( … )
{
HCHN hChn;
CBDESC CB;
// Initialize driver
if (vocInitDriver() != E_OK) {
/* Process error */
}
// Set the CB
CB.dwEventCallback = NULL;
CB.dwEventCallbackInst = NULL ;
CB.dwEventFlag = NULL;
CB.dwEventMsg = NULL;
CB.dwCSTCallback = (DWORD)cstCallBackProc;
CB.dwCSTCallbackInst = NULL;
CB.dwCSTFlag = CB_FUNCTION;
CB.dwCSTMsg = NULL;
// Open a channel with callback model.
if (vocOpenChn(&hChn, ANY_CHN, &CB) != E_OK) {
/* Process error */
}
:
}
void CALLBACK cstCallbackProc(HCHN hChn, DWORD dw Msg, DWORD dwUserData,
DWORD dwParam1, DWORD dwParam2)
{
CSTBLK CST;
vocGetLastCST(hChn, &CST);
switch (CST.wStat us) {
case CST_RING:
:
break;
case CST_DIGIT:
:
break;
:
}
}
Window Callback Model
In Window Callback Model, after the channel status transition is changed, the system will send a
message to the window handle when a CST event occurred. The event information can be retrieved
by calling vocGetLastCST() function.
The declaration of callback function is described below:
21