beautypg.com

Dialogic 6.2 User Manual

Page 80

background image

Developing a Fax Application

November 2009

80

BT_ZERO(args_fax);

args_fax.fmt = FMT_MR_UNALIGN_MSB;

BfvFaxSetReceiveFmt(lp,&args_fax);

Sets the format used to pass the received fax data from the channel

to the computer. In this example, MR data format – byte unaligned,

least significant bit first – is specified.

See the fmt parameter description for detailed information on all of

the data format types that are available through

BfvFaxSetReceiveFmt.

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 end to send its ID and capabilities.

Note:

The previous phone call is terminated by the application if the

remote fax machine's ID does not match the expected value.

BfvFaxWaitForTraining(lp, &args_fax);

Waits for the completion of the Phase B handshaking process.

do

{

BT_ZERO(args_fax);

args_fax.buf = buf;

args_fax.size = size;

/* receive data into buffer */

if (BfvFaxReceiveData(lp,&args_fax) <= 0)

break;

/* Process buffer contents */

Process(buf);

}

Keeping track of the resolution and the data format (previously set

by BfvFaxSetReceiveFmt) of each page, is the application's

responsibility.

When the function returns a 0 at exit from the loop, the application

must determine, from the value of args_fax.expect_another, if

there is another page to receive.