Unitech PA500 Scanner Interface and USI DLL Programming Guide

Page 7

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

Image 7
Contents PA500 Programming Manual USI.DLL Unitech Scanner Interface DLL Automatically enable scanner beam with pressing trigger keySCANKEY3.DLL Backward Compatible API for PT930/PT930S’S GET Device ID Update Notes Introduction How to download data from scanner COM definition for PA500 Parameter input Function callReturns the system error code Enable / Disable ScannerReset Scanner Get error codeFunction Description Get scan dataParameter output Get length of scanned data Get Symbology nameClear scan data system buffer Good read indicatorWait for acknowledgement of the last sent command Save setting to profilesParameter output Return Save scanner setting into specified fileChange scanner setting from specified setting profile Automatically enable scanner beam with pressing trigger keyCheck if Scan2Key.exe program is running or not Check if auto scanning is enableTest if Scan2Key is enabled Stop auto scanning functionEsc, 0x80+cmd Function call Enable/Disable Scan2KeySend scanner command to decoding chip Only send single command decoding chipEsc, parameter1, parameter2, …, BCC Send command to decoding chipControl command for decoder chip Special Command for controlEnable in Communication Code32set TRACK1,5 TRACK2,6 TRACK3Upceset CodabarsetLabelcode UpcasetUPC a Return code Disable DecoderPTEnableBarcode Function call Check barcode inputRead barcode data Reset all symbologies to defaultGet DLL version no Function call for VC INT PTVersionvoid Return Integer Disable laser trigger keyEnable laser trigger key PTEnableBarToKeyReturn code True Shift lock False Shift unlock SysIOAPI.DLLKeypad Related Functions Return code Bool True Caps lock False Caps unlockParameterInput Scanner Related FunctionsExample LED related functionParametersInput LCD/Backlight related functionDynamic Load DLL Get Device ID Update notes
Related manuals
Manual 84 pages 14.34 Kb