The text of a manual · part 17 of 40
700 Series Color Mobile Computer User's Manual: Section 5 - Printer Support
Pages 130 to 137 of 346, from 700 Series Color Mobile Computer User's Manual
The original document is the PDF (2.9 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
Filed in the catalog under the Intermec Model 720, Intermec Model 740, Intermec Model 741, Intermec Model 751, Intermec Model 760, Intermec Model 710, Intermec Model 730 and Intermec Model 761
Page 130
Section 5
Printer Support "
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
The 700 Series Color Mobile Computer works with the following printers from Intermec Technologies. Contact an Intermec Representative for information about these printers. 6820 6808 781T 782T
A full-page, 80-column printer. A 4-inch belt-mount printer. A 2-inch belt-mount printer with a Bluetooth compatible module from Socket Communications. A 2-inch workboard printer.
Printing ASCII The following methods for printing using Pocket PC at this time is as follows: " "
"
Add port drivers to print ASCII directly to the port. Use LinePrinter ActiveX Control from the Software Developer’s Kit (SDK), see the SDK User’s Manual for more information. Via wireless printing, see the Wireless Printing Development Guide on the 700C Software Tools CD for more information.
Directly to a Port Printing directly to the port sends RAW data to the printer. The format of this data depends upon your application and the printer capabilities. You must understand the printer commands available for your specific printer. Generally, applications just send raw ASCII text to the printer. Since you are sending data to the printer from your application directly to the port you are in complete control of the printers operations. This allows you to do line printing (print one line at a time) rather than the page format printing offered by the GDI approach. It is also much faster since data does not have to be converted from one graphics format to the other (display to printer). Most Intermec printers use Epson Escape Sequences to control print format operations. These commands are available in documentation you receive with your printers or from technical support. Win32 APIs are required to print directly to the port.
Directly to a Generic Serial Port To print directly to a generic serial port printer (non-Intermec printers): " " "
Use CreateFile() to open ports, COM1: can be opened on most devices. Use WriteFile() to send data directly to the printer. Use CloseHandle() when you are finished printing to close the port. 700 Series Color Mobile Computer User’s Manual
5-1
Page 131
Printer Support
SECTION 1
IrDA Printer Driver IrDA printing is only available on the certain devices and is supported directly by the Windows CE load via the IrSock API provided by the Microsoft Win32 API without need for additional drivers. Intermec 6804, 6805, 6806, 6808 and 6820 and other IrDA printers are supported.
NPCP Printer Driver The NPCP printer communications driver (NPCPPORT.DLL) is a Stream Device Driver built into the operating system. The driver supports only NPCP communications to and from the 6820 and 4820 printers over a selected serial port. All applications use WIN32 API functions to access the drivers. Basic operations are easily implemented by applications through the CreateFile(), WriteFile(), ReadFile(), DeviceIOControl(), and CloseHandle() Win32 APIs. Operations to upgrade printer modules, perform printer diagnostics, and get printer configuration are performed largely via DeviceIOControl() functions.
About NPCP NPCP (Norand Portable Communications Protocol) is a proprietary protocol that provides session, network, and datalink services for Intermec mobile computers in the Intermec LAN environment used with printers and data communications.
NPCP Driver Installation and Removal Use LPT9: for the NPCP printer device and COM1 for the last parameter. COM1 is the connection available via the 700 Series Mobile Computer. Applications use the RegisterDevice() function to install the driver. DeregisterDevice() uninstalls the device driver and frees memory space when the driver is not required. Use the HANDLE returned by RegisterDevice() as the parameter to DeregisterDevice(). Use the RegisterDevice() function call as demonstrated below. Specify the full path name to the driver starting at the root for the RegisterDevice() function to work properly. The last parameter to RegisterDevice() is a DWORD that represents the name of the port for the NPCP stream driver to use. Build this parameter on the stack if it is not to be paged out during the call. The first parameter “LPT” (Device Name) and the second parameter ‘9’ (index), indicate the name of the registered device, such as LPT9. This is used in the CreateFile() function call. Install() { HANDLE hDevice; TCHAR port[6]; port[0] = TCHAR(‘C’); port[1] = TCHAR(‘O’); port[2] = TCHAR(‘M’); port[3] = TCHAR(‘1’); port[4] = TCHAR(‘:’); port[5] = TCHAR(0); hDevice = RegisterDevice ( (TEXT(”LPT”), 9, TEXT(“\\STORAGE CARD\\WINDOWS\\NPCPPORT.dll”), (DWORD)port); }
5-2
700 Series Color Mobile Computer User’s Manual
Page 132
Printer Support
SECTION 5
Opening the NPCP Driver The application opens the NPCP driver by using the CreateFile() function. The call can be implemented as follows. The first parameter “LPT9:” must reflect the device name and index used in the RegisterDevice() function call and will fail for any of the following reasons: hFile = CreateFile(_T(”LPT9:”), GENERIC_WRITE | GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); " " " "
The port associated with the device during RegisterDevice() is in use. The NPCP device is already open. The share mode is not set to zero. The device cannot be shared. Access permissions are not set to GENERIC_WRITE | GENERIC_READ. Both modes must be specified.
Closing the NPCP Driver Using the CloseHandle() (hFile) function closes the NPCP driver. Where hFile is the handle returned by the CreateFile() function call. " "
TRUE = the device is successfully closed. FALSE = an attempt to close NULL HANDLE or an already closed device.
Reading from the NPCP Driver Reading of the NPCP printers is not supported since all responses from the printer are the result of commands sent to the printer. DeviceIoControl() functions are provided where data is to be received from the printer.
Writing to the NPCP Driver All Print data can be sent to the printer using the WriteFile() function. The print data written to the driver must contain the proper printer commands for formatting. If the function returns FALSE, the NPCP error may be retrieved using IOCTL_NPCP_ERROR. See the description on the next page.
700 Series Color Mobile Computer User’s Manual
5-3
Page 133
Printer Support
SECTION 5
NPCP Driver I/O Controls An application uses the DeviceIoControl() function to specify an printer operation to 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 to the driver can execute properly. The function returns TRUE to indicate the device successfully completed its specified I/O control operation, otherwise it returns 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)
IOCTL_NPCP_CANCEL This command cancels all printing at the printer. It flushes the printer buffers and reinitializes the printer to its default state. No parameters are required. IOCTL_NPCP_BIND This command is required before any data is sent or received by the printer. Once the driver is opened, the application must bind the communications session with the printer before any data can be sent or received by the printer. If an error occurs during the bind, the application may use IOCTL_NPCP_ERROR to get the current extended error code. No parameters are required. IOCTL_NPCP_CLOSE This command closes the current session with the printer. This function always returns TRUE. No parameters are required. IOCTL_NPCP_ERROR This command returns the extended NPCP error code in PL/N format. The word returned will contain the PL/N compatible error code in the low byte and completion flags in the high byte. If the frame that returned an error was not received correctly by the printer the FRAME_NOT_ACKED bit will be set in the high byte. This operation always returns TRUE. An output buffer of at least 2 bytes is required. See “NPCP Error Codes” on page 5-5. IOCTL_NPCP_FLUSH This command allows the application to poll the printer for errors while the report is completing the print process at the printer. If an error occurs during the polling process, the operation will return FALSE and the application can get the extended error code by using IOCTL_NPCP_ERROR. No parameters are required.
5-4
700 Series Color Mobile Computer User’s Manual
Page 134
Printer Support
SECTION 5
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 success; and IOCTL_NPCP_CANCEL to cancel any outstanding print jobs. 3. Use IOCTL_NPCP_FLUSH to poll the printer to free up printer buffer 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 extended error. If the error is critical in nature, use IOCTL_NPCP_CLOSE, followed by CloseFile(), to end the communications 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 reported 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 “\700 Color Dev Tools\Installable Drivers\Port Drivers\Npcp\NPCPPrint\” directory for more details on printing, printer communications and error code handling.
NPCP Error Codes Call the IOCTL_NPCP_ERROR I/O control function to receive PL/N compatible error codes. Applications must decide how to act upon the data returned. // Definition of NPCP communications Errors and Printer Errors #define PNRDY (BYTE)102 // link not ready error #define RXTMO (BYTE)104 // link no receive error #define TXTMO (BYTE)106 // link no transmit error #define BADADR (BYTE)111 // frame address error #define GAPERR (BYTE)112 // link gap error (timeout) in receive data #define LSRPE (BYTE)113 // frame parity error on length field #define IFTS (BYTE)120 // session layer - invalid frame this state #define NS_NE_VR (BYTE)121 // session layer sequence error #define NR_NE_VS (BYTE)122 // session layer sequence error #define MAC_CRCERR (BYTE)124 // MAC CRC error #define RLENERR (BYTE)123 // MAC too much data received #define FRMERR (BYTE)200 // Frame Reject #define FRMERR_IF (BYTE)201 // Frame Reject - Invalid Frame #define FRMERR_NR (BYTE)202 // Frame Reject - NR Mismatch #define FRMERR_NS (BYTE)203 // Frame Reject - NS Mismatch #define NDMERR (BYTE)204 // Normal Disconnect mode error #define BINDERR (BYTE)210 // bind error #define IPLDUR (BYTE)221 // invalid presentation layer response #define HEADJAM (BYTE)222 // printer head jam #define PAPEROUT (BYTE)223 // printer paper out #define LOWVOLTS (BYTE)224 // printer low voltage #define HIVOLTS (BYTE)225 // printer over voltage #define LOWBAT (BYTE)226 // printer low battery #define COVEROFF (BYTE)227 // printer cover off error #define HEADFAULT (BYTE)228 // printer head short or driver short error #define PFFAULT (BYTE)229 // paper feed motor fault. #define FRAME_NOT_ACKED 0x8000 // frame was not received by printer and need to be resent.
700 Series Color Mobile Computer User’s Manual
5-5
Page 135
Printer Support
SECTION 5
O’Neil Printer Driver The DTR printer communications driver is a Stream Device Driver named ONEIL.DLL. All applications use WIN32 API functions to access drivers. Basic operations are easily implemented by applications through the CreateFile(), WriteFile(), DeviceIOControl() and CloseHandle() Win32 APIs. The driver supports communications to 6804DM, 6804T, 6805A, 6806, 6808, 681T, and 781 printers over a selected serial port.
DTR Driver Installation and Removal Your application must install the device driver by using the RegisterDevice() function. The driver name is ONEIL.DLL. We recommend that you use “DTR” for the Device Name parameter, “1” for the Device Driver index parameter, and use any of the following strings for the last parameter: NULL (==0) Defaults to COM1 @ 9600 " “COM1” only COM port specified defaults to 9600 " “COM1:9600” sets to COM port and specified bit rate " “COM1:19200” sets to COM port and specified bit rate Use the HANDLE returned by RegisterDevice() as the parameter to DeregisterDevice(). The correct usage of the RegisterDevice() function call is demonstrated below. You may use DeregisterDevice() to uninstall the driver. "
Install() { HANDLE hDevice; TCHAR port[6]; port[0] = TCHAR(‘C’); port[1] = TCHAR(‘O’); port[2] = TCHAR(‘M’); port[3] = TCHAR(‘1’); port[4] = TCHAR(‘:’); port[5] = TCHAR(0); hDevice = RegisterDevice ( (TEXT(”DTR”), 1, TEXT(”\\WINDOWS\\ONEIL.DLL”), (DWORD)port); }
Opening the DTR Driver The application opens the DTR driver by using the CreateFile() function. The call can be implemented as follows: hFile = CreateFile(_T(”DTR1:”), GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
The first parameter “DTR1:” must reflect the device name and index used in the RegisterDevice() function call. The function call will fail for any of the following reasons: "
" " "
5-6
The port associated with the device during RegisterDevice() is currently in use. The DTR device is already open. The share mode is not set to zero. The device cannot be shared. Access permissions are not set to GENERIC_WRITE.
700 Series Color Mobile Computer User’s Manual
Page 136
Printer Support
SECTION 5
Closing the DTR Driver Using the CloseHandle() (hFile) function closes the DTR driver. Where hFile is the handle returned by the CreateFile() function call. " "
TRUE indicates the device is successfully closed. FALSE indicates an attempt to close a NULL HANDLE or an already closed device.
Writing to the DTR Driver You can use the WriteFile() function to send all Print data to the printer. The print data being written must contain the proper formatting printer commands.
DTR Printer Communications All DTR printer communications should be based on the following flow: 1. Use CreateFile(); to open the printer driver. 2. Use WriteFile() to write your data to the printer. Check for errors and that all data were written. 3. Use CloseHandle() to close the driver.
700 Series Color Mobile Computer User’s Manual
5-7
Page 137
Printer Support
5-8
700 Series Color Mobile Computer User’s Manual
SECTION 5