PA500 Programming Manual V 1.
-2 1. INTRODUCTION................................................................................................................. 5 1.1 How to download data from scanner ....................................................................................................................... 5 1.2 COM definition for PA500............................................................................................................................................ 6 2. USI.
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....................
6.4.2. 6.4.3. 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. 9. -4 Get Screen Backlight Status ..........................................................................
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.
1.
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.
"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.
2.7. Get scan data Function Description: 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.
UINT : Data length 2.8. Get length of scanned data Function Description: Returns the data length of the scan data. When allocate the memory to hold the scan data, add at least one additional byte for string terminator. Function call: UINT USI_GetDataLength(); Return: UNIT : data length 2.9. Get Symbology name Function Description: Returns the barcode name of the type.
2.10. Clear scan data system buffer Function Description: Reset the data buffer so that next new scan data can come in. Function call: void USI_ResetData(); 2.11. Good read indicator Function Description: Inform a good receiving of scan data, this will play a sound (wave file scanok.wav) and light the LED lasting for 1 second. Function call: void USI_ReadOK(); Note: USI will call the function GoodReadLEDOn function exported by the DLL defined in the registry described below (UPI300.
2.14. Save scanner setting into specified file Function Description: Save the current settings to file. The file takes “*.USI” as extension name. Function call: BOOL USI_SaveSettingsToFile(LPCTSTR filename) Parameter: (input) filename : Return: LPCTSTR: file name for setting profile TRUE = success FALSE = error 2.15. Change scanner setting from specified setting profile Function Description: Load and activate the settings from file.
2.17. Stop auto scanning function Function Description: Stop auto scanning Function call: void USI_StopAutoScan(); 2.18. Check if auto scanning is enable Function Description: Check if auto scanning function is enabled or not Function call: Return: BOOL USI_IsAutoScanning() BOOL: TRUE : auto-scanning is running FALSE : auto-scanning is disabled. 2.19. Check if Scan2Key.exe program is running or not Function Description: Test whether Scan2Key application is running at background.
2.22. Enable/Disable Scan2Key Function Description: Enable or disable Scan2Key to put scanned data to standard keyboard input buffer. Scan2Key is enabled by default.
2.25. Send command to decoding chip Function Description: Send command to decoder chip. This is a variation of command HAM_SendCommand. It will read a number of parameters and packet them as in following format and send it to decoder chip. Esc, parameter1, parameter2, …, BCC The total number of parameters is specified by first parameter num.
3. Control command for decoder chip Important: This chapter describes low level command for scanner control function. If you already USI to do scanner programming, you don’t need to care about this chapter. In general, it is not suggested to use level command to control scanner, because there are timing issue on serial communication programming , and it is always need communication expert to do that and it is hard to explain it on document.
Beep block_delay char_delay Function_code Esc,0,4,3,m,S1,BCC Esc,0,4,4,m,S1,BCC Esc,0,4,5,m,S1,BCC Esc,0,4,6,m,S1,BCC Capslock Esc,0,4,7,m,S1,BCC 2_is standby mode.
Mterminator Esc,0,4,31,m,S1,BCC Here S1 is 0_ENTER,1 NONE No meaning for you Sentinal Esc,0,4,32,m,S1,BCC S1 is 0 not send,1 send No meaning for you Track_selection Esc,0,4,33,m,S1,BCC No meaning for you T2_account_only Esc,0,4,34,m,S1,BCC Separator Esc,0,4,35,m,S1,BCC Here S1 is =0_ALL TRACKS,1 TRACK1 AND TRACK2,2 TRACK1 AND TRACK3,3 TRACK2 AND TRACK3,4 TRACK1,5 TRACK2,6 TRACK3 S1 is 0_NO,1 YES No meaning for you S1 is 1 CHARACTER No meaning for you Must_have_data Track1_sequence Track2_seq
Msi_pleasey Esc,0,4,5b,m,S1,BCC Msi_p_enable Esc,0,4,5c,m,S1,BCC Msi_pleasey_cd Esc,0,4,5d,m,S1,BCC Esc,0,4,5e,m,S1,BCC Msi_p_cdmode Msi_pleasey_min Msi_pleasey_max Code93 Code93_min Code93_max Code11 Code11_enable Code11_cdnumber Code11_cdsend Code11_min Code11_max Codabar_set Codabar_enable Codabar_ss Codabar_cd Codabar_CLSI Codabar_min Codabar_max Label_code Label_c_enable Label_code_cd Upc_a_set Upc_a_enable Upc_a_ld Upc_a_cd Upc_e_set Upc_e_enable Upc_e_ld Upc_e_cd Upc_e_expand Upc_e_nsc
Supplement_five,S1.b2 is for Supplement_mh, S1.b3 is for Supplement_ssi. Supplement_two EAN128Brace Remove AimingTime Esc,0,4,92,m,S1,BCC S1 is 0_off,1 on S1 is 0_off,1 on S1 is 0_transmit if present,1 must present S1 is 0 Space been inserted, 1_Space not been inserted S1 is S1.b0 is for Delta_c_enable,S1.b1 is for Delta_code_cdc,S1.b2 is for Delta_code_cds S1 is 0_disable,1 enable S1 is 0_check digit calculate,1 not calculate S1 is =0 check digit send,1_not send Get firmware version.
4. Scanner3.DLL – Backward compatible API for PT930/PT930S’s Scanner3.dll Note : For PA500, it need to dynamically load DLL for using Unitech built-in DLL (Unitech will not provide *.H and *.LIB for compiler), please refer to Chapter 7 for programming guide. 4.1. Enable Decoder Function Description: This function will open COM2 port, create a thread to get any barcode input from Decoder Chip, and then store input data in the system buffer.
4.4. Read barcode data Function Description: Get input barcode data and its type from system buffer.
5. ScanKey3.DLL – Backward compatible API for PT930/PT930S’s ScanKey3.dll Note : For PA500, it need to dynamically load DLL for using Unitech built-in DLL (Unitech will not provide “USI.H” and “USI.LIB” for compiler), please refer to Chapter 7 for programming guide. 5.1. Enable Decoder Function Description: This function will open COM2 port, create a thread to get any barcode input from Decoder Chip, and then send scanner data to keyboard buffer.
6. SysIOAPI.DLL This DLL provide hardware relative API for user to control scanner, LED, back-light and PC card slot. API functions are provided through DLL to assist programmer to write application for PA500. 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), please refer to Chapter 7 for programming guide. 6.1. Keypad Related Functions 6.1.1.
6.2. Scanner Related Functions To save power, the decoder IC is disabled when scanner is not in use. It can be enabled through USI functions. Following functions are meaningful only if decode IC is enabled. 6.2.1. Enable/Disable Scanner trigger key Function Description: This function enables/disables trigger keys. Function call: void EnableScannerTrigger(BOOL fOn) Parameter (Input) fON: BOOL: TRUE = enable trigger keys. FALSE = disable trigger keys. Return code: 6.2.2.
6.2.5. Check Trigger key is pressing Function Description: This function is used to check if left or right trigger key is pressed or not. Function call: BOOL TriggerKeyStatus( int key); Parameter(Input) key: int: LEFT_TRIGGER_KEY RIGHT_TRIGGER_KEY : left trigger key : right trigger key. Return code: TRUE = trigger is pressed. FALSE = trigger is released.
6.4. LCD/Backlight related function There are two backlight controls, screen backlight and keypad backlight. They are controlled separately. For screen backlight, you can adjust brightness of backlight also. 6.4.1. Screen Backlight Control Function Description: This function turns screen backlight on or off. Function call: void BacklightOn(BOOL fON) Parameter(Input) fON: BOOL: TRUE = turn on screen backlight. FALSE= turn off backlight. Return code: 6.4.2.
7. Dynamic Load DLL Compiler would not load the DLL while use dynamic load DLL, it help user to load the DLL if it exists while the application executed. The follow is the example. Note: Even user does not need include the header and lib file but need to know the function definition.
8. Useful function call - without include SysIOAPI.DLL 8.1. Warm-boot, Cold-boot and power off #include #include "oemioctl.h" // Warn boot KernelIoControl(IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL); // Cold boot KernelIoControl(IOCTL_COLD_BOOT, NULL, 0, NULL, 0, NULL); // Power off { DWORD dwExtraInfo=0; BYTE bScan=0; keybd_event( VK_OFF, bScan, KEYEVENTF_SILENT, dwExtraInfo ); keybd_event( VK_OFF, bScan, KEYEVENTF_KEYUP, dwExtraInfo ); } 8.2.
9. Update notes V1.0 V1.1 V1.2 - The first version COM port error correction on section 1.