The text of a manual · part 10 of 11
HT Series/PA Series/RH Series Programming Manual, pages 87 to 96
Pages 87 to 96 of 98
The original document is the PDF (1.2 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Unitech HT660 and Unitech HT680
Page 87
9.7.11 RFID_KILL Description: The structure of Kill a tag. Define: typedef struct RFID_KILL_TAG { HWND hWnd; //Parent window RFIDPROC lpfnStartProc; RFIDPROC lpfnStopProc; INT32U accessPassword; INT32U killPassword; }RFID_KILL; Fields: hWnd –The Parent window which issue the Tag operation. lpfnStartProc – Application-defined callback function. The RFID Reader Interface call this function before execute Tag operation. lpfnStopProc – Application-defined callback function. The RFID Reader Interface call this function after finished Tag operation. accessPassword – The access password for the tags. A valueof zero indicates no access password. killPassword – The kill password for the tags. Must not be zero.
9.7.12 RFID_KILL_EX Description: Tag Kill extension function's parameter. Define: typedef struct RFID_KILL_EX_TAG { HWND hWnd; //Parent window RFIDPROC lpfnStartProc; RFIDPROC lpfnStopProc; BYTE accessPassword[8]; //password is 8 bytes' hex char(0~f) BYTE killPassword[8]; //password is 8 bytes' hex char(0~f) }RFID_KILL_EX; Fields: hWnd - the same as RFID_ KILL. lpfnStartProc – the same as RFID_KILL. lpfnStopProc – the same as RFID_KILL. accessPassword[8] – The access passowrd for the tags. It’s 8 bytes' hex char(0~f). killPassword[8] – The kill passowrd for the tags. It’s 8bytes' hex char(0~f).
87 -
Page 88
9.7.13 RFID_LOCK Description: The structure of Tag locks function. Define: typedef struct RFID_LOCK_TAG { HWND hWnd; //Parent window RFIDPROC lpfnStartProc; RFIDPROC lpfnStopProc; INT32U accessPassword; INT32U killPasswordPermissions; INT32U accessPasswordPermissions; INT32U epcBankPermissions; INT32U tidBankPermissions; INT32U userBankPermissions; }RFID_LOCK; Fields: hWnd –The Parent window which issue the Tag operation. lpfnStartProc – Application-defined callback function. The RFID Reader Interface call this function before execute Tag operation. lpfnStopProc – Application-defined callback function. The RFID Reader Interface call this function after finished Tag operation. accessPassword - Access password for the tags(zero indicates no access password). killPasswordPermissions - The access permissions for the tag's kill password. accessPasswordPermissions - The access permissions for the tag's access password. epcBankPermissions - The access permissions for the tag's EPC memory bank. tidBankPermissions - The access permissions for the tag's TID memory bank. userBankPermissions - The access permissions for the tag's USER memory bank. Name
The access permissions can be set as below: Value Description
Allow
0
Password permission: Can be read and write. Bank permission: The memory bank is writeable.
Always Allow
1
Password permission: Can be read and write. Bank permission: The memory bank is writeable. This permission is set permanently.
Password protected
2
Password permission: Need password to read and write. Bank permission: Need password to write to the memory bank.
Always Deny
3
Password permission: Can not be read and write. When the kill password permission is set to be this value, the tag can not be killed. Bank permission: The memory bank can not be written. This permission is set permanently.
No Change 4 The permission should remain unchanged. Access permissions' values' Table
88 -
Page 89
9.7.14 RFID_LOCK_EX Description: Tag Lock extension function's parameter. Define: typedef struct RFID_LOCK_EX_TAG { HWND hWnd; //Parent window RFIDPROC lpfnStartProc; RFIDPROC lpfnStopProc; BYTE accessPassword[8]; INT32U killPasswordPermissions; INT32U accessPasswordPermissions; INT32U epcBankPermissions; INT32U tidBankPermissions; INT32U userBankPermissions; }RFID_LOCK_EX; Fields: hWnd –The same as RFID_LOCK. lpfnStartProc –The same as RFID_LOCK. lpfnStopProc –The same as RFID_LOCK.. accessPassword[8] - The access passowrd for the tags. It’s 8 bytes' hex char(0~f). killPasswordPermissions - The same as RFID_LOCK. accessPasswordPermissions - The same as RFID_LOCK. epcBankPermissions - The same as RFID_LOCK. tidBankPermissions - The same as RFID_LOCK. userBankPermissions - The same as RFID_LOCK.
9.7.15 RFID_SELECT_CRITERIA Description: The structure of pre-singulation matches criteria. Define: typedef struct RFID_SELECT_CRITERIA_TAG { RFID_18K6C_MEMORY_BANK bank; INT32U offset; INT32U count; INT8U mask[RFID_18K6C_SELECT_MASKBYTE_LEN]; RFID_18K6C_TARGET target; RFID_18K6C_ACTION action; BOOL32 enableTruncate; }RFID_SELECT_CRITERIA Fields: bank - The memory bank to match against offset - The offset of the first bit to match count - The number of bits in the mask mask[RFID_18K6C_SELECT_MASK_BYTE_LEN] - The bit pattern to match. target - What will be affected by the action(S0~S4,SL) action - The action which will be performed upon the tag populations (i.e, matching and nonmatching) during the selection. enableTruncate – Should the EPC be truncated when the tag is singulated? Non-zero value indicate that the EPC is truncated. If enableTruncate is true: bank must be EPC; Target must be RFID_18K6C_TARGET_SELECTED_FLAG
89 -
Page 90
9.7.16 RFID_POST_SINGULATION Description: The structure of post-singulation matches criteria. Define: typedef struct RFID_POST_SINGULATION_TAG { INT32U offset; INT32U count; INT8U mask[RFID_18K6C_SINGULATION_MASK_BYTE_LEN]; BOOL32 match; }RFID_POST_SINGULATION; Fields: offset – offset in bits, from the start of the EPC. count –The number of bits in the mask.Alength of zero causes all EPC to match. If (offset + count) falls beyond the end of the mask, the tag is considered non-matching.(valid values are 0 to 396). mask[RFID_18K6C_SINGULATION_MASK_BYTE_LEN] – the bit pattern to match.(hex chars). match – Determines if the associated tag operation will be applied to tags that match the maskor not.
90 -
Page 91
9.8 Error Code There are two types of error codes. One is returned by RFID Library interface indicates RFID library status and the other is return by the RFID module’s firmware contains access operation result. RFID Library status and error codes: Name
Value
RFID_STATUS_OK
0
Success
RFID_ERROR_ALREADY_OPEN
-9999
Attempted to open a radio that is already open
RFID_ERROR_BUFFER_TOO_SMALL
-9998
Buffer supplied is too small
RFID_ERROR_FAILURE
-9997
General failure
RFID_ERROR_DRIVER_LOAD
-9996
Failed to load radio bus driver
RFID_ERROR_DRIVER_MISMATCH
-9995
Library cannot use version of radio bus driver present on system
RFID_ERROR_EMULATION_MODE
-9994
Operation cannot be performed while library is in emulation mode
RFID_ERROR_INVALID_ANTENNA
-9993
Antenna number is invalid
RFID_ERROR_INVALID_HANDLE
-9992
Radio handle provided is invalid
RFID_ERROR_INVALID_PARAMETER
-9991
One of the parameters to the function is invalid
RFID_ERROR_NO_SUCH_RADIO
-9990
Attempted to open a non-existent radio
RFID_ERROR_NOT_INITIALIZED
-9989
Library has not been successfully initialized
RFID_ERROR_NOT_SUPPORTED
-9988
Function not supported
RFID_ERROR_OPERATION_CANCELL -9987 ED
Operation was cancelled by call to cancel operation, close radio, or shut down the library
RFID_ERROR_OUT_OF_MEMORY
-9986
Library encountered an error allocating memory
RFID_ERROR_RADIO_BUSY
-9985
The operation cannot be performed because the radio is currently busy
RFID_ERROR_RADIO_FAILURE
-9984
The underlying radio module encountered an error
RFID_ERROR_RADIO_NOT_PRESENT -9983
The radio has been detached from the system
RFID_ERROR_CURRENTLY_NOT_ALL -9982 OWED
The RFID library function is not allowed at this time
RFID_ERROR_RADIO_NOT_RESPON DING
-9981
The radio module's MAC firmware is not responding to requests
RFID_ERROR_NONVOLATILE_INIT_F AILED
-9980
The MAC firmware encountered an error while initiating the nonvolatile memory update. The MAC firmware will return to its normal idle state without resetting the radio module
RFID_ERROR_NONVOLATILE_OUT_O -9979 F_BOUNDS
An attempt was made to write data to an address that is not in the valid range of radio module nonvolatile memory addresses.
RFID_ERROR_NONVOLATILE_WRITE -9978 _FAILED
The MAC firmware encountered an error while trying to write to the radio module's nonvolatile memory region.
RFID_ERROR_RECEIVE_OVERFLOW
The underlying transport layer detected that there was an overflow error resulting in one or more bytes of the incoming data being dropped. The operation was aborted and all data in the pipeline was flushed.
-9977
91 -
Page 92
Access Operation Result: Value
Description
0x00
Success
0x01
Read after write verify failed.
0x02 problem transmitting tag command
0x03
CRC error on tag response to a write
0x04
CRC error on the read packet when verifying the write
0x05
Maximum retry's on the write exceeded
0x06
Failed waiting for read data from tag, possible timeout.
0x07
Failure requesting a new tag handle.
0x0A error waiting for tag response, possible timeout
0x0B
CRC error on tag response to a kill
0x0C
Problem transmitting 2nd half of tag kill.
0x0D tag responded with an invalid handle on first kill command
0xFA tag has insufficient power to perform the memory write
0xFB specified memory location is locked and/or permalocked
0xFC specified memory location does not exist
0xFD
Tag failed to response within timeout
0xFE
CRC was invalid
0xFF general error
92 -
Page 93
9.9 Support Dot Net Compact Framework R1000ReaderCF.dll is a C# wrap of Native C/C++ DLL of RFID18k6cReader.dll. It provides APIs for Dot Net Compact Framework programmer to control the RFID Reader.
9.9.1 Class “R1000Reader” This is main class instantiated by applications. It provides properties and methods for accessing the RFID Reader. The methods in R1000ReaderCF have the same name as their Native implementation.
9.9.2 Programming Model The first is add reference of R1000ReaderCF.dll to your project. C# example: using Unitech.R1000.Reader; using Unitech.R1000.Reader.Constants; using Unitech.R1000.Reader.Structures; //Create and Initialize the RFID Library String strVersion = String.Empty; R1000Reader.RFIDCreate(ref strVersion); //Open the RFID Reader R1000Reader.RFIDOpen(0); //Inventory & retrieve the tag's epc RFID_INVENTORY stInventory = new RFID_INVENTORY(); ACCESS_STATUS stAccessStatus = new ACCESS_STATUS(); //operation in blocking mode R1000Reader.RFIDInventory(stInventory, ref stAccessStatus, true, 3000); if (stAccessStatus .dwStatus == 0 && stAccessStatus.dwErrorCode == 0) { for (int i = 0; i < stAccessStatus.unAntennas; i++) { ANTENNA_STATUS stAntennaStatus = new ANTENNA_STATUS(); R1000Reader.RFIDGetAntennaStatus(i, ref stAntennaStatus); for (int j = 0; j < stAntennaStatus.unCount; j++) { ACCESS_DATA accessData = new ACCESS_DATA(); UInt32 nRet = R1000Reader.RFIDGetAccessData(i, j, ref accessData); if (nRet == 1 && accessData.unEPCLength > 0) { //Get EPC from accessData.pnEPC; } } } } //Close the RFID Reader R1000Reader.RFIDClose(0); //Destroy RFID Library R1000Reader.RFIDDestroy(); 93 -
Page 94
10 Useful function call – without include SysIOAPI.DLL Below API maybe useful for you to control HT6xx/PA96x
10.1.1 Warm-boot. Cold-boot and power off #include #include
<pkfuncs.h> "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 ); }
11 Get Device ID In unitech device, an unique ID had been burnt into terminal, user can check it by pressing “Func”+”9”. The sample code for read device ID as follow, //////////////////////////////////////////////////////////////// TCHAR outBuf[512], szBuff[200]; DWORD bytesReturned; TCHAR deviceID[64]; BYTE cProductID[255]; PDEVICE_ID pDeviceID = NULL; pDeviceID = (PDEVICE_ID)outBuf; pDeviceID->dwSize = sizeof(outBuf); if (KernelIoControl(IOCTL_HAL_GET_DEVICEID, NULL, 0, outBuf, sizeof(outBuf), &bytesReturned)) { memset(szBuff, 0, sizeof(szBuff)); // Device ID for WinCE version memcpy((PBYTE)szBuff, (PBYTE)pDeviceID + pDeviceID->dwPresetIDOffset, pDeviceID->dwPresetIDBytes); swprintf(deviceID, _T("%s"), szBuff);
// Device ID for Mobile version memset(cProductID, 0, sizeof(cProductID)); memcpy((PBYTE) cProductID, (PBYTE)pDeviceID + pDeviceID->dwPresetIDOffset, pDeviceID->dwPresetIDBytes); MultiByteToWideChar(CP_ACP, 0, (char*)cProductID, strlen((char*)cProductID), szBuff, sizeof(szBuff)); wcsncpy(deviceID, szBuff, 16); } /////////////////////////////////////////////////////////
94 -
Page 95
12 Get OEM Info In HT6xx/PA96x, an OEM ID had been burnt into terminal, user can check it by pressing “Func”+”9”. The sample code for read OEM ID as follow, //////////////////////////////////////////////////////////////// { TCHAR szBuff[500]; ZeroMemory(szBuff, sizeof(szBuff)); SystemParametersInfo(SPI_GETOEMINFO, 500, (LPVOID)szBuff, 0); MessageBox(szBuff); } /////////////////////////////////////////////////////////
13 Get firmware and bootloader version info //////////////////////////////////////////////////////////////// { DEVICE_CONFIG cfg; if (KernelIoControl(IOCTL_GET_DEVICE_CONFIG, NULL, 0, &cfg, sizeof(cfg), NULL)) { //Get OS Version mbstowcs(stringBuffer, cfg.swVersion, strlen(cfg.swVersion)); swprintf(szProductID, _T("OS version : %s"), stringBuffer); Show(szProductID); //Get Bootloader Version memset (stringBuffer, 0, sizeof(stringBuffer)); mbstowcs(stringBuffer, cfg.bootloadversion, strlen(cfg.bootloadversion)); wsprintf(szProductID, _T("Bootloader version : %s"), stringBuffer); Show(szProductID); } } /////////////////////////////////////////////////////////
95 -
Page 96
14 Camera SDK Please get SDK from below URL. http://w3.tw.ute.com/pub/cs/SDK/Camera/CameraSDK.zip Note: This SDK only for PA550 and PA690.
15 Fingerprint related functions Please get sample program and manual from below URL. http://w3.tw.ute.com/pub/cs/software/Sample_Program/PA968/Fingerprint.zip Note: Only for PA968
16 GPS related functions Please get sample program and manual from below URL(Only for WinCE Version). http://w3.tw.ute.com/pub/cs/software/Sample_Program/GPS/GPSSDK.zip 17 USI .NET Compact Framework Component Please get sample program and manual from below URL. http://w3.tw.ute.com/pub/cs/SDK/USI/USICF.zip
96 -