Intermec 700 Laptop User Manual


 
Printer SupportChapter 5
202 700 Series Color Mobile Computer User’sManual
NPCP Printer Communications
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 f or 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.
Sample Code
See sample code in the “\700C Dev Tools\Installable Drivers\Port
Drivers\Npcp\NPCPPrint\” directory for more details on printing, printer
communications and error code handling.