The text of a manual · part 8 of 28
PEN*KEY 6400 Computer Programmer's Reference Guide: Section 2: Supporting DOS Applications, pages 50 to 58
Pages 50 to 58 of 234, from PEN*KEY 6400 Computer Programmer's Reference Guide
The original document is the PDF (1.4 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.
For the Intermec 6400
Page 50
Supporting DOS Applications
SECTION 2
Load the scanner driver TSR using command line switches “ –e –w”. Then load the application. Do not load or use 6400IKPS, 6400BIOS, 6418BIOS, nor any FWP64xHx programs with the the scanner driver TSR, when either the “–e” or “–w” switches are used. These two switches cause the scanner driver to send scan data from the laser to the PC BIOS console key buffer, where an application can read it as key strokes. 6400IKPS, 6400BIOS, 6418BIOS, and FWP64xHx do not look for their scan data in the keyboard buffer. They get the data through an API INT call to the scanner driver (see API SCANNING METHOD below). Wedge scanning allows an operator to scan ahead of the application because the application cannot disable scanning. The scanner driver buffers scanner data, so that no scanner data is lost, and passes the data to the key buffer as the application asks for keys. The operator gets a good scan indication even though the application may later reject the data. When the application rejects the scanner data, the operator must figure out which scans were accepted and which were not and re-scan the rejected scans. " NOTE:
The current version of The scanner driver allows itself to be loaded multiple times. Be careful, do not re-load the scanner driver when a copy currently resides in memory. If it is necessary to re-load the scanner driver with different switches, you must reboot between each load. Future versions of the scanner driver will have the capability to detect whether it is already loaded, unload from memory, and send command line switches to the in-memory copy to change its configuration.
API Scanning 6400IKPS.EXE is a DOS TSR that implements a scanning API. The API facilitates porting of RF terminal Application Development Kit (ADK) applications to the 6400 Computer and development of DOS client scanning applications for the 6400 Computer, by hiding the complexities of scanning and validation algorithms from the application developer. The API enables an application to: " " " "
Disable the internal scanner engine when scanning is not desired. Validate bar code data beyond what the laser device provides. Process scanner data differently than keyboard data. Programmatically enable or disable symbologies and symbology options for the internal laser engine and certain symbology options for tethered lasers.
The API is called using a software INT 0x7A instruction with parameters passed in registers. The calling interface is patterned after PC BIOS calls, and is described as follows.
2-10
PEN*KEYR 6400 Programmer’s Reference Guide
Page 51
Supporting DOS Applications
SECTION 2
API Scanning Application Architecture A scanning application that uses the API would first load 641223.EXE without any command-line switches, the scanner API 6400IKPS.EXE next, then itself. Figure 2-1 API Scanning System Architecture
DOS Scanning Program
64SCNPRM.EXE
SCANDOS
64SCNPRM.DAT
64SCN7A
6400IKPS
(multi-tasking)
(single-threaded)
API INT 7Ah
API INT 7Ah
641223.EXE Tethered Serial Device
Internal Laser Engine
The diagram above represents the architecture, depicting the layering of software and hardware. Beginning with the lowest layer, the hardware is included first; then the software is installed, as shown from the bottom toward the top of the diagram. INT 7Ah API Functions The scanning API INT 7Ah functions are used to control and obtain the data from the scanner. 6400IKPS and 64SCN7A provide the following INT 7Ah functions. Table 2-4 Scanning API Functions
AH=
Function
Description
80h
Scanner On
Turns the scanner on and enables the SCAN_Key
81h
Scanner Off
Turns the scanner off.
82h
Set Scanner Type
Establishes the scanner type.
83h
Set Bar Code Options
Tells the scanning system which symbologies to enable and with which options.
84h
Read Bar Code Data
Gets bar code data, if available.
FEh
Flush Scanner Concatenation Buffer Data
Flushes the concatenation buffer automatically, under conditions specified in the BIOS Interrupt Support section.
Refer to the BIOS Interrupt Support section, for details of these functions, which are provided by Intermec Technologies Corporation. PEN*KEYR 6400 Programmer’s Reference Guide
2-11
Page 52
Supporting DOS Applications
SECTION 2
64SCN7A 64SCN7A.EXE is a single-threaded scanner API. It should be used by single-threaded DOS applications to control and acquire scanner data. Because it does not use multi-tasking functions, it is much smaller than 6400IKPS. 6400IKPS 6400IKPS.EXE is a multi-tasking scanner API. It provides the scanning API and ADK INT 15 multi-tasking functions. 6400IKPS must be used with multi-tasking ADK applications and 64SCNPRM (which uses multi-tasking). API Calling Sequence The 6400IKPS API functions do not work if these rules and sequence are not followed: 1. The Set Bar Code Options function can be called anytime to set the bar code options. 2. The Set Scanner Type function should be called only while scanner is off. 3. Call the Scanner On function. 4. Do idle loop allow a Scanner Task Switch ; ( see INT 15h, AX=010Ch ) if a key is pressed ; ( see INT 16h, AH=01h ) read the key ; ( see INT 16h, AH=00h ) if the key is the SCAN_Key ; ( SCAN_Key is setup in the ; INT 7Ah, AH=80h, function ) call Read Bar Code Data function ; ( see INT 7Ah, AH=84h ) process the bar code data else process the key endif endif if there is something else to do do something else endif as long as needed 5. Call the Scanner Off function. 6. Terminate the program. The application must call the Scanner Task Switch function in its idle loop. This is when 6400IKPS gets control to do scanning in the background. If the application does not call Scanner Task Switch, then the internal scanner laser beam does not come on when the SCAN key is pressed, and the data from a tethered scanner is ignored. Any delay in the application calling Scanner Task Switch is reflected in scanner responsiveness.
Internal Laser Configuration Tool: 64SCNPRM.EXE 64SCNPRM.EXE is provided in the 6400 DOS Tool Kit to facilitate setting the internal laser engine configuration parameters. 64SCNPRM uses multi-tasking functions and must be loaded over 6400IKPS. The following information applies to the 1122 scanner. The 1223 scanner has additional options (refer to the table on page 2-7). 2-12
PEN*KEYR 6400 Programmer’s Reference Guide
Page 53
Supporting DOS Applications
SECTION 2
64SCNPRM uses a hierarchy of menus as the user interface. From the first menu displayed after loading, you can select: “1” to set symbology Scan options “3” to scan bar codes to test your setup “6” to exit to DOS Loading 64SCNPRM initializes the engine symbology options to those values found in a file named, 64SCNPRM.DAT. If the file is not found, it is created with default settings that turn everything off. These options are then sent to the laser engine. During the time it saves these parameters, a message to that effect is displayed. If the file cannot be created or written to, an error message is displayed, “Press any key to proceed”. It is possible for the engine parameters to be different from the 64SCNPRM default, or saved values, if the engine scans “setup bar code labels” in any of the Symbol smart laser user guides. 64SCNPRM changes the following engine options in addition to its menu options: Send No-decode Characters Bi-directional Redundancy Decode Attempt Time Preamble Postamble 1 Postamble 2 Send Code ID UPC/EAN Security Level UPC/EAN Security Zone UPC/EAN Supplement Auto-D Decode Addon-2, 5 required UPC-E Check Digit UPC-A Check Digit UPC Prefix Send Code 128 Function Characters Send Scan Direction disabled disabled 7 disabled disabled disabled disabled none 4 enabled if addon-2 or 5 enabled in menus disabled disabled disabled system character only disabled disabled
SCANDOS SCANDOS is a sample single-threaded DOS scanning application, which runs over 64SCN7A. The C source code is provided with comments explaining how to build and use SCANDOS.
Scan Options Menu The Scan Options menu allows enabling and disabling symbologies, by pressing the number of their menu item. Enabled symbologies and options are indicated by displaying the menu item number in reverse video. Pressing the symbology number again disables it. If the symbology has options, such as fixed lengths 1 and 2 for interleaved 2 of 5, or addons for UPC and EAN, then an option menu is displayed. Pressing the ENTER key returns you back to the previous menu. Returning to the main menu saves the setup to the engine and 64SCNPRM.DAT. The Scan Options menu lists only those symbology options of the internal laser engine that are in the bar code setup menus of the NORAND RF terminal emulation software. In a future release of 64SCNPRM, all of the user settable engine parameters, specified in the SE 1223 Integrated VLD Scanner User ’s PEN*KEYR 6400 Programmer’s Reference Guide
2-13
Page 54
Supporting DOS Applications
SECTION 2
Guide, will be supported. The software symbology validations are not currently supported. The “1) Laser” menu item cannot be changed; Laser is always enabled, as there is no other scanner device type supported by the 6400 Computer.
Scan Barcodes Menu The Scan Barcodes menu enables the scanner so you can test your setup. The symbology type is displayed to the right of the “Type>” prompt, in hexadecimal; and if it is a displayable character, it is displayed in ASCII. If the scan was a concatenation, then a “C” is displayed to the right of the type character.. The bar code data is displayed on the next line (or lines), followed by the length of the data to the right of the “Length>” prompt.
Internal Laser Engine Symbology Validations Some of the symbology validations are handled by the internal laser engine. If those validations fail the engine keeps trying to decode until the trigger is released or the scan timeout is reached. Those validations, not supported by the internal laser engine, are executed in software after the engine has decoded the bar code. When these validations fail, they cause a no-decode and the operator must release and press the SCAN key on the keyboard to try again. Software Symbology Validations: " All symbologies in the Decoded_Symbology_Types list: Length validation Drop leading, trailing characters " Code 39: Full ASCII Mod check Concatenation " Interleave 2 of 5: Mod check " Codabar: None " UPC and EAN: UPC-A, UPC-E, EAN-8, and EAN-13 type validation Addon-2 validation Addon-5 validation Expand UPC-E to UPC-A Expand EAN-8 to EAN-13 " Code 128: Strips unwanted function characters UPC/EAN-128 F1 detection, F1 formatting F2 concatenation " MSI Plessey: None
2-14
PEN*KEYR 6400 Programmer’s Reference Guide
Page 55
SECTION 2
Supporting DOS Applications
Tethered Laser Symbology Validations Tethered lasers must be configured to send a symbology type character. The scanner driver assumes the first character of the tethered laser bar code data is the symbology type character and removes that character from the bar code data. The tethered laser symbology type characters causes their respective Software Symbology Validations to be executed if the symbology is enabled in the Barcode_Options array of the Set Bar Code Options function and the symbology type is in the Decoded_Symbology_Type list of the Read Bar Code Data functions. The Software Symbology Validations available for the tethered laser are the same as those for the internal laser engine. If the symbology type is not in the Decoded_Symbology_Type list, then the symbology type character and the bar code data is returned to the application as-is without any validation checks.
PEN*KEYR 6400 Programmer’s Reference Guide
2-15
Page 56
Supporting DOS Applications
SECTION 2
DOS NPCP Printing: PC4800.SYS NPCP Printing Support, under DOS, consists of DOS device driver PC4800.SYS, which allows DOS and PL/N applications written for 6400 Computers to print to NORANDR 4810, 4815, and 4820 Printers, using the NPCP protocol.
Installation and Configuration Required CONFIG.SYS Entry To install the DOS driver for the 4815 or 4810 Printers, place the following statement in the CONFIG.SYS file and reboot. If PC4800.SYS is not in the root directory, be sure to include the path. device=PC4800.SYS LPT1 1 /I1
NOR4800 is the default name for the device driver that is used to open the device. By using PC4800.SYS, a specific device driver is specified. Add a command line parameter (LPT1), as shown in the preceding statement, to override this. The driver can then be accessed via this name when the device is opened. Give it any name you want (except PRN) (using up to eight characters). Add a second parameter to indicate the communications port number to use for output: 1 = COM1, 2 = COM2, etc. To set the communications port number, you must also specify the device name. Parameter order is important. The default port is COM1. By default, PC4800.SYS supplies only the DOS device driver interface to NPCP Printers. To support PL/N applications, interrupt 17h must also be installed. To do so, add a /I switch to the command line, as shown in the preceding statement. The digit placed after the “I” refers to the LPT port, which gets redirected to the device driver at the interrupt 17h prompt. For example, if a “1” is specified, then all interrupt 17h calls for LPT1 are redirected to the PC4800.SYS Device Driver.
Typical AUTOEXEC.BAT Entries Refer to Appendix A, Sample Configuration Files, for a typical examples of items that should be in your AUTOEXEC.BAT file.
Functionality and Usage Intermec supplies PL/N and C standard printer routines that handle critical errors and the printing of text to NORAND Printers. The following information is for those who might want to create their own print routines. The DOS driver for the 4815 and other NPCP Printers must be opened before it can be used. Use the correct open call, for the language being used, that allows writing to the device. An open mode that opens only devices (files) when they currently exist, checks for the existence of the device and returns an error if it is not there. Open modes, that create a file upon opening, even creates a file if the driver is not present. To write to the device, use any appropriate output function that can be directed to the device (for example, in C you can use fprintf()) . You should install a critical error handler that processes errors from the printer. The printer driver only returns “device not ready” errors to DOS, for the sake of 2-16
PEN*KEYR 6400 Programmer’s Reference Guide
Page 57
Supporting DOS Applications
SECTION 2 compatibility with the standard PRINT program supplied with DOS. You can retrieve the extended error by bypassing DOS and calling the driver directly from the error handler. The Ioctl calls (DOS Function AH = 44h, AL = 02h) are supported by the device driver (refer to a DOS technical reference manual for detailed information relating to this function). Calls require the handle number of the printer device in register BX, a data item with the following structure pointed to by DS:DX, and the number of bytes to be read in register CX. struct ioargs { far *unsigned char ioctl_cmd; far *unsigned char ioctl_buf; };
The following commands may be pointed to by the ioctl_command field for execution by the driver: ONLINE = 2 STATUS = 3 GET DEVICE FEATURES = 4 SELFTEST = 5 RESET = 6 GET CURRENT CONFIGURATION =7 XTENDED ERROR = 255
Data is returned to the buffer pointed to by the ioctl_buf, for the number of bytes specified in register CX when the ioctl call is made. The first byte of the returned data represents any error encountered during the call. If the call was successful, this byte is zero. If the call was unsuccessful, this byte represents the extended error. The format of the rest of the data is described in the documentation for the printer to which the call is being directed.
Notes The printer driver must be opened and closed for each report transaction with the printer if you want to take advantage of the line-loss detection features of the NPCP Protocol. Applications should status (ioctl 3) the printer after the last line of a report or a series of reports are sent to the printer to ensure that all lines were printed successfully by the printer. The printer driver is multitasking. If the application needs to take full advantage of this feature, it must enable time-slicing through the appropriate call to INT 15h. If time-slicing is not activated, the last line buffered by the driver is not sent to the printer until the device is closed or an ioctl status call to the printer is made. You should perform a ioctl status call before all closes to ensure that the driver print buffer is sent to the printer successfully, since DOS closes to character devices do not perform output flushes as part of the close operation. The driver flushes the buffer for you upon a close, but no error is returned if the flush is unsuccessful. The printer driver intercepts interrupt 17h ( Printer BIOS Services ) and translates the requested functions to provide PL/N support. The BIOS interface provided for INT 17h is not 100 percent PC compatible: it is meant to be compatible with PL/N. The support that the BIOS interface provides for standard applications is unknown. PEN*KEYR 6400 Programmer’s Reference Guide
2-17
Page 58
Supporting DOS Applications
SECTION 2
DOS IrDA Printing: PRDRV.SYS, IRDAPDRV.EXE The 6400 Computer supports IrDA printing under DOS. It consists of the device driver, PRDRV.SYS, plus IRDAPDRV.EXE, the actual driver handler, link management wrapper, and protocol stack. Together these two software components form the IrDA printer solution, providing a standard DOS character driver to support IrDA printers.
Device Driver Entry Points The IrDA printer driver supports the following DOS device driver entry points, compatible with the standard input and output libraries provided by DOS compilers, handling the request as indicated by the summarized processes details: open – Attempts discovery of an IrDA device, and if discovery is successful, establishes an IrLMP connection for a printer with the device discovered. " NOTE:
Only one open connection is allowed at this time.
read
Returns any data sent by the system. A return count of zero implies that no data is available.
write The written character is stored in a local coalescence buffer (with the IrLMP protocol header inserted) until the frame size is reached, at which time the frame is transmitted to the printer. If the –n switch is used, each user write byte count is sent with the IrLMP protocol header inserted without any attempt at local coalescence. ioctl
This processing is specific to Intermec and is intended to support printing applications. A printing program may hook the DOS INT 24 critical error interrupt and then call the driver ’s ioctl directly using the information provided by INT 24. The driver responds by setting an extended error code in the application’s memory, using a pointer that was passed to it through the ioctl interface. The following ioctl call switch is currently implemented. IOCMD_STATUS : // 0x03 requestHeader.headerStatus = detailedErrorCode; break; IOCMD_ID : // 0x80 requestHeader.headerStatus = 0x0a; break; default : requestHeader.headerStatus = detailedErrorCode; break;
where detailedErrorCode is one of the following: 0 PREADY Device driver is open. A printer connection is established. 50
2-18
IRLAP_DISCONNECT_ERROR Close failure. A disconnect event state change failure occurred during the disconnect procedure processing.
PEN*KEYR 6400 Programmer’s Reference Guide