コード例 #1
0
 private void UpdateListView(TagCallbackInfo item)
 {
     if (this.InvokeRequired)
     {
         this.BeginInvoke(new UpdateListViewDeleg(UpdateListView), new object[] { item });
         return;
     }
     lock (MyLock)
     {
         for (int index = 0; index < m_sortListView.Items.Count; index++)
         {
             try
             {
                 if (m_sortListView.Items[index].SubItems[4].Text == item.epc.ToString().Substring(0, (int)item.pc.EPCLength * 4) && (CS203_CALLBACK_API_DEMO.ControlPanelForm.ControlPanel.checkBox_GroupTags.Checked ? true : uint.Parse(m_sortListView.Items[index].SubItems[9].Text) == item.antennaPort))
                 {
                     m_sortListView.Items[index].SubItems[7].Text = item.rssi.ToString();
                     m_sortListView.Items[index].SubItems[8].Text = item.count.ToString();
                     m_sortListView.Items[index].SubItems[9].Text = item.antennaPort.ToString();
                     m_sortListView.Items[index].Tag       = Environment.TickCount;
                     m_sortListView.Items[index].ForeColor = Color.Green;
                     break;
                 }
             }
             catch (Exception ex)
             {
             }
         }
     }
 }
コード例 #2
0
 public void UpdateItem(TagCallbackInfo info, int index)
 {
     m_items[index] = info;
     if (Change != null)
     {
         Change.Invoke();
     }
 }
コード例 #3
0
        private void UpdateRecords(object data)
        {
            TagCallbackInfo record = (TagCallbackInfo)data;

            if (record != null)
            {
                m_tagTable.AddItem(record);
            }
        }
コード例 #4
0
 private void AddItem(TagCallbackInfo info)
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new AddItemDeleg(AddItem), new object[] { info });
         return;
     }
     m_tagTable.AddItem(info);
 }
コード例 #5
0
        private void UpdateRecords(object data)
        {
            TagCallbackInfo record = (TagCallbackInfo)data;

            if (record != null)
            {
                m_epclistItems.Insert(record);
            }
        }
コード例 #6
0
        void ReaderXP_TagInventoryEvent(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
        {
            /*if (!e.info.crcInvalid)
             * {
             *  int thisTick = Environment.TickCount;
             *  if ((thisTick - lastRingTick) > 250)
             *  {
             *      lastRingTick = thisTick;
             *      System.Media.SystemSounds.Beep.Play();
             *  }
             * }*/
            this.BeginInvoke((System.Threading.ThreadStart) delegate()
            {
                // Do your work here
                // UI refresh and data processing on other Thread
                // Notes :  blocking here will cause problem
                //          Please use asyn call or separate thread to refresh UI
                if (!e.info.crcInvalid)
                {
                    if ((!Program.appSetting.EnableRssiFilter) ||
                        (Program.appSetting.EnableRssiFilter && Program.appSetting.RssiFilterThreshold < e.info.rssi))
                    {
                        Interlocked.Increment(ref totaltagsthiscycle);
                        Interlocked.Increment(ref totaltags);
                        TagCallbackInfo data = e.info;
                        UpdateInvUI(data);
                    }
#if nouse
                    if (Program.appSetting.EnableRssiFilter)
                    {
                        if (Program.appSetting.RssiFilterThreshold < e.info.rssi)
                        {
                            Interlocked.Increment(ref totaltags);
                            TagCallbackInfo data = e.info;
                            UpdateInvUI(data);
                        }
                    }
                    else
                    {
                        Interlocked.Increment(ref totaltags);
                        TagCallbackInfo data = e.info;
                        UpdateInvUI(data);
                    }
#endif
                }
                else
                {
                    totalcrc++;
                }
#if nouse
                if (Program.tagLogger != null)
                {
                    Program.tagLogger.Log(CSLibrary.Diagnostics.LogLevel.Info, String.Format("CRC[{0}]:PC[{1}]:EPC[{2}]", e.info.crcInvalid, e.info.pc, e.info.epc));
                }
#endif
            });
        }
コード例 #7
0
 public void AddItem(TagCallbackInfo info)
 {
     lock (myLock)
     {
         m_items.Add(info);
     }
     if (Change != null)
     {
         Change.Invoke();
     }
 }
コード例 #8
0
        private void UpdateRecords(object data)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new UpdateRecordsDel(UpdateRecords), new object[] { data });
                return;
            }
            TagCallbackInfo record = (TagCallbackInfo)data;

            if (record != null)
            {
                m_tagTable.AddItem(record);
                lb_tagCount.Text = m_tagTable.Items.Count.ToString();
            }
        }
