CTI_dx_getdig

Màu nền
Font chữ
Font size
Chiều cao dòng

dx_getdig( )

Lay so tu bo dem so cua mot kenh. Tra ve 0 bao khoi tao thanh cong. -1 neu that bai. 1 la null

int dx_getdig(chdev,tptp,digitp,mode)

chdev: Kenh thiet bi

tptp: Con tro tro den bang tham so dau cuoi DV_TPT

digitp: Con tro tro den bo dem so nguoi dung DV_DIGIT

mode: Che do hoat dong

#include <stdio.h>

#include <srllib.h>

#include <dxxxlib.h>

#include <windows.h>

main( )

{

DV_TPT tpt[3];

DV_DIGIT digp;

int chdev, numdigs, cnt;

/* Mo kenh, mo ta thiet bi*/

if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) {

/* process error */

}

/* Khoi tao cuoc goi */

/* Thiet lap DV_TPT va lay so */

dx_clrtpt(tpt,3);

tpt[0].tp_type = IO_CONT;

tpt[0].tp_termno = DX_MAXDTMF; /* So chu so lon nhat*/

tpt[0].tp_length = 4; /* Ket thuc bang 4 chu so */

tpt[0].tp_flags = TF_MAXDTMF; /* Ket thuc neu bo dem san sang */

tpt[1].tp_type = IO_CONT;

tpt[1].tp_termno = DX_LCOFF; /* Ket thuc LC */

tpt[1].tp_length = 3; /* Su dung 30ms */

tpt[1].tp_flags = TF_LCOFF|TF_10MS; /* Muc do kich hoat, Xoa history, thoi gian can thiet 10ms */

tpt[2].tp_type = IO_EOT;

tpt[2].tp_termno = DX_MAXTIME; /* Ham thoi gian */

tpt[2].tp_length = 100; /* su dung 10 phut (thoi gian can thiet 100ms) */

tpt[2].tp_flags = TF_MAXTIME; /* Edge-triggered */

/* clear previously entered digits */

if (dx_clrdigbuf(chdev) == -1) {

/* process error */

}

if ((numdigs = dx_getdig(chdev,tpt, &digp, EV_SYNC)) == -1) {

/* process error */

}

for (cnt=0; cnt < numdigs; cnt++) {

printf("

Digit received = %c, digit type = %d",

digp.dg_value[cnt], digp.dg_type[cnt]);

}

/* Chuyen trang thai */

}

Bạn đang đọc truyện trên: Truyen2U.Pro