Ejemplo n.º 1
0
        private void myUpdateRead(Events.ReadEventData eventData)
        {
            Symbol.RFID3.TagData[] tagData = m_ReaderAPI.Actions.GetReadTags(1000);
            if (tagData != null)
            {
                for (int nIndex = 0; nIndex < tagData.Length; nIndex++)
                {
                    if (tagData[nIndex].OpCode == ACCESS_OPERATION_CODE.ACCESS_OPERATION_NONE ||
                        (tagData[nIndex].OpCode == ACCESS_OPERATION_CODE.ACCESS_OPERATION_READ &&
                         tagData[nIndex].OpStatus == ACCESS_OPERATION_STATUS.ACCESS_SUCCESS))
                    {
                        Symbol.RFID3.TagData tag = tagData[nIndex];
                        string tagID             = tag.TagID;
                        bool   isFound           = false;

                        //lock (m_TagTable.SyncRoot)
                        //{
                        //    isFound = m_TagTable.ContainsKey(tagID);
                        //    if (!isFound && this.memBank_CB.SelectedIndex >= 1)
                        //    {
                        //        tagID = tag.TagID + tag.MemoryBank.ToString() + tag.MemoryBankDataOffset.ToString();

                        //        isFound = m_TagTable.ContainsKey(tagID);
                        //    }
                        //}

                        if (isFound)
                        {
                            uint         count = 0;
                            ListViewItem item  = (ListViewItem)m_TagTable[tagID];
                            try
                            {
                                count            = uint.Parse(item.SubItems[3].Text) + tagData[nIndex].TagSeenCount;
                                m_TagTotalCount += tagData[nIndex].TagSeenCount;
                            }
                            catch (FormatException fe)
                            {
                                functionCallStatusLabel.Text = fe.Message;
                                break;
                            }
                            item.SubItems[1].Text = tag.TagID.ToString();
                            item.SubItems[2].Text = System.DateTime.Now.ToString();
                        }
                        else
                        {
                            ListViewItem item = new ListViewItem(tag.TagID);
                            // 1 - tag event
                            ListViewItem.ListViewSubItem subItem;
                            subItem = new ListViewItem.ListViewSubItem(item, System.DateTime.Now.ToString());
                            item.SubItems.Add(subItem);
                            // 2 - antenna ID


                            //if (memBank_CB.SelectedIndex >= 1)
                            //{
                            //    // 7 - Memory bank data
                            //    subItem = new ListViewItem.ListViewSubItem(item, tag.MemoryBankData);
                            //    item.SubItems.Add(subItem);

                            //    string memoryBank = tag.MemoryBank.ToString();
                            //    int index = memoryBank.LastIndexOf('_');
                            //    if (index != -1)
                            //    {
                            //        memoryBank = memoryBank.Substring(index + 1);
                            //    }

                            //    // 8 - Memory Bank
                            //    subItem = new ListViewItem.ListViewSubItem(item, memoryBank);
                            //    item.SubItems.Add(subItem);

                            //    // 9 - memory bank offset
                            //    subItem = new ListViewItem.ListViewSubItem(item, tag.MemoryBankDataOffset.ToString());
                            //    item.SubItems.Add(subItem);
                            //}
                            //else
                            //{
                            //    subItem = new ListViewItem.ListViewSubItem(item, "");
                            //    item.SubItems.Add(subItem);
                            //    subItem = new ListViewItem.ListViewSubItem(item, "");
                            //    item.SubItems.Add(subItem);
                            //    subItem = new ListViewItem.ListViewSubItem(item, "");
                            //    item.SubItems.Add(subItem);
                            //}

                            inventoryList.BeginUpdate();
                            inventoryList.Items.Add(item);
                            inventoryList.EndUpdate();

                            lock (m_TagTable.SyncRoot)
                            {
                                m_TagTable.Add(tagID, item);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void myUpdateRead(Events.ReadEventData eventData)
        {
            int index = 0;

            Symbol.RFID3.TagData[] tagData = m_ReaderAPI.Actions.GetReadTags(1000);
            List <Tags>            list    = (List <Tags>)datagrd.ItemsSource;

            GetTags = new List <Tags>();
            tags    = new Tags();
            if (tagData != null)
            {
                for (int nIndex = 0; nIndex < tagData.Length; nIndex++)
                {
                    if (tagData[nIndex].OpCode == ACCESS_OPERATION_CODE.ACCESS_OPERATION_NONE ||
                        (tagData[nIndex].OpCode == ACCESS_OPERATION_CODE.ACCESS_OPERATION_READ &&
                         tagData[nIndex].OpStatus == ACCESS_OPERATION_STATUS.ACCESS_SUCCESS))
                    {
                        TagData tag     = tagData[nIndex];
                        string  tagID   = tag.TagID;
                        bool    isFound = false;

                        lock (m_TagTable.SyncRoot)
                        {
                            isFound = m_TagTable.ContainsKey(tagID);
                            if (!isFound)
                            {
                                tagID  += ((uint)tag.MemoryBank + tag.MemoryBankDataOffset);
                                isFound = m_TagTable.ContainsKey(tagID);
                            }
                        }

                        if (isFound)
                        {
                            uint count = 0;
                            tags.EPC     = tag.TagID;
                            tags.Antenna = tag.AntennaID.ToString();
                            tags.Count   = count;
                            tags.RSSI    = tag.PeakRSSI.ToString();
                            if (list == null)
                            {
                                list = new List <Tags>();
                            }
                            if (!list.Exists(a => a.EPC == tags.EPC))
                            {
                                GetTags.Add(tags);
                                list.AddRange(GetTags);
                                datagrd.ItemsSource = list;
                            }
                            else
                            {
                                GetTags.Add(tags);
                                list.AddRange(GetTags);
                                datagrd.ItemsSource = list;
                            }
                            tagstxt.Text = datagrd.Items.Count.ToString();
                            datagrd.Items.Refresh();
                        }
                    }
                }
                loglst.Items.Add(m_TagTable.Count + "(" + m_TagTotalCount + ")");
            }
        }
Ejemplo n.º 3
0
        private void myUpdateRead(Events.ReadEventData eventData)
        {
            int          index = 0;
            ListViewItem item;

            Symbol.RFID3.TagData[] tagData = m_ReaderAPI.Actions.GetReadTags(1000);
            if (tagData != null)
            {
                for (int nIndex = 0; nIndex < tagData.Length; nIndex++)
                {
                    if (tagData[nIndex].OpCode == ACCESS_OPERATION_CODE.ACCESS_OPERATION_NONE ||
                        (tagData[nIndex].OpCode == ACCESS_OPERATION_CODE.ACCESS_OPERATION_READ &&
                         tagData[nIndex].OpStatus == ACCESS_OPERATION_STATUS.ACCESS_SUCCESS))
                    {
                        Symbol.RFID3.TagData tag = tagData[nIndex];
                        string tagID             = tag.TagID;
                        bool   isFound           = false;

                        sbLog.AppendLine(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss.fff") + "|" + tag.TagID + "|" + tag.AntennaID + "|" + tag.PeakRSSI);


                        lock (m_TagTable.SyncRoot)
                        {
                            isFound = m_TagTable.ContainsKey(tagID);
                            if (!isFound)
                            {
                                tagID  += ((uint)tag.MemoryBank + tag.MemoryBankDataOffset);
                                isFound = m_TagTable.ContainsKey(tagID);
                            }
                        }

                        if (isFound)
                        {
                            uint count = 0;
                            item = (ListViewItem)m_TagTable[tagID];
                            try
                            {
                                count            = uint.Parse(item.SubItems[2].Text) + tagData[nIndex].TagSeenCount;
                                m_TagTotalCount += tagData[nIndex].TagSeenCount;
                            }
                            catch (FormatException fe)
                            {
                                functionCallStatusLabel.Text = fe.Message;
                                break;
                            }
                            item.SubItems[1].Text = tag.AntennaID.ToString();
                            item.SubItems[2].Text = count.ToString();
                            item.SubItems[3].Text = tag.PeakRSSI.ToString();

                            string memoryBank = tag.MemoryBank.ToString();
                            index = memoryBank.LastIndexOf('_');
                            if (index != -1)
                            {
                                memoryBank = memoryBank.Substring(index + 1);
                            }
                            if (tag.MemoryBankData.Length > 0 && !memoryBank.Equals(item.SubItems[5].Text))
                            {
                                item.SubItems[5].Text = tag.MemoryBankData;
                                item.SubItems[6].Text = memoryBank;
                                item.SubItems[7].Text = tag.MemoryBankDataOffset.ToString();

                                lock (m_TagTable.SyncRoot)
                                {
                                    m_TagTable.Remove(tagID);
                                    m_TagTable.Add(tag.TagID + tag.MemoryBank.ToString()
                                                   + tag.MemoryBankDataOffset.ToString(), item);
                                }
                            }
                        }
                        else
                        {
                            item = new ListViewItem(tag.TagID);
                            ListViewItem.ListViewSubItem subItem;

                            subItem = new ListViewItem.ListViewSubItem(item, tag.AntennaID.ToString());
                            item.SubItems.Add(subItem);

                            subItem          = new ListViewItem.ListViewSubItem(item, tag.TagSeenCount.ToString());
                            m_TagTotalCount += tag.TagSeenCount;
                            item.SubItems.Add(subItem);

                            subItem = new ListViewItem.ListViewSubItem(item, tag.PeakRSSI.ToString());
                            item.SubItems.Add(subItem);
                            subItem = new ListViewItem.ListViewSubItem(item, tag.PC.ToString("X"));
                            item.SubItems.Add(subItem);

                            subItem = new ListViewItem.ListViewSubItem(item, "");
                            item.SubItems.Add(subItem);
                            subItem = new ListViewItem.ListViewSubItem(item, "");
                            item.SubItems.Add(subItem);
                            subItem = new ListViewItem.ListViewSubItem(item, "");
                            item.SubItems.Add(subItem);

                            inventoryList.BeginUpdate();
                            inventoryList.Items.Add(item);
                            inventoryList.EndUpdate();

                            lock (m_TagTable.SyncRoot)
                            {
                                m_TagTable.Add(tagID, item);
                            }
                        }
                    }
                }
                totalTagValueLabel.Text = m_TagTable.Count + "(" + m_TagTotalCount + ")";
            }
        }
Ejemplo n.º 4
0
 private static DataTable dt = null;//进行排序
 private void myReadNotify(Events.ReadEventData eventData)
 {
     //SampleTagAnalysis();
     RSSI_ANT_TagAnalysis();
 }