Npcp Printer Communications; Sample Code - Intermec 700 Series 700 User Manual

Monochrome mobile computer
Hide thumbs Also See for 700 Series 700:
Table of Contents

Advertisement

Chapter
5
Printer Support

NPCP Printer Communications

Sample Code

140
All NPCP printer communications should be based on the following flow:
1 Use CreateFile(); to open the printer driver.
2 Use IOCTL_NPCP_BIND to bind a session with the printer;
IOCTL_NPCP_ERROR to check for errors on the bind to ensure suc-
cess; and IOCTL_NPCP_CANCEL to cancel any outstanding print
jobs.
3 Use IOCTL_NPCP_FLUSH to poll the printer to free up printer buff-
er resources. Use IOCTL_NPCP_FLUSH to poll the printer's status. If
an error is reported by the IOCTL, then use IOCTL_NPCP_ERROR
to get the error and determine the correct recovery procedure.
4 Use WriteFile(); to write your data to the printer. Check for errors and
that all data were written. Use IOCTL_NPCP_ERROR to get the ex-
tended error. If the error is critical in nature, use
IOCTL_NPCP_CLOSE, followed by CloseFile(), to end the commu-
nications session. Start a new session, beginning with step 1 to ensure
proper printing. For noncritical errors display the error and retry the
operation.
5 After all data is sent to the printer, ensure that the printer continues to
print the report properly by polling the printer's status. Use
IOCTL_NPCP_FLUSH to poll the printer's status. If an error is re-
ported by the IOCTL, then use IOCTL_NPCP_ERROR to get the
error and determine the correct recovery procedure.
See sample code in the "\700M Dev Tools\Installable Drivers\Port
Drivers\Npcp\NPCPPrint\" directory for more details on printing, printer
communications and error code handling.
700 Series Monochrome Mobile Computer User's Manual

Advertisement

Table of Contents
loading

Table of Contents