Developing a Fax Application

BT_ZERO(args_tel); args_tel.timeout = 0L; BfvLineWaitForCall (lp, &args_tel);

Waits for the detection of an incoming call.

BfvLineAnswer (lp, &args_tel);

Answers the phone line by going off-hook.

BT_ZERO(args_fax);

args_fax.local_id = "Id_string"; BfvFaxSetLocalID(lp,&args_fax);

Sets the local ID to transmit to the sending machine.

BT_ZERO(args_fax);

BfvFaxBeginReceive(lp, &args_fax);

Begins the Phase B handshaking procedure.

BfvFaxGetRemoteInfo(lp, &args_fax);

Waits for the remote to send its ID and capabilities.

BfvFaxWaitForTraining(lp, &args_fax);

Waits for the completion of the Phase B handshaking process.

do

{

BT_ZERO(args_fax); args_fax.r_tp = tp;

}

while (BfvFaxRcvPageTiff(lp,&args_fax) > 0);

Receives and writes the fax data to the TIFF-F file pointed to by tp.

BfvFaxEndReception(lp, &args_fax);

After the last page is received, waits for the T.30 handshaking confirmation sequence to complete.

BT_ZERO(args_tiff); args_tiff.tp = tp; BfvTiffClose(&args_tiff);

Closes the TIFF file after the file is received.

BT_ZERO(args_admin);

BfvLineDetach (lp, &args_admin);

Frees all the memory for the attached line and closes the device.

November 2009

77

Page 77
Image 77
Dialogic 6.2 manual Closes the Tiff file after the file is received