コード例 #9
0
 public void Insert(TagCallbackInfo newElement)
 {
     lock (myLock)
     {
         TagCallbackInfo info = myLocalList.Find(delegate(TagCallbackInfo found) { return(found.epc.CompareTo(newElement.epc) == 0); });
         if (info != null)
         {
             myLocalList[info.index].rssi = newElement.rssi;
         }
         else
         {
             //Finally do the insert by delegating to "InsertAt"
             newElement.index = myLocalList.Count;
             myLocalList.Add(newElement);
         }
     }
 }
コード例 #10
0
        private void UpdateInvUI(TagCallbackInfo InventoryInformation)
        {
            if (InventoryInformation.crcInvalid == true)
            {
                return;
            }

            int foundIndex = lock_InvItems.FindIndex(delegate(CSLibrary.Structures.TagCallbackInfo iepc) { return(iepc.epc.ToString() == InventoryInformation.epc.ToString()); });
            {
                if (foundIndex >= 0)
                {
                    //found a record
                    lock_InvItems[foundIndex].count++;
                    lock_InvItems[foundIndex].rssi        = InventoryInformation.rssi;
                    lock_InvItems[foundIndex].index       = foundIndex;
                    lock_InvItems[foundIndex].antennaPort = InventoryInformation.antennaPort;
                    //UI update in separate thread
                    UpdateListView(lock_InvItems[foundIndex]);
                }
                else
                {
                    //record no exist
                    //add a record to item list
                    InventoryInformation.index = lock_InvItems.Count;
                    lock_InvItems.Add(InventoryInformation);

                    //UI update in separate thread
                    LVAddItem(
                        InventoryInformation.index.ToString(),
                        InventoryInformation.pc.ToString(),
                        InventoryInformation.epc.ToString(),
                        InventoryInformation.pcpublic.ToString(),
                        InventoryInformation.epcpublic.ToString(),
                        InventoryInformation.rssi.ToString(),
                        InventoryInformation.count.ToString(),
                        InventoryInformation.antennaPort.ToString());
                    if (SaveSQL)
                    {
                        sqlMethod.AddData(InventoryInformation.epc.ToString());
                    }
                }
            }
        }
コード例 #11
0
 private void UpdateListView(TagCallbackInfo item)
 {
     if (this.InvokeRequired)
     {
         this.BeginInvoke(new UpdateListViewDeleg(UpdateListView), new object[] { item });
         return;
     }
     lock (MyLock)
     {
         for (int index = 0; index < m_sortListView.Items.Count; index++)
         {
             if (m_sortListView.Items[index].SubItems[4].Text == item.epc.ToString().Substring(0, (int)item.pc.EPCLength * 4))
             {
                 m_sortListView.Items[index].SubItems[7].Text = item.rssi.ToString();
                 m_sortListView.Items[index].SubItems[8].Text = item.count.ToString();
                 m_sortListView.Items[index].SubItems[9].Text = item.antennaPort.ToString();
                 m_sortListView.Items[index].Tag       = Environment.TickCount;
                 m_sortListView.Items[index].ForeColor = Color.Green;
                 break;
             }
         }
     }
 }
コード例 #12
0
        void CS9010Info(TagCallbackInfo info)
        {
            string EPC;
            string LowBatAlarm;
            bool   find = false;

            EPC = info.epc.ToString().Substring(0, (int)(info.pc.EPCLength * 4));

            if ((info.epc.ToUshorts()[info.pc.EPCLength + 2] & 0x02) != 00)
            {
                LowBatAlarm = "Fail";
            }
            else
            {
                LowBatAlarm = "OK";
            }

            for (int cnt = 0; cnt < listView1.Items.Count; cnt++)
            {
                if (listView1.Items[cnt].SubItems[0].Text == EPC)
                {
                    find = true;
                    listView1.Items[cnt].SubItems[3].Text = LowBatAlarm;
                    break;
                }
            }

            if (find == false)
            {
                ListViewItem ins = new ListViewItem(EPC);
                ins.SubItems.Add("");
                ins.SubItems.Add("");
                ins.SubItems.Add(LowBatAlarm);

                listView1.Items.Add(ins);
            }
        }
