
Description | Cautions | Example | Errors | See Also
|
Name: |
int dcb_evtstatus(event, action, status) |
|
|
Inputs: |
unsigned char event |
|
| unsigned char action | ||
| unsigned char *status | ||
|
Returns: |
0 on success |
|
| -1 on failure | ||
|
Includes: |
srllib.h |
|
| dcblib.h | ||
| dtilib.h | ||
| msilib.h | ||
|
Category: |
Auxiliary |
|
|
Mode: |
synchronous |
|
The dcb_evtstatus( ) function gets or sets the status of a process-wide event. Certain features of the Dialogic Audio Conferencing software are board-level features in that they are enabled or disabled on a per board basis. Process-wide events are enabled or disabled once for all devices used by that process.
Parameter |
Description |
event: |
The specified process-wide event. |
action: |
Specifies whether the event status is to be set or retrieved. |
status: |
If the event status is being set, ON or OFF is passed to the function in this parameter. If the event status is being retrieved, this parameter will contain ON or OFF when the function returns. |
event must be set to MSG_RESTBL. MSG_RESTBL controls the resource table update event generation. The resource assignment table is the mapping of resources to conferees. Anytime there is a change in this mapping and event generation is enabled, a DCBEV_CTU event is generated. Associated with this event is the resource table. An application may be in the resource table implementing active talkers. When this event notification is enabled, and the application makes a change to the assignment of conferencing resources on a DCB/SC board, a DCBEV_CTU event will be generated. The updated resource table will be returned as the event data. Refer to the code example for details.
action may be set to SET_EVENT or GET_EVENT.
The status parameter may contain ON or OFF.
To enable an event handler for a specified event, follow these steps:
dcb_evtstatus( ) is a process-wide function and does not have a Dialogic device-handle as one of its parameters. Any event set ON or OFF is set for all devices used by the process, not for any particular device.
#include <windows.h>
#include "srllib.h"
#include "dtilib.h"
#include "msilib.h"
#include "dcblib.h"
#include "errno.h"
#define MAX_PTY 32
#define TABLE_SIZE 192
DCB_CT res_table[MAX_PTY]; /* DCB_CT structure array */
void handler()
{
int size = sr_getevtlen();
char *datap = (char *)sr_getevtdatap();
int event_type = (int)sr_getevttype();
printf("Event occurred on %s : Data size = %d : Data is at 0x%x\n",
ATDV_NAMEP(sr_getevtdev()), size, datap);
if (event_type == DCBEV_CTU) {
memcpy(res_table, datap, TABLE_SIZE);
}
else {
for (i=0; i<size; i++){
printf("%d\n", *(datap++));
}
}
}
main()
{
int bddevh, dspdevh; /* DCB/SC board and DSP device descriptors */
unsigned long atibits; /* Active talker bits */
int mode = SR_POLLMODE; /* SRL function-call mode */
unsigned int status; /* DCB/SC Feature status */
unsigned int i, count = 1000; /* Loop counters */
/* Open DCB/SC board device */
if ((bddevh = dcb_open("dcbB1",0)) == -1) {
printf("Cannot open dcbB1. errno = %d", errno);
exit(1);
}
/* Set SRL function call mode */
if (sr_setparm(SRL_DEVICE, SR_MODEID, (void *)&mode) == -1){
printf("Error setting sr_setparm()\n");
exit(1);
}
/* Enable SRL event handler */
if (sr_enbhdlr(EV_ANYDEV, EV_ANYEVT, (void *)handler) == -1) {
printf("Error setting sr_enbhdlr()\n");
exit(1);
}
/* Set Active Talker On */
status = ACTID_ON;
if (dcb_setbrdparm(bddevh, MSG_ACTID, (void *)&status) == -1) {
printf("Error setting board parameter - %s\n", ATDV_ERRMSGP(bddevh));
exit(1);
}
/* Done with board-level calls : close device */
if (dcb_close(bddevh) == -1) {
printf("Cannot close dcbB1. errno = %d\n", errno);
exit(1);
}
/* Set Resource Assignment Table Update event ON */
status = ON;
if (dcb_evtstatus(MSG_RESTBL, SET_EVENT, &status) == -1) {
printf("Error enabling system-wide event\n");
exit(1);
}
/* Open board 1, DSP 1 device */
if ((dspdevh = dcb_open("dcbB1D1",0)) == -1) {
printf("Cannot open dcbB1D1. errno = %d", errno);
exit(1);
}
/* Establish a conference and continue processing */
/* Wait in a 1000-count loop to get the active talkers */
while (count--) {
if (dcb_getatibits(dspdevh, &atibits) == -1){
printf("Error Message : %s", ATDV_ERRMSGP(dspdevh));
exit(1);
}
printf("ATIBITS = %d\n", atibits);
for (i=0; i<32; i++){
if (atibits & (1<<i)){
printf("confid = %d, TimeSlot = %d, Selector = %d\n",
res_table[i].confid, res_table[i].chan_num,
res_table[i].chan_sel);
}
} /* End of for() loop */
} /* End of while() loop */
/* Set Resource Table Update events OFF */
status = OFF;
if (dcb_evtstatus(MSG_RESTBL, SET_EVENT, &status) == -1) {
printf("Error enabling system-wide event\n");
exit(1);
}
/* Disable event handler */
if (sr_dishdlr(EV_ANYDEV, DCBEV_CTU, (void *)handler) == -1) {
printf("Error in sr_dishdlr()\n");
exit(1);
}
/* Done processing - close DSP device */
if (dcb_close(dspdevh) == -1) {
printf("Cannot close dcbB1D1. errno = %d\n", errno);
exit(1);
}
}
If the function does not complete successfully, it will return -1 to indicate an error. Use the Standard Attribute functions ATDV_LASTERR( ) to obtain the applicable error value, or ATDV_ERRMSGP( ) to obtain a more descriptive error message.
Refer to the error type tables found in Chapter 2 of this guide. Error defines can be found in dtilib.h, msilib.h or dcblib.h.
Click here to contact Dialogic Customer Engineering
Copyright 2000, Dialogic Corporation