Esempio n. 1
0
        void AddTagToDic(TagReadData tag)
        {
            TagInfo tmptag = null;

            if (rParms.isUniByEmd && (tag.Tag.Protocol == TagProtocol.GEN2))
            {
                if (tag.EMDDataString == string.Empty)
                {
                    return;
                }
            }
            //
            tagmutex.WaitOne();

            string keystr = tag.EPCString;

            if (rParms.isUniByEmd)
            {
                keystr += tag.EMDDataString;
            }

            if (rParms.isUniByAnt)
            {
                keystr += tag.Antenna.ToString();
            }

            if (m_Tags.ContainsKey(keystr))
            {
                tmptag = m_Tags[keystr];
                if (rParms.isOneReadOneTime)
                {
                    tmptag.readcnt += 1;
                }
                else
                {
                    tmptag.readcnt += tag.ReadCount;
                }
                tmptag.antid = tag.Antenna;

                if (!rParms.isUniByEmd)
                {
                    if (tmptag.emddatastr != tag.EMDDataString)
                    {
                        if (tag.EMDDataString != string.Empty)
                        {
                            tmptag.emddatastr = tag.EMDDataString;
                        }
                    }
                }

                tmptag.timestamp = tag.Time;
                ///
            }
            else
            {
                TagInfo newtag = null;
                if (rParms.isOneReadOneTime)
                {
                    newtag = new TagInfo(tag.EPCString, 1, tag.Antenna, tag.Time,
                                         tag.Tag.Protocol, tag.EMDDataString);
                }
                else
                {
                    newtag = new TagInfo(tag.EPCString, tag.ReadCount, tag.Antenna, tag.Time,
                                         tag.Tag.Protocol, tag.EMDDataString);
                }

                m_Tags.Add(keystr, newtag);
            }
            //if (!tagbuf.ContainsKey(tag.EPCString))
            //    tagbuf.Add(tag.EPCString, tag);
            tagmutex.ReleaseMutex();
        }
Esempio n. 2
0
        private void lvTags_ColumnClick(object sender, ColumnClickEventArgs e)
        {
            if (e.Column >= 1 && e.Column <= 4)
            {
                tmplist.Clear();
                foreach (ListViewItem viewitem in lvTags.Items)
                {
                    TagProtocol potl = TagProtocol.NONE;
                    if (viewitem.SubItems[5].Text == "GEN2")
                    {
                        potl = TagProtocol.GEN2;
                    }
                    else if (viewitem.SubItems[5].Text == "ISO180006B")
                    {
                        potl = TagProtocol.ISO180006B;
                    }
                    else if (viewitem.SubItems[5].Text == "IPX256")
                    {
                        potl = TagProtocol.IPX256;
                    }
                    else if (viewitem.SubItems[5].Text == "IPX64")
                    {
                        potl = TagProtocol.IPX64;
                    }

                    TagInfo newtag = new TagInfo(viewitem.SubItems[2].Text, int.Parse(viewitem.SubItems[1].Text),
                                                 int.Parse(viewitem.SubItems[3].Text), DateTime.Now, potl, viewitem.SubItems[4].Text);
                    tmplist.Add(newtag);
                }
                this.lvTags.Items.Clear();
                IComparer <TagInfo> tagcmper = null;
                if (e.Column == 1)
                {
                    tagcmper = new TagInfoCompReadCnt();
                }
                else if (e.Column == 2)
                {
                    tagcmper = new TagInfoCompEPCId();
                }
                else if (e.Column == 3)
                {
                    tagcmper = new TagInfoCompAntId();
                }
                else if (e.Column == 4)
                {
                    tagcmper = new TagInfoCompEmdData();
                }

                tmplist.Sort(tagcmper);
                foreach (TagInfo tag in tmplist)
                {
                    ListViewItem item = new ListViewItem(lvTags.Items.Count.ToString());
                    item.SubItems.Add(tag.readcnt.ToString());
                    item.SubItems.Add(tag.epcid);
                    item.SubItems.Add(tag.antid.ToString());

                    item.SubItems.Add(tag.emddatastr);

                    if (tag.potl == TagProtocol.GEN2)
                    {
                        item.SubItems.Add("GEN2");
                    }
                    else if (tag.potl == TagProtocol.ISO180006B)
                    {
                        item.SubItems.Add("ISO180006B");
                    }
                    else if (tag.potl == TagProtocol.IPX256)
                    {
                        item.SubItems.Add("IPX256");
                    }
                    else if (tag.potl == TagProtocol.IPX64)
                    {
                        item.SubItems.Add("IPX64");
                    }

                    lvTags.Items.Add(item);
                }
            }
        }