コード例 #13
0
 private int CompareFunction(TagCallbackInfo element1, TagCallbackInfo element2)
 {
     return(element2.epc.CompareTo(element1.epc));
 }
コード例 #14
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="info">Tag Information</param>
 /// <param name="type">Callback Type</param>
 public OnAsyncCallbackEventArgs(TagCallbackInfo info, CallbackType type)
 {
     this.info = info;
     this.type = type;
 }
コード例 #15
0
        private void UpdateInvUI(TagCallbackInfo InventoryInformation)
        {
            if (InventoryInformation.crcInvalid == true)
            {
                return;
            }

            int foundIndex = lock_InvItems.FindIndex(delegate(CSLibrary.Structures.TagCallbackInfo iepc) { return(iepc.epc.ToString() == InventoryInformation.epc.ToString()); });
            {
                if (foundIndex >= 0)
                {
                    //found a record
                    lock_InvItems[foundIndex].count++;
                    lock_InvItems[foundIndex].rssi        = InventoryInformation.rssi;
                    lock_InvItems[foundIndex].index       = foundIndex;
                    lock_InvItems[foundIndex].antennaPort = InventoryInformation.antennaPort;
                    //UI update in separate thread
                    UpdateListView(lock_InvItems[foundIndex]);
                }
                else
                {
                    //record no exist
                    //add a record to item list
                    InventoryInformation.index = lock_InvItems.Count;
                    lock_InvItems.Add(InventoryInformation);
                    string TagDataStr = InventoryInformation.epc.ToString();
                    string EPCONLY;
                    string TIDONLY  = "";
                    string USERONLY = "";

                    if (TagDataStr.Length > InventoryInformation.pc.EPCLength * 4)
                    {
                        EPCONLY = TagDataStr.Substring(0, (int)InventoryInformation.pc.EPCLength * 4);

                        if (CS203_CALLBACK_API_DEMO.ControlPanelForm.ControlPanel.checkBoxReadTID.Checked)
                        {
                            TIDONLY = TagDataStr.Substring(EPCONLY.ToString().Length, System.Convert.ToInt16(CS203_CALLBACK_API_DEMO.ControlPanelForm.ControlPanel.textBoxTIDcount.Text) * 4);
                        }

                        if (CS203_CALLBACK_API_DEMO.ControlPanelForm.ControlPanel.checkBoxReadUser.Checked)
                        {
                            USERONLY = TagDataStr.Substring(EPCONLY.ToString().Length + TIDONLY.Length, System.Convert.ToInt16(CS203_CALLBACK_API_DEMO.ControlPanelForm.ControlPanel.textBoxUsercount.Text) * 4);
                        }
                    }
                    else
                    {
                        EPCONLY = TagDataStr;
                    }

                    //UI update in separate thread
                    LVAddItem(
                        InventoryInformation.index.ToString(),
                        InventoryInformation.pc.ToString(),
                        InventoryInformation.xpc_w1.ToString(),
                        InventoryInformation.xpc_w2.ToString(),
                        EPCONLY,
                        TIDONLY,
                        USERONLY,
                        InventoryInformation.rssi.ToString(),
                        InventoryInformation.count.ToString(),
                        InventoryInformation.antennaPort.ToString());
                    if (SaveSQL)
                    {
                        sqlMethod.AddData(InventoryInformation.epc.ToString());
                    }
                }
            }
        }
 private void AddItem(TagCallbackInfo info)
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new AddItemDeleg(AddItem), new object[] { info });
         return;
     }
     m_tagTable.AddItem(info);
 }
