The text of a manual · part 9 of 17
Apex III / Apex IV Technical Reference Manual, Second Edition, pages 81 to 90
Pages 81 to 90 of 168
The original document is the PDF (1.2 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 Compsee Apex III and Compsee Apex IV
Page 81
Apex PDT Technical Reference Manual
Option MsiPl
Bar Code Driver Options And Modifiers Modifiers Default Description Min length (2 - 64), Check digits (1-2)
OFF
Prfx
Decode prefix
C
R
None
N/A
Sfx
Decimal number representing ASCII character (0-255) Timeout Laser range 1 - 3 (3) Wand range 1 - 30 (5)
0 (None)
Type of scan engine
Auto Set
TimO
Type
3 (5)
No action required
UESup
6 Utility Programs
None
OFF
Decode MSI Plessey symbols. The minimum length includes the Modulo 10 check digit(s). The default minimum length is 2 characters. The check digit(s) are validated, but not returned. Check digit(s) default to 1. Adds a prefix to the decoded symbol. See Symbol Prefixes for details (see Table 6-3, page 6-10). C = Compsee prefixes A = AIM prefixes N = No prefixes Remove driver if possible. DOS drivers may only be removed if no other TSR or driver has been loaded after them. Only valid as an option from the command line. Adds a character to the end of the returned string. Sfx=0 (or –Sfx) disables suffix. Included as a safety feature. Stops scanning after this many seconds without successful recognition. The default for all types is 3, except for type WAND = 5. This option should be set after “Type” on the command line. Forces the scan engine type. If this parameter is omitted, the scan engine type is detected automatically and set accordingly the first time the driver is loaded. INT - internal laser scan engine EXT - external laser scanner AIM - internal laser with aim beam capability WAND - external wand This option should be set before “TimO” on the command line. Enables mode where all UPC and EAN must have a 2 or 5 character supplement. This option may be turned ON or OFF at any time. Enabling or disabling UPCx or EANx has no effect on this setting.
Table 6-2: Bar Code Driver Options And Modifiers (Continued)
COAM30002
Rev. 2.00
8/13/02
6-9
Page 82
Apex PDT Technical Reference Manual
UPCA
None
ON
UPCE
None
ON
6 Utility Programs
Decode UPC-A symbols. The check digit is returned as part of the decoded data. Decode UPC-E symbols. The check digit is returned as part of the decoded data.
Table 6-2: Bar Code Driver Options And Modifiers (Continued)
Code Types And Symbol Prefixes Symbol Type
Code Type
No decode
0
Z
Z
Code 39 Interleaved 2 of 5
1 2
A B
A I
Codabar Code 128
3 4
C D
F C
Code 93 Code 11
5 6
E F
G H
UPC-A UPC-E
7 8
G H
E E
EAN-8 EAN-13
9 10
I J
E E
MSI Plessey Identicode 2 of 5
11 12
K L
M R
Industrial 2 of 5 Matrix 2 of 5
13 14
L L
S S
15
P
C
16
Q
C
UCC/EAN-128 (FNC1 in first character position) UCC/EAN-128 (FNC1 in second character position)
Compsee Prefix (Prfx=C)
AIM Prefix (Prfx=A)
Table 6-3: Bar Code Types And Symbol Prefixes
6-10
COAM30002
Rev. 2.00
8/13/02
Page 83
Apex PDT Technical Reference Manual
6 Utility Programs
BCDRIVER Programming The Apex PDT Bar Code Driver (BCD) is a DOS Terminate and Stay Resident (TSR) driver for operating various types of scanners including internal laser engines, external tethered laser engines, and simple wand devices. Normally loaded from the standard DOS [autoexec.bat] file, the BCD uses a variety of command line options and option modifiers to configure the unit for the user’s unique requirements. Additionally, the driver can be run again at any time after initial loading with new or different options and modifies the operational parameters. The foreground copy of the driver communicates with the installed version using proprietary methods and modifies the operational parameters. The driver does not use IOCTL calls for communications. Only one copy of the driver ever remains resident in memory. Application Programming Interface (API) Applications may also modify the driver’s modes using the built-in Application Programming Interface (API). This section of the Apex PDT Technical Reference Manual specifically covers use of the API. The API is supplied in two forms: q
A high-level interface written in C and PowerBASIC that encapsulates and isolates the low-level interface.
q
A low-level interrupt driven interface.
Generally, it is recommended that the high-level interface be used. The C high-level interface is supplied with the Apex PDT (on the Product Support CD) as a linkable library for small, compact, medium, and large models. Model Type Small Compact Medium Large
Filename [Bcapi_s.lib] [Bcapi_c.lib] [Bcapi_m.lib] [Bcapi_l.lib]
Each library is suitable for linking with applications written in C or C++. For other languages, the user should first encapsulate the low level functions in a suitable library for the target language.
COAM30002
Rev. 2.00
8/13/02
6-11
Page 84
Apex PDT Technical Reference Manual
6 Utility Programs
Interrupts During scanning, all hardware interrupts are disabled, including SMI (System Management Interrupts) used for power management and keyboard input. The driver permanently hooks the following interrupts when installed. 08h - Tick (hardware) interrupt. The driver when installed hooks the interrupt. The interrupt is also re-vectored while the driver is actively scanning. 09h - Keyboard (hardware) interrupt. All keyboard input is examined for the <SCAN> key. The key is not placed in the keyboard buffer if “BTN” is true. If the <SCAN> key is disabled from automatic driver recognition (“-BTN”), the key code is buffered as an extended scancode (3800h) just like any other key. User software should not take over this interrupt, but instead use the standard AT BIOS Int 15h, function 4Fh, keyboard intercept if direct keyboard input is required. Note that the <SCAN> key generates a raw scan code of 62h, which is translated during Int 09 processing to 3800h. 13h - Disk services interrupt. The driver will not “wake-up” while disk I/O is in progress. The driver performs no disk I/O of its own. 1Bh - Control-break interrupt. The driver prevents recognition of the <FN> + <U> key sequence while actively scanning. This is required for safe TSR operation. 23h - Control-C interrupt. The driver prevents recognition of the <Ctrl> + <C> key sequence while actively scanning. This is required for safe TSR operation. 24h - DOS critical error interrupt. The driver prevents recognition of DOS critical errors while actively scanning (critical errors are buffered). The driver makes no use of DOS servi ces including disk, keyboard, and screen I/O, nor will it generate a critical error from within the driver itself. 28h - DOS Scheduler. The driver suspends multi-tasking while actively scanning. 2Fh - DOS multiplex interrupt. This interrupt is hooked in compliance with the de-facto standard for TSR use. The interrupt along with a unique ID value, is used to communicate with the driver and forms the basis of the API itself. User software may also hook this interrupt in compliance with the standard techniques.
6-12
COAM30002
Rev. 2.00
8/13/02
Page 85
Apex PDT Technical Reference Manual
6 Utility Programs
High-Level API (C, C++ Language) Only one header file, [bc_api.h] (supplied) is required to use the C/C++ API. This file is well documented and serves as its own reference. It is strongly recommended that the user always include this file in applications that use the API library. It is suitable for inclusion in programs written in C or C++. Install Check
BcApiInstallCheck Syntax:
bool BcApiInstallCheck(unsigned char id)
Input:
id = driver’s multiplex ID, usually BCD_ID (0CEh)
Returns:
True if driver installed, else false.
Notes:
This function is used to determine if the driver is installed. If not installed, the application should exit(), returning an error code (non-zero) to DOS. Since it is expected that the application would require the driver, this error is unrecoverable from within the application.
Set Options
BcApiSetOption Syntax: Input:
int BcApiSetOption(unsigned char id, char far *s) id = driver’s multiplex ID, usually BCD_ID (0CEh) s = (far) pointer to ASCIIZ string
Returns:
0 for success BAD_OPTION, BAD_MOD1, BAD_MOD2 indicating which part of the string failed parsing.
Notes:
This function is used to pass options and modifiers to the driver using the same syntax as the command line interface. Unlike the command line, only one option (and its modifiers) can be passed as a string argument at a time. Multiple options will result in the driver’s failure to process the string option.
COAM30002
Rev. 2.00
8/13/02
6-13
Page 86
Apex PDT Technical Reference Manual
6 Utility Programs
Scan Control
BcApiScan Syntax:
int BcApiScan(unsigned char id)
Input: Returns:
id = driver’s multiplex ID, usually BCD_ID (0CEh) 0 for success, non-zero on failure.
Notes:
BcApiScan causes the scan engine to activate and the scanning process to begin. For applications requiring fine control when scanning is permitted, the application should disable the driver from automatically activating when the <SCAN> key is pressed (use “-BTN”), then monitor the keyboard for the <SCAN> key and invoke this function when scanning is desired. The driver stops scanning when either the <SCAN> key is released, the programmed timeout limits are exceeded, or upon successful symbol recognition.
Register Buffer
BcApiRegisterBuffer Syntax:
int BcApiRegisterBuffer (byte id, char far *buf, unsigned size, unsigned far *decodedCount, CODETYPE far *symbology)
Input:
id = driver’s multiplex ID, usually BCD_ID (0CEh) buf = far pointer to a char buffer (array) for storing the decoded symbol. This should normally be a static or global array so that the array never goes out of scope. If this pointer is NULL, wedge operation is assumed. size = the size of the buf array in bytes (size_t characters) decodedCount = far pointer to an unsigned int where the count of decoded characters (not including the NULL terminator) is stored by the driver. This should normally be a static or global array so that the array never goes out of scope. This parameter should not be NULL if buf is not NULL. symbology = far pointer to a CODETYPE variable. An enumerated value is placed in this location by the driver indicating the type of decoded symbology, i.e. Code 11, Code 93, etc. See Table 6-3 for additional details.
6-14
COAM30002
Rev. 2.00
8/13/02
Page 87
Apex PDT Technical Reference Manual
6 Utility Programs
BcApiRegisterBuffer continued Returns: Notes:
0 for success, non-zero on failure. This function is used to register an external buffer, supplied by the application, with the driver. If the pointer to buf is not NULL, the driver will place the decoded ASCIIZ characters into the array, and fill in the decodedCount and symbology values as well. If the value passed for buf is NULL, the driver will return to wedge operation, whereby it stuffs the keyboard buffer with the decoded characters. An application program that registers an external buffer, MUST release the buffer when exiting to DOS.
Release Buffer
BcApiReleaseBuffer Syntax:
void BcApiReleaseBuffer(void)
Input: Returns: Notes:
None None The BcApiReleaseBuffer function calls BcApiRegisterBuffer() with a NULL argument for the buffer address (defaults the ID to BCD_ID - 0CEh). If an application has changed the default multiplex ID for the driver, this call will fail. In this event, call BcApiRegisterBuffer() which will supply the correct argument for id and NULL for the buffer pointer.
Get Key
Getkey Syntax:
int Getkey(void)
Input: Returns:
Available keystrokes from the keyboard buffer If an extended scan code is found, it returns the scan code + 100h to easily differentiate extended keys from ASCII. The Getkey function gets the next available keystroke from the keyboard buffer using getch(). The <SCAN> key is returned as 138h. Using getch() causes this function to wait for the next available keystroke.
Notes:
COAM30002
Rev. 2.00
8/13/02
6-15
Page 88
Apex PDT Technical Reference Manual
6 Utility Programs
Get Key If Available
GetKeyIfAvailable Syntax:
int GetKeyIfAvailable(void)
Input: Returns:
Keyboard input If an input is available, the function returns the value returned by Getkey(). If an input is not available, the function returns NOKEY (-1). The GetKeyIfAvailable function checks to see if any keyboard input is available, then calls Getkey() if inputs are available.
Notes:
High-Level API (PowerBASIC) The Application Programming Library for PowerBASIC file [a3scan.pbl] along with the associated include file [a3scan.inc] can be found on the Apex PDT Product Support CD supplied along with the unit. Install Check apiBCInstallCheck Syntax: Input:
FUNCTION apiBCInstallCheck% (ID%) PUBLIC ID% = Driver’s multiplex ID, Default 0CEh (206)
Returns: Notes:
Zero (0) if driver is not installed. Used to determine if the Bar Code Driver is installed. Applications should be written to abort if the driver is not installed.
Set Option apiBCSetOption Syntax:
FUNCTION apiBCSetOption%(BcdCommand$, ID%) PUBLIC
Input:
OptionString = Bar code Modifiers ID% = Driver’s multiplex ID, Default 0CEh (206) 0 if successful, non-zero on failure. Uses the same syntax as the command line interface to bcdriver with one exception. This function can only handle one modifier at a time. For multiple modifiers the application must call the function for each.
Returns: Notes:
6-16
COAM30002
Rev. 2.00
8/13/02
Page 89
Apex PDT Technical Reference Manual
6 Utility Programs
Soft Scan apiBCSoftScan Syntax:
FUNCTION apiBCSoftScan% (ID%) PUBLIC
Input: Returns: Notes:
ID% = Driver’s multiplex ID, Default 0CEh (206) 0 if successful, non-zero on failure. Causes the scan engine to activate and the scanning process to begin. The driver stops scanning when either a bar code is read or the programmed timeout is reached.
Set Buffer apiBCSetBuffer Syntax: Input:
Returns: Notes:
FUNCTION apiBCSetBuffer%(apiBarCode AS STRING, apiCount%, apiSym%, BYVAL ID%) apiBarCode = This is the bar code buffer. The buffer should be initialized with spaces, up to the maximum bar code size to be read. apiCount% = This is used by the driver to store the number of characters scanned. apiSym% = A number is placed in this variable to indicate the symbology of the bar code scanned. The symbologies are stored in the global array apiBCTypes(). ID% = Driver’s multiplex ID, Default 0CEh (206) 0 if successful, non-zero on failure. This function is used to set up a bar code buffer to be used by the application to store scanned information. If this buffer is not created the bar code data is placed in the keyboard buffer.
Release Buffer apiBCReleaseBuffer Syntax:
FUNCTION apiBCReleaseBuffer% (BYVAL ID%) PUBLIC
Input: Returns: Notes:
ID% = Driver’s multiplex ID, Default 0CEh (206) None This function is used to remove the bar code buffer created by bcSetBuffer%. This in effect places the Bar Code Driver into the wedge mode.
COAM30002
Rev. 2.00
8/13/02
6-17
Page 90
Apex PDT Technical Reference Manual
6 Utility Programs
Examples Three fully commented examples of using the API are supplied on the Compsee Product Support CD. [api_ex1.cpp] demonstrates: q q q q q
Using the keyboard to select different operating features & options. Disabling the <SCAN> key. Controlling scanning from within this application. Windowing of the Compsee LCD that has a maximum text size of 30 × 20. Swapping between buffered and wedge operating modes.
[api_ex2.cpp] demonstrates: q q q
Resetting the driver options to defaults. Initializing the driver to only recognize UPC and EAN symbols using an array of command strings. Changing from the default beep to a lower pitch of longer duration.
[api_ex3.cpp] demonstrates: q q q
6-18
Resetting the driver options to defaults. Initializing the driver to recognize no symbologies. Parsing the input keys to set options in the driver.
COAM30002
Rev. 2.00
8/13/02