
Developing a Fax Application
Accessing an Infopkt Stream from an Application
The function calls BfvFaxSendPage and BfvFaxNextPage are typically used in a loop. Both read infopkts from the infopkt stream for processing.
BfvFaxSendPage reads infopkts and processes them in a loop. When data (embedded or indirect) or strip parameter type infopkts are encountered, the indicated parameters and data format (ASCII or G3) commands are sent to the channel, the data is downloaded to the driver buffer, and the next infopkt is read. If any other type of infopkt is encountered, the current position in the infopkt stream remains unchanged, and the function returns to the calling routine.
BfvFaxNextPage reads infopkts from the current position in the infopkt stream. All consecutive infopkts of a
INFOPKT_PAGE_PARAMETERS,
INFOPKT_T30_PARAMETERS,
INFOPKT_BEGINNING_OF_PAGE, or
INFOPKT_DOCUMENT_PARAMETERS,
are processed, and relevant data and a single
A program to read a file containing infopkts could look like this:
BT_ZERO(args_infopkt);
args_infopkt.fname = "filename"; args_infopkt.fmode = "r";
ips = BfvInfopktOpen(&args_infopkt); for (;;)
{
BT_ZERO(args_infopkt); args_infopkt.ips = ips; args_infopkt.i_mode = INDIR_MODE_FOLLOW;
if ((ip = BfvInfopktGet(&args_infopkt)) == NULL) break;
process(ip);
}
With the flag set to INDIR_MODE_FOLLOW or
INDIR_MODE_FOLLOW_NOUSER, BfvInfopktGet follows indirect infopkt links automatically, so the user sees only the actual data. Other flags let the user examine a file without following indirect infopkt links. See the BfvInfopktUser function in Volume 4, Fax
November 2009 | 83 |