RFID_STATUS WINAPI RFID_AddPreFilter ( RFID_HANDLE32  readerHandle,
UINT16  antennaID,
LPPRE_FILTER  lpPreFilter,
UINT32 *  pFilterIndex 
)

This function provides interface to the select command, which the reader applies to sort a particular tag population.

Parameters:
[in] readerHandle 
Handle to the RFID device.
[in] antennaID 
0 for all Antenna or the specific antennaID.
[in] lpPreFilter 
Pointer to PRE_FILTER.
[out] pFilterIndex 
Pointer to the Index to the pre-filter created if the API succeeds.
Returns:
If the function succeeds the return value is RFID_API_SUCCESS. If the function fails the return value is one of the following:
  • RFID_API_INVALID_HANDLE Handle provided is invalid
  • RFID_API_PARAM_ERROR Invalid parameter given
  • RFID_API_PARAM_OUT_OF_RANGE Parameter is out of Range
  • RFID_FILTER_MAX_FILTERS_EXCEEDED Reached limit for maximum number of filters that can be added
Remarks:
The API returns a valid pFilterIndex if the API is successful. The filters set using this API will be applied for the next Inventory and Access operation. If the filters are not set or if the set filters are removed using RFID_DeletePreFilter, the reader will operate on factory defaults. The filters will not be persistant across application restarts. So the application will have to set the desired filters each time it is launched.
See also:
RFID_PerformInventory, RFID_StopInventory, RFID_DeletePreFilter
Remarks:
Example:
RFID_HANDLE32 readerHandle;
RFID_STATUS rfidStatus = RFID_API_SUCCESS;
PRE_FILTER prefilter;
UINT8 tagPattern[2] = {0x12, 0x11};
UINT32 filterIndex = 0;
ANTENNA_INFO antennaInfo;
TRIGGER_INFO triggerInfo;
LPTAG_DATA pTagData;
HANDLE inventoryDone = CreateEvent(NULL, FALSE, FALSE, NULL);
UINT16 antennaIDList[2] = {1, 3};
antennaInfo.pAntennaList = antennaIDList;
antennaInfo.length = 2;
triggerInfo.startTrigger.type = START_TRIGGER_TYPE_IMMEDIATE;
//we want the inventory to stop when 3 tags are found with in a duration of 2 seconds 
triggerInfo.stopTrigger.type = STOP_TRIGGER_TYPE_TAG_OBSERVATION_WITH_TIMEOUT;
triggerInfo.stopTrigger.value.tagObservation.n = 3; 
triggerInfo.stopTrigger.value.tagObservation.timeoutMilliseconds = 2000;
triggerInfo.tagReportTrigger = 0;
if(RFID_API_SUCCESS == RFID_Connect(&readerHandle, TEXT("157.235.208.20"), 0, 0, 0))
{
pTagData = RFID_AllocateTag(readerHandle);
if(NULL == pTagData)
{
printf("\n Tag Allocation failed");
}
else
{

// Register an Event for Inventory Completion
RFID_RegisterEventNotification(readerHandle, INVENTORY_STOP_EVENT, inventoryDone);

// Set pre-filters
prefilter.filterAction = FILTER_ACTION_STATE_UNAWARE;
prefilter.filterActionParams.stateUnawareAction = STATE_UNAWARE_ACTION_UNSELECT;
prefilter.memoryBank = MEMORY_BANK_EPC;
prefilter.bitOffset = 32; // skip the PC bits
prefilter.tagPatternBitCount = 2 * 8;
prefilter.pTagPattern = tagPattern;
//Set this filter for All Antennas
rfidStatus = RFID_AddPreFilter(readerHandle, 0, &prefilter, &filterIndex);
rfidStatus = RFID_PerformInventory(readerHandle, NULL, &antennaInfo, &triggerInfo, NULL);
if(RFID_API_SUCCESS == rfidStatus)
{
printf("\n\n Inventory with pre-filter:");
WaitForSingleObject(inventoryDone, INFINITE);
// Fetch the tags in case of successful inventory with pre-filters
while(RFID_API_SUCCESS == RFID_GetReadTag(readerHandle, pTagData))
{
printTagData(pTagData->pTagID, pTagData->tagIDLength);
//printTagData: Refer RFID_PerformInventory - Example
}
}
else
{
printf("Error %S", RFID_GetErrorDescription(rfidStatus));
}
rfidStatus = RFID_DeletePreFilter(readerHandle, 0, filterIndex);
}
rfidStatus = RFID_Disconnect(readerHandle);
}
CloseHandle(inventoryDone);      
}


Generated on Fri Mar 4 02:25:30 2016 for RFIDAPI3 1.1 C API Documentation by  doxygen 1.5.6