示例#1
0
 private void AddFilter()
 {
     NurApi.InventoryExFilter filt = new NurApi.InventoryExFilter();
     byte[] mask = NurApi.HexStringToBin(mask_textBox.Text);
     filt.action        = (byte)action_combo.SelectedIndex;
     filt.address       = (uint)address_UpDown.Value;
     filt.bank          = (byte)bank_combo.SelectedIndex;
     filt.maskBitLength = (int)length_UpDown.Value;
     filt.maskData      = new byte[NurApi.MAX_SELMASK];
     Buffer.BlockCopy(mask, 0, filt.maskData, 0, mask.Length);
     filt.target = (byte)target_combo.SelectedIndex;
     filters.Add(filt);
 }
示例#2
0
        private void DoGetTags()
        {
            if (!hNur.IsConnected())
            {
                AddLog("Connection required.");
                return;
            }

            CurrentTag = null;
            AllTags.Clear();
            TagListView.Items.Clear();
            TagLabel.Text = "---";

            try
            {
                ResetToA();

                hNur.ClearTagsEx();



                NurApi.InventoryExParams   invParam;
                NurApi.InventoryExFilter[] invFilters;

                // Disable EPC+DATA mode
                hNur.InventoryReadCtl = false;
                // Configure InventoryExParams for Temperature read
                invParam.inventorySelState = NurApi.SELSTATE_SL;
                invParam.inventoryTarget   = NurApi.INVTARGET_A;
                invParam.Q           = hNur.InventoryQ;
                invParam.rounds      = hNur.InventoryRounds;
                invParam.session     = NurApi.SESSION_S0;
                invParam.transitTime = 0;                 // Disable
                // Configure InventoryExFilter
                invFilters                  = new NurApi.InventoryExFilter[1];
                invFilters[0].action        = NurApi.FACTION_0;
                invFilters[0].address       = 0;
                invFilters[0].bank          = NurApi.BANK_TID;
                invFilters[0].maskData      = new byte[] { 0xE2, 0x80, 0xB0, 0x40 };
                invFilters[0].maskBitLength = (invFilters[0].maskData.Length * 8) - 4;
                invFilters[0].target        = NurApi.SESSION_SL;
                invFilters[0].truncate      = false;
                // Read
                NurApi.InventoryResponse resp = hNur.InventoryEx(ref invParam, invFilters);
                // Fetch tags from the module
                NurApi.TagStorage tagStorage = hNur.FetchTags(true);

                for (int i = 0; i < tagStorage.Count; i++)
                {
                    NurApi.Tag tag = tagStorage[i];
                    AllTags.Add(new EM4325Tag(tag));
                    ListViewItem lvi = new ListViewItem(tag.GetEpcString());
                    lvi.SubItems.Add(tag.rssi.ToString());
                    lvi.SubItems.Add(tag.antennaId.ToString());
                    TagListView.Items.Add(lvi);
                }
                columnHeader_EPC.Width   = -2;
                columnHeader_RSSI.Width  = -2;
                columnHeader_AntID.Width = -2;
            }
            catch (Exception ex)
            {
                AddLog("Inventory error.");
                AddLog("Message: " + ex.Message);
            }
        }