We are using the C# to call the Reader API and C# codes about setting the Prefilter are extracted as below:
Symbol.RFID3.TagData[] tagData = new Symbol.RFID3.TagData[10000];
tagData = null;
String filter_initial = "48415345";
if (request.RfidReader.IsConnected)
{
try
{
request.RfidReader.Actions.PreFilters.DeleteAll();
request.RfidReader.Events.AttachTagDataWithReadEvent = false;
PreFilters.PreFilter filter = new PreFilters.PreFilter();
int filterMaskLength = (filter_initial.Length / 2);
byte[] filterMask = new byte[filterMaskLength];
for (int index = 0; index < filterMaskLength; index++)
{
filterMask[index] = byte.Parse(filter_initial.Substring(index * 2, 2),
System.Globalization.NumberStyles.HexNumber);
}
filter.TagPattern = filterMask;
filter.TagPatternBitCount = (uint)filterMaskLength * 8;
filter.AntennaID = 0; //Set filter to all antenna
filter.BitOffset = 32;
filter.FilterAction = FILTER_ACTION.FILTER_ACTION_DEFAULT;
filter.StateUnawareAction.Action = STATE_UNAWARE_ACTION.STATE_UNAWARE_ACTION_UNSELECT;
request.RfidReader.Actions.PreFilters.Add(filter);
m_TagTable = new Hashtable();
request.RfidReader.Actions.PurgeTags();
request.RfidReader.Actions.Inventory.Perform(null, null, null);
Thread.Sleep(1000);
request.RfidReader.Actions.Inventory.Stop();
tagData = request.RfidReader.Actions.GetReadTags(1000);
}
catch (OperationFailureException operationException)
{
request.FixedReader.ExceptionCode = operationException.Result.ToString();
}
catch (Exception ex)
{
request.FixedReader.ExceptionCode = ex.HResult.ToString();
request.FixedReader.ExceptionMsg = ex.Message;
}
}
else
{
request.FixedReader.ExceptionCode = "NO_CONNECT_READER";
request.FixedReader.ExceptionMsg = "Reader is not connected";
}
The above codes can be run successfully without error but it results the reader does not filter out the tags with ID which is not started with "48415345".
1 Replies
It seems the prefilter does not work. Anyone encountered the same probleam and care to share the resolution?