2.1. Register the application to the USI DLL..................................................................................................................8
2.2. Unregister the application from the USI.DLL......................................................................................................... 9
2.5. Get error code ................................................................................................................................................................ 9
2.6. Returns the system error code.................................................................................................................................. 9
2.7. Get scan data................................................................................................................................................................ 10
2.8. Get length of scanned data....................................................................................................................................... 11
2.9. Get Symbology name................................................................................................................................................. 11
2.10. Clear scan data system buffer.............................................................................................................................12
2.11. Good read indicator................................................................................................................................................ 12
2.12. Wait for acknowledgement of the last sent command .................................................................................. 12
2.13. Save setting to profiles.......................................................................................................................................... 12
2.14. Save scanner setting into specified file.............................................................................................................13
2.15. Change scanner setting from specified setting profile................................................................................. 13
2.16. Automatically enable scanner beam with pressing trigger key.................................................................. 13
2.17. Stop auto scanning function................................................................................................................................14
2.18. Check if auto scanning is enable........................................................................................................................ 14
2.19. Check if Scan2Key.exe program is running or not......................................................................................... 14
2.20. Test if Scan2Key is enabled..................................................................................................................................14
4.5. Get DLL version no........................................................................................................................................................23
4.6. Reset all symbologies to default .................................................................................................................................... 23
5. SCANKEY3.DLL – BACKWARD COMPATIBLE API FOR PT930/PT930S’S
5.3. Get DLL version no........................................................................................................................................................24
5.6. Reset all symbologies to default .................................................................................................................................... 24
6.8. Disable toolbar on windows explorer ........................................................................................................................... 26
6.9. Enable toolbar on windows explorer............................................................................................................................ 26
7.1. Keypad Related Functions............................................................................................................................................. 28
7.1.1. Get CAPS lock status (This function call is reserved for OS using, it is not suggested to be used on application if
you are not fully understand OS operation behavior).............................................................................................................. 28
7.1.2. Get SHIFT status (This function call is reserved for OS using, it is not suggested to be used on application if you
are not fully understand OS operation behavior) .................................................................................................................... 28
7.1.3. Get keypad type (This function call is reserved for OS using, it is not suggested to be used on application if you
are not fully understand OS operation behavior) .................................................................................................................... 28
7.1.4.Disable/enable power button....................................................................................................................................29
7.1.7.Check Alpha key is pressing (For PA962/PA966/PA982 only)...............................................................................29
7.2. Scanner Related Functions............................................................................................................................................ 30
7.2.6.Check Trigger key is pressing..................................................................................................................................32
7.3. LED related function...................................................................................................................................................32
7.4. Backlight related function.........................................................................................................................................32
7.5.2.Enable/Disable PCMCIA or CF slot....................................................................................................................34
7.5.6.Disable PCMCIA/CF slot when resume...................................................................................................................35
8. BLUETOOTH RELATIVE API - BTAPI.DLL.....................................................................37
8.1. Enable/Disable Bluetooth Power status................................................................................................................. 37
8.2. Get BT Power status................................................................................................................................................. 37
9.1. Get library version ..................................................................................................................................................... 38
9.2. Connect to RFID reade............................................................................................................................................. 38
9.3. Select Card type ........................................................................................................................................................ 38
9.4. Get Reader Information............................................................................................................................................38
9.6. Close Reader ............................................................................................................................................................. 39
9.7. Set ISO-15693 Inventory Parameter ...................................................................................................................... 39
9.9. Get Data From Reader ............................................................................................................................................. 40
10.1. Class “MPRReader”................................................................................................................................................ 42
10.2. The Parameter in MPRReader............................................................................................................................ 42
10.3. The Parameter in MPRReader............................................................................................................................ 43
10.3.1. Connect to RFID Reader.................................................................................................................................. 43
10.3.2. Disconnect with RFID Reader ......................................................................................................................... 43
10.3.3. Clear All Tags In The Reader .......................................................................................................................... 43
10.3.4. The Event in MPRReader................................................................................................................................. 43
11. USEFUL FUNCTION CALL – WITHOUT INCLUDE SYSIOAPI.DLL...............................44
11.1.1. Warm-boot. Cold-boot and power off.............................................................................................................. 44
12. GET DEVICE ID................................................................................................................ 45
13. GET OEM INFO................................................................................................................ 45
The major difference between the HT660/PA96x/PA982 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 subsystem and the programming utility library for the HT660/PA96x/PA982. Inside the
HT660/PA96x/PA982 there is an advanced decoding chip to control SE900 laser engine and
to handle barcode decoding. Below is system diagram for the HT660/PA96x/PA982
barcode:
Laser
Engine
Decoder
Chip
COM2Advanced
CPU
According to the above diagram, the HT660/PA96x/PA982 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 HT660/PA96x/PA982.
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
HT660/PA96x/PA982’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, HT660/PA96x/PA982 provide 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 HT660/PA96x/PA982. For
backward compatible issue, Unitech still provide Scanner3.DLL and ScanKey3.DLL for
existing PT930/PT930SA user to port their software into HT660/PA96x/PA982, but
several APIs on Scanner3.DLL and ScanKey3.DLL have already been removed on
HT660/PA96x/PA982. User can refer to 0and 5 for detail supporting API.
- 6
1.2. COM definition for HT660/PA96x/PA982/RH767
COM 1 Physical full RS232 port (ActiveSync)
COM 2 Scanner (Hamster) or RFID reader
COM 3 IrComm
COM 4 USB client
COM 5 IrDA or Bluetooth
COM 6 Reserve
COM 7 Bluetooth Printer
COM 8 Bluetooth Modem
COM 9 Bluetooth ActiveSync
1.3. Useful Sample program
You can get useful sample program for VC, C# and VB.NET from below URL
HT660 series
C# http://w3.tw.ute.com/pub/cs/software/Sample_Program/HT660/c_sharp/c_sharp_sample.zip
Vb.net http://w3.tw.ute.com/pub/CS/software/Sample_Program/HT660/VB.NET/VB.NET_sample.zip
C++ http://w3.tw.ute.com/pub/CS/software/Sample_Program/HT660/evc/evc_sample.zip
PA96x/PA982 series
C# http://w3.tw.ute.com/pub/cs/software/Sample_Program/PA962/c_sharp/c_sharp_sample.zip
Vb.net http://w3.tw.ute.com/pub/CS/software/Sample_Program/PA962/VB.NET/VB.NET_sample.zip
C++ http://w3.tw.ute.com/pub/CS/software/Sample_Program/PA962/evc/evc_sample.zip
1.4. Get SDK from Unitech?
You can get SDK from below URL
HT660 SDK http://w3.tw.ute.com/pub/cs/sdk/ht660/HT660SDK.zip
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
SERR_DATALOST: New scan data is lost because data buffer is
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.
- 9
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
type : UINT : barcode type. (refer to 0 for type definition
buffer : LPBYTE : Please refer to below table
Type Buffer
BCT_CODE_39 Code 39
BCT_CODABAR Codabar
BCT_CODE_128 Code 128
BCT_INTERLEAVED_2OF5 Interleaved 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_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 or Telpen
BCT_CODE_32 Code 32 (Pharmacy Code)
BCT_DELTA_CODE Delta Code
BCT_LABEL_CODE Label Code IV & V
BCT_PLESSEY_CODEPlessey Code
BCT_TOSHIBA_CODE Toshiba Code (China Postal Code)
len : UINT : length of string on the 2
Return: TRUE : if it found name for the barcode type, FALSE : if not (type may be wrong
nd
parameter buffer
-
2.10. Clear scan data system buffer
Function Description:
Reset the data buffer so that next new scan data can come in.
Function call:
voidUSI_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:
voidUSI_ReadOK();
Note:
USI will call the function GoodReadLEDOn function exported by the DLL defined in the registry
described below (UPI300.DLL is an example) to turn on and off the LED. If the DLL is not defined or
the function is not found, USI will bypass the call of GoodReadLEDOn.
[HKEY_LOCAL_MACHINE\SOFTWARE\Unitech America Inc.\Scanner\Settings]
"DLLLEDCONTROL"="UPI300.DLL"
The function prototype of GoodReadLEDOn is:
VOID WINAPI GoodReadLEDOn(BOOL fon);
Turn on when fon is TRUE, and turn off when fon is FALSE.
2.12. Wait for acknowledgement of the last sent command
Function Description:
Wait for acknowledgement of the last sent command until timeout. It is useful when a
serial of commands needs to be sent at a time. Before call USI_SendCommand, call
USI_WaitForSendEchoTO to make sure that the previous command is done.
Function call:
BOOLUSI_WaitForSendEchoTO(DWORDtimeout);
Parameter: (input)
timeout: DWORD : Specifies the timeout in millisecond.
Return:
Returns FALSE if timeout.
2.13. Save setting to profiles
Function Description:
Save current settings of scanner so that the settings will be persistent when the unit get
power off and on again.
Function call:
BOOLUSI_SaveCurrentSettings();
Return : TRUE if success,
otherwise FALSE.
-
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:
BOOLUSI_SaveSettingsToFile(LPCTSTRfilename)
Parameter: (input)
filename : LPCTSTR: file name for setting profile
Return: TRUE = success
FALSE = error
2.15. Change scanner setting from specified setting profile
filename: LPCTSTR : name of scanner setting profile (*.USI)
formulaOnly: BOOL: if TRUE, only data editing formulas are
load. The other settings remain unchanged
Return: TRUE = success
FALSE = error
2.16. Automatically enable scanner beam with pressing trigger key
Function Description:
Start auto scanning. Scan engine will be automatically triggerrd on.
Function call:
BOOLUSI_StartAutoScan(DWORDinterval);
Parameter: (input)
interval : DWORD: Specifies the interval in milli-second
Parameter: (output)
Return:
Note: USI will call the function SetScannerOn function exported by the DLL defined in the registry
described below (UPI300.DLL is an example) to start and stop the scanner. If the DLL is not defined
or the function is not found, then auto scanning is not available.
[HKEY_LOCAL_MACHINE\SOFTWARE\Unitech America Inc.\Scanner\Settings]
"DLLSCANNERCONTROL"="UPI300.DLL"
The function prototype of SetScannerOn is:
VOID WINAPI SetScannerOn(BOOL fon);
Start when fon is TRUE, and stop when fon is FALSE.
-
2.17. Stop auto scanning function
Function Description:
Stop auto scanning
Function call:
voidUSI_StopAutoScan();
2.18. Check if auto scanning is enable
Function Description:
Check if auto scanning function is enabled or not
Function call: BOOLUSI_IsAutoScanning()
Return: 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. (It doesn’t mean
Scan2Key is routing scanner input to keyboard, please call S2K_IsEnabled() to check if
routing function is enable or not)
Function call:
HWNDS2K_IsLoaded();
Return: NULL : Scan2Key is not running
Non-NULL : indicates scan2key is running. It actually returns
window handle for scan2key, but it is for internal use – send messages.
2.20. Test if Scan2Key is enabled
Function Description:
Test whether Scan2Key is enabled. Scan2Key routes scanning input from scanner to
keypad buffer, so that barcode data can be input as like from keystrokes on keypad.
Function call:
BOOLS2K_IsEnabled();
Return: TRUE = enabled.
FALSE = disable
2.21. Load/Unload Scan2Key.exe
Function Description:
Load or unload Scan2Key
Function call:
BOOLS2K_Load(BOOLload, DWORDtimeout);
Parameter: (input)
load: BOOL: TRUE = load Scan2Key
FALSE = unload Scan2Key
timeout: DWORD: when unload Scan2Key, it will wait until
Scan2Key has been removed from memory or timeout
specified by this parameter.