
Developing a Fax Application
args_admin.config_file_name = "usrcnfig.cfg"; BfvLineReset(lp, &args_admin);
Resets the channel and sets the
BT_ZERO(args_infopkt); args_infopkt.fname = name; args_infopkt.fmode = "w";
ips = BfvInfopktOpen(&args_infopkt);
Opens the
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
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.
Note: The previous phone call is terminated by the application if the remote fax's ID does not match the expected value.
BfvFaxWaitForTraining(lp, &args_fax);
Waits for the completion of the Phase B handshaking process.
BT_ZERO(args_fax); args_fax.r_ips = ips; BfvFaxReceivePages(lp,&args_fax);
Receives and writes the fax data to the infopkt stream file pointed to by ips.
BT_ZERO(args_infopkt); args_infopkt.ips = ips; BfvInfopktClose (&args_infopkt);
Closes the infopkt stream file after the file is sent.
November 2009 | 69 |