コード例 #17
0
ファイル: FormCS9010.cs プロジェクト: tony2124/traza
        void EM4325Info(TagCallbackInfo info)
        {
            string EPC;
            string LowBatAlarm;
            bool find = false;
            UInt16 SensorDataMsw, SensorDataLsw;
            UInt16 UtcMsw, UtcLsw;
            UInt16 StartTimeMsw, StartTimeLsw;
            string Temperature;
            string TempAlarm;

            EPC = info.epc.ToString().Substring(0, (int)((info.pc.EPCLength - 1) * 4));

            SensorDataMsw = info.epc.ToUshorts()[info.pc.EPCLength + 1];
            SensorDataLsw = info.epc.ToUshorts()[info.pc.EPCLength + 2];
            UtcMsw = info.epc.ToUshorts()[info.pc.EPCLength + 3];
            UtcLsw = info.epc.ToUshorts()[info.pc.EPCLength + 4];
            StartTimeMsw = info.epc.ToUshorts()[info.pc.EPCLength + 6];
            StartTimeLsw = info.epc.ToUshorts()[info.pc.EPCLength + 7];

            if ((SensorDataMsw & 0x0400) != 0)
            {
                double Temp;
                Temp = (SensorDataMsw & 0x00ff);
                if ((SensorDataMsw & 0x0100) != 00)
                    Temp -= 256;
                Temp *= 0.25;
                Temperature = Temp.ToString();
            }
            else
                Temperature = "NA";

            if ((SensorDataMsw & 0x3000) != 00)
                TempAlarm = "Fail";
            else
                TempAlarm = "OK";

            if ((SensorDataMsw & 0x8000) != 00)
                LowBatAlarm = "Fail";
            else
                LowBatAlarm = "OK";

            for (int cnt = 0; cnt < listView1.Items.Count; cnt++)
            {
                if (listView1.Items[cnt].SubItems[0].Text == EPC)
                {
                    find = true;
                    listView1.Items[cnt].SubItems[1].Text = Temperature;
                    listView1.Items[cnt].SubItems[2].Text = TempAlarm;
                    listView1.Items[cnt].SubItems[3].Text = LowBatAlarm;
                    listView1.Items[cnt].SubItems[4].Text = SensorDataMsw.ToString();
                    listView1.Items[cnt].SubItems[5].Text = SensorDataLsw.ToString();
                    listView1.Items[cnt].SubItems[6].Text = UtcMsw.ToString();
                    listView1.Items[cnt].SubItems[7].Text = UtcLsw.ToString();
                    listView1.Items[cnt].SubItems[8].Text = StartTimeMsw.ToString();
                    listView1.Items[cnt].SubItems[9].Text = StartTimeLsw.ToString();
                    break;
                }
            }

            if (find == false)
            {
                ListViewItem ins = new ListViewItem(EPC);
                ins.SubItems.Add(Temperature);
                ins.SubItems.Add(TempAlarm);
                ins.SubItems.Add(LowBatAlarm);
                ins.SubItems.Add(SensorDataMsw.ToString ());
                ins.SubItems.Add(SensorDataLsw.ToString());
                ins.SubItems.Add(UtcMsw.ToString());
                ins.SubItems.Add(UtcLsw.ToString());
                ins.SubItems.Add(StartTimeMsw.ToString());
                ins.SubItems.Add(StartTimeLsw.ToString());
                listView1.Items.Add(ins);
            }
        }
コード例 #18
0
ファイル: FormCS9010.cs プロジェクト: tony2124/traza
        void EM4324Info(TagCallbackInfo info)
        {
            string EPC;
            string LowBatAlarm;
            bool find = false;

            EPC = info.epc.ToString().Substring(0, (int)(info.pc.EPCLength * 4));

            if ((info.epc.ToUshorts()[info.pc.EPCLength + 2] & 0x02) != 00)
                LowBatAlarm = "Fail";
            else
                LowBatAlarm = "OK";

            for (int cnt = 0; cnt < listView1.Items.Count; cnt++)
            {
                if (listView1.Items[cnt].SubItems[0].Text == EPC)
                {
                    find = true;
                    listView1.Items[cnt].SubItems[3].Text = LowBatAlarm;
                    break;
                }
            }

            if (find == false)
            {
                ListViewItem ins = new ListViewItem(EPC);
                ins.SubItems.Add("");
                ins.SubItems.Add("");
                ins.SubItems.Add(LowBatAlarm);

                listView1.Items.Add(ins);
            }
        }
 private void AddItem(TagCallbackInfo info)
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new AddItemDeleg(AddItem), new object[] { info });
         return;
     }
     m_tagTable.AddItem(info);
     //Device.BuzzerOn(2000, 40, BuzzerVolume.HIGH);
 }