PrinterSupport—Chapter 5
201700Series Color Mobile Computer User’sManual
NPCP Driver I/O ControlsAn applicationuses the DeviceIoControl() function to specify an printer
operationto be performed. Certain I/O controls are required to bind and
close communication sessions with the printer, and must be completed
before any other commands tothe driv er canex ecute properly.
The function returns TRUE to indicate the device successfully completed
its specified I/O control operation, otherwise it r eturns FALSE. The
following I/O control codes are defined:
#define IOCTL_NPCP_CANCEL
CTL_CODE(FILE_DEVICE_SERIAL_PORT,0x400,METHOD_BUFFERED,FILE_ANY_ACCESS)
#define IOCTL_NPCP_BIND
CTL_CODE(FILE_DEVICE_SERIAL_PORT,0x401,METHOD_BUFFERED,FILE_ANY_ACCESS)
#define IOCTL_NPCP_CLOSE
CTL_CODE(FILE_DEVICE_SERIAL_PORT,0x402,METHOD_BUFFERED,FILE_ANY_ACCESS)
#define IOCTL_NPCP_ERROR
CTL_CODE(FILE_DEVICE_SERIAL_PORT,0x403,METHOD_BUFFERED,FILE_ANY_ACCESS)
#define IOCTL_NPCP_FLUSH
CTL_CODE(FILE_DEVICE_SERIAL_PORT,0x404,METHOD_BUFFERED,FILE_ANY_ACCESS)
#define IOCTL_NPCP_IOCTL
CTL_CODE(FILE_DEVICE_SERIAL_PORT,0x405,METHOD_BUFFERED,FILE_ANY_ACCESS)
#define IOCTL_NPCP_PRTVER
CTL_CODE(FILE_DEVICE_SERIAL_PORT,0x406,METHOD_BUFFERED,FILE_ANY_ACCESS)
SIOCTL_NPCP_CANCEL
This cancels all printing at the printer. It flushes the printe r buffers and
reinitializes the printerto its default state. No parameters are required.
SIOCTL_NPCP_BIND
This commandis required before any data is sent or received by the
printer. Once the driver is opened, theapplication must bind the com-
munications session with the printer before any data can be sent or re-
ceived by theprinter. If an error occurs during the bind, the application
may use IOCTL_NPCP_ERRORto get the current extended error
code. No parametersare required.
SIOCTL_NPCP_CLOSE
This command closes the current session with the printer. This function
alwaysreturns TRUE. No parameters are required.
SIOCTL_NPCP_ERROR
This commandreturns the extended NPCP error code in PL/N format.
The word returned will contain the PL/N compatible error code in the
low byte andcompletion flags in the high byte. If the frame thatre-
turned an error was notreceived correctly by the printer the
FRAME_NOT_ACKED bit willbe set in the high byte. This operation
always returnsTRUE. An output buffer of at least 2 bytes is required.
See “NPCP Error Codes” on page 203.
SIOCTL_NPCP_FLUSH
This command allowsthe application to poll the printer for errors while
the report is completingthe print process at the printer. If an error oc-
curs during thepolling process, the operation will return FALSEand
the applicationcan get the extended error code by using
IOCTL_NPCP_ERROR.No parameters are required.