Unitech PA500 User Manual

PA500
Programming Manual
V 1.2 1/15/2008
1. INTRODUCTION.................................................................................................................5
1.1 How to download data from scanner ....................................................................................................................... 5
1.2 COM definition for PA500............................................................................................................................................6
2. USI.DLL – UNITECH SCANNER INTERFACE DLL...........................................................7
2.1. Register the application to the USI DLL..................................................................................................................7
2.2. Unregister the application from the USI.DLL......................................................................................................... 8
2.3. Enable / Disable Scanner............................................................................................................................................. 8
2.4. Reset Scanner................................................................................................................................................................ 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
- 2
2.21. Load/Unload Scan2Key.exe..................................................................................................................................13
2.22. Enable/Disable Scan2Key ..................................................................................................................................... 14
2.23. Send scanner command to decoding chip....................................................................................................... 14
2.24. Only send single command decoding chip...................................................................................................... 14
2.25. Send command to decoding chip ....................................................................................................................... 15
3. CONTROL COMMAND FOR DECODER CHIP................................................................ 16
4. SCANNER3.DLL – BACKWARD COMPATIBLE API FOR PT930/PT930S’S
SCANNER3.DLL........................................................................................................................21
4.1. Enable Decoder............................................................................................................................................................ 21
4.2. Disable Decoder........................................................................................................................................................... 21
4.3. Check barcode input .................................................................................................................................................. 21
4.4. Read barcode data...................................................................................................................................................... 22
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
SCANKEY3.DLL........................................................................................................................23
5.1. Enable Decoder............................................................................................................................................................ 23
5.2. Disable Decoder........................................................................................................................................................... 23
5.3. Get DLL version no..................................................................................................................................................... 23
5.4. Disable laser trigger key............................................................................................................................................23
5.5. Enable laser trigger key............................................................................................................................................. 23
5.6. Reset all symbologies to default............................................................................................................................. 23
6. SYSIOAPI.DLL .................................................................................................................24
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.1. Enable/Disable Scanner trigger key ................................................................................................................... 25
6.2.2. Turn on/off Scan Engine....................................................................................................................................... 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
6.4.1. Screen Backlight Control...................................................................................................................................... 27
6.4.2.
Get Screen Backlight Status................................................................................................................................27
6.4.3. Screen Backlight Brightness Control.................................................................................................................. 27
7. DYNAMIC LOAD DLL.......................................................................................................28
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
9. UPDATE NOTES .............................................................................................................. 30
- 4
1. Introduction
1.1 How to download data from scanner
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:
BOOL USI_Register(HWND hwnd, UINT msgID);
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_DATAREADY Indicates that scan data is successfully decoded and ready to
retrieve.
SM_ACK Indicates received a ACK. SM_NAK Indicates received a NAK. SM_NOREAD Indicates 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]
"COMPORT"="COM2:" "BAUDRATE"="38400" "STOPBITS"="1" "PARITY"="None"
- 7
"CHECKPARITY"="1"
2.2. Unregister the application from the USI.DLL
Function Description: Unregister the application from the DLL. It will close the scanner port, and by
default it will disable the scanner.
Function call: void USI_Unregister(); Return code: None
2.3. Enable / Disable Scanner
Function Description: To start or stop USI function. This function is useful for application to temporarily
stop scanner function if it is only need keypad input or keep clear input buffer.
Function call: BOOL USI_EnableScan(BOOL bStatus); Parameter: (input)
bStatus: TRUE : Enable Scanner FALSE : Disable Scanner
Return code: BOOL : TRUE : OK FALSE : Failure
2.4. Reset Scanner
Function Description: Set the scanner to the working mode, and reset the communication control. Function call: BOOL USI_Reset(); Return: Always TRUE
2.5. Get error code
Function Description: Returns the error code (SERR_***). Function call: DWORD USI_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: DWORD USI_GetLastSysError(LPTSTR buffer, int len); 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.
UINT USI_GetData(LPBYTE buffer, UINT len, UINT* type);
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
Supps BCT_EAN_8_5SUPPS // EAN 8 with 5
Supps BCT_EAN_13 // EAN 13 BCT_EAN_13_2SUPPS // EAN 13 with 2 Supps BCT_EAN_13_5SUPPS // EAN 13 with 5 Supps BCT_MSI_PLESSEY // MSI Plessey BCT_EAN_128 // EAN 128 BCT_UPC_E1 // UPC
E1 BCT_UPC_E1_2SUPPS // UPC E1 with 2 Supps BCT_UPC_E1_5SUPPS // UPC E1 with 5 Supps BCT_TRIOPTIC_CODE_39 // TRIOPTIC CODE 39 BCT_BOOKLAND_EAN // Bookland EAN BCT_COUPON_CODE // Coupon Code BCT_STANDARD_2OF5 // Standard 2 of 5 BCT_CODE_11_TELPEN // Code 11 Telpen BCT_CODE_32 // Code 32 BCT_DELTA_CODE // Delta Code BCT_LABEL_CODE // Label Code IV
& V BCT_PLESSEY_CODE // Plessey Code BCT_TOSHIBA_CODE // Toshiba Code
China Postal Code
- 9
Loading...
+ 21 hidden pages