1.1 How to download data from scanner ....................................................................................................................... 5
1.2 COM definition for PA500............................................................................................................................................6
2.1. Register the application to the USI DLL..................................................................................................................7
2.2. Unregister the application from the USI.DLL......................................................................................................... 8
2.5. Get error code ................................................................................................................................................................ 8
2.6. Returns the system error code.................................................................................................................................. 8
2.7. Get scan data.................................................................................................................................................................. 9
2.8. Get length of scanned data....................................................................................................................................... 10
2.9. Get Symbology name................................................................................................................................................. 10
2.10. Clear scan data system buffer.............................................................................................................................11
2.11. Good read indicator................................................................................................................................................ 11
2.12. Wait for acknowledgement of the last sent command .................................................................................. 11
2.13. Save setting to profiles.......................................................................................................................................... 11
2.14. Save scanner setting into specified file.............................................................................................................12
2.15. Change scanner setting from specified setting profile................................................................................. 12
2.16. Automatically enable scanner beam with pressing trigger key.................................................................. 12
2.17. Stop auto scanning function................................................................................................................................13
2.18. Check if auto scanning is enable........................................................................................................................ 13
2.19. Check if Scan2Key.exe program is running or not......................................................................................... 13
2.20. Test if Scan2Key is enabled..................................................................................................................................13
4.5. Get DLL version no..................................................................................................................................................... 22
4.6. Reset all symbologies to default............................................................................................................................. 22
5. SCANKEY3.DLL – BACKWARD COMPATIBLE API FOR PT930/PT930S’S
5.3. Get DLL version no..................................................................................................................................................... 23
5.6. Reset all symbologies to default............................................................................................................................. 23
6.1. Keypad Related Functions........................................................................................................................................24
6.1.1. Disable/enable power button ............................................................................................................................... 24
6.1.2. Get CAPS lock status............................................................................................................................................... 24
6.1.3. Get SHIFT status......................................................................................................................................................24
6.2. Scanner Related Functions.......................................................................................................................................25
6.2.3. Get Trigger keys Status........................................................................................................................................ 25
6.2.4. Get Scanner Status............................................................................................................................................... 25
6.2.5. Check Trigger key is pressing ............................................................................................................................. 26
- 3
6.3. LED related function...................................................................................................................................................26
6.4. LCD/Backlight related function................................................................................................................................27
Get Screen Backlight Status................................................................................................................................27
8. USEFUL FUNCTION CALL - WITHOUT INCLUDE SYSIOAPI.DLL................................29
8.1. Warm-boot, Cold-boot and power off..................................................................................................................... 29
8.2. GET DEVICE ID............................................................................................................. 29
The major difference between the PA500 and a standard HPC/PalmPC is barcode input
capability. The WinCE Reference Manual contains no information regarding barcode input.
This section will introduce the programming structure of the barcode sub-system and the
programming utility library for the PA500. Inside the PA500 there is an advanced decoding
chip to control SE900 laser engine and to handle barcode decoding. Below is system
diagram for the PA500 barcode:
SE950
Laser
Engine
Decoder
Chip
COM2Advanced
CPU
According to the above diagram, the PA500 communicates with Decoder Chip by mean of
serial port COM2. Its communication parameter is fixed on 38400,N,8.1. Normally, the
Decoder Chip is in sleep mode when COM2 is not activated. When COM2 is activated, the
Decoder Chip will start working, and it will decode the barcode “signal” from the laser engine
when the trigger key is pressed. After decoding, barcode data and its symbology type will
be sent directly to PA500.
Many programmers find it difficult to control the Decoder Chip via programming language
alone, especially if they are not familiar with barcode and serial port controls. Because of
this, Unitech provides the following utility library and program for the user or application
programmer to control the Decoder Chip:
1. Application program “Scan2Key.exe” is a useful application program that can read
input data from the laser scanner and then directly input the data into PA500’s
keyboard buffer. “Scan2Key.exe” makes barcode data input simple, and can be
especially valuable to those programmers not familiar with COM port programming.
User program simply reads the barcode data from the keyboard. For barcode
symbologies setting, you can run Scanner Setting from Control Panel to define all of
supporting symbologies and delimiter.
2. Utility library:
For programming control, PA500 provides USI.DLL to let user control scanner input,
symbologies setting and profile controlling. Please refer to 2 for detail API lists.
USI.DLL is Unitech’s new scanner function library on PA500. For backward compatible
issue, Unitech still provide Scanner3.DLL and ScanKey3.DLL for existing
PT930/PT930SA user to port their software into PA500, but several APIs on
Scanner3.DLL and ScanKey3.DLL have already been removed on PA500. User can
refer to 0and 5 for detail supporting API.
- 5
1.2 COM definition for PA500
COM 1 Reserve
COM2 Scanner (Hamster)
COM 3 IrDAComm
COM 4 Bluetooth Modem
COM 5 RawIR
COM 6 BTModem UART
- 6
2. USI.DLL – Unitech Scanner Interface DLL
Note : For PA500 programming, it need to dynamically load DLL for using Unitech built-in DLL (Unitech
will not provide *.H and *.LIB for compiler for mobile 5.0 OS), please refer to Chapter 7 for
programming guide.
2.1. Register the application to the USI DLL
Function Description: Register the application to the USI DLL, so that the DLL can communicate with
the application. It will also open and initial scanner port (COM2, for example) and set the scanner to
the working mode. The application should call USI_Unregister to unregister from the DLL after done
with the scanner.
Function call:
BOOLUSI_Register(HWNDhwnd, UINTmsgID);
Parameter: (input)
hwnd: Handle of the window to which USI DLL will send messages to report all
activities, including error messages, scan data ready, etc.
msgID: Specifies the message to be posted. DLL will post messages by calling:
PostMessage(hwnd, msgID, msg, param).
The window procedure will receive custom message about msgID and wParam parameter
can be one of the followings:
SM_ERROR_SYS:Indicates a system error, which is caused by a call to the system
function. Param contains the error code from GetLastEror().
SM_ERROR Indicates an error. Param contains the cause of error, which can
be on of followings:
SERR_INVALID_HWND: Invalid window handle.
SERR_INVALID_MSGID: msgID cannot be 0.
SERR_OPEN_SCANNER: Open or initial scanner port failed.
SERR_CHECKSUM: Checksum error in received
packet.
SERR_DATALOST: New scan data is lost because data buffer is
not empty.
SERR_BUFFEROVERFLOW:Data buffer overflow. The default size is 4K bytes.
SM_REPLY Indicates received a reply. All the responses from the scanner
except the scan data will be notified by this message.
SM_DATAREADYIndicates that scan data is successfully decoded and ready to
retrieve.
SM_ACKIndicates received a ACK.
SM_NAKIndicates received a NAK.
SM_NOREADIndicates received a No-Read packet.
Note: Scanner port settings are defined in registry as described below:
[HKEY_LOCAL_MACHINE\SOFTWARE\Unitech America Inc.\Scanner\Settings]
Function Description: Set the scanner to the working mode, and reset the communication control.
Function call: BOOLUSI_Reset();
Return: Always TRUE
2.5. Get error code
Function Description: Returns the error code (SERR_***).
Function call: DWORDUSI_GetError();
Return: Returns the error code (SERR_***), which has been described in
USI_Register function.
2.6. Returns the system error code
Function Description: Returns the system error code, which is returned by GetLastError. It will also
return the description of the error in buffer if it is not NULL.
Function call: DWORDUSI_GetLastSysError(LPTSTRbuffer, intlen);
Return: Returns the system error code, which is returned by system function
GetLastError. It will also return the description of the error in buffer retrieved by
system function FormatMessage if it is not NULL.
For a complete list of error codes, refer to the SDK header file WINERROR.H.
- 8
2.7. Get scan data
Function Description:
Function call:
Parameter: (input)
len : UINT : Len specifies the maximum length of the buffer.
Parameter: (output)
buffer : LPBYTE : Data buffer for storing scanned data type : UINT : barcode type which is defined on
Retrieves the scan data into the buffer. Returns the length of characters. It also returns the
barcode type if type is not NULL. Return 0 means that the buffer is too short to hold the
data.
USI_GetData should be called when SM_DATAREADY message is received. Or call
USI_ResetData to discard the data. Both of them will reset the data buffer so that next
scan data can come in.
If the data buffer is not empty and a new scan data occurs, it will be discarded and an
error message SM_ERROR with code of SERR_DATALOST will be sent.
USI.H. Please refer to below list
BCT_CODE_39 // Code 39
BCT_CODABAR // CodaBar
BCT_CODE_128 // Code 128
BCT_INTERLEAVED_2OF5 // Interleaves 2 of 5
BCT_CODE_93 // Code 93
BCT_UPC_A // UPC A
BCT_UPC_A_2SUPPS // UPC A with 2
Supps
BCT_UPC_A_5SUPPS // UPC A with 5
Supps
BCT_UPC_E0 // UPC E
BCT_UPC_E0_2SUPPS // UPC E with 2 Supps
BCT_UPC_E0_5SUPPS // UPC E with 5 Supps
BCT_EAN_8 // EAN 8
BCT_EAN_8_2SUPPS // EAN 8 with 2