void ReaderXP_TagSearchOneEvent(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
        {
            this.Invoke((System.Threading.ThreadStart) delegate()
            {
                switch (e.type)
                {
                case CallbackType.TAG_SEARCHING:
                    rssi = (int)((TagCallbackInfo)e.info).rssi;

                    UpdateRssiLb(rssi.ToString());
                    //lb_rssi.Text = rssi.ToString();

                    UpdateProgressValue(rssi);

                    //Tone
                    EnToneTmr(true);

                    if (rssi < 0)
                    {
                        UpdateRssiLb(String.Empty);
                    }
                    else
                    {
                        RestartOORDetectTmr();
                    }
                    break;
                }
            });
        }
Ejemplo n.º 2
0
        void ReaderXP_TagRangingEvent(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
        {
            this.Invoke((System.Threading.ThreadStart) delegate()
            {
                //Using asyn delegate to update UI
                if (e.type == CallbackType.TAG_RANGING)
                {
                    if (Program.appSetting.EnableRssiFilter)
                    {
                        if (Program.appSetting.RssiFilterThreshold < e.info.rssi)
                        {
                            m_totaltag++;

                            UpdateRecords(e.info);

                            if (Program.appSetting.Cfg_blocking_mode)
                            {
                                Application.DoEvents();
                            }
                        }
                    }
                    else
                    {
                        m_totaltag++;

                        UpdateRecords(e.info);

                        if (Program.appSetting.Cfg_blocking_mode)
                        {
                            Application.DoEvents();
                        }
                    }
                }
            });
        }
        void TagInventoryEvent(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
        {
            if (e.type != CSLibrary.Constants.CallbackType.TAG_RANGING)
            {
                return;
            }

            string EPC = e.info.epc.ToString();

            if (e.info.Bank1Data != null)
            {
                if (e.info.Bank1Data.Length > 0)
                {
                    EPC += CSLibrary.Tools.Hex.ToString(e.info.Bank1Data);
                }
            }

            _tagPerSecond++;

            if (TagList.Add(EPC))
            {
                _newTagPerSecond++;
            }

            if (e.info.rssi < minRSSI)
            {
                minRSSI    = e.info.rssi;
                minRSSIEPC = EPC;
            }
        }
Ejemplo n.º 4
0
        void Reader_TagInventoryEvent(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
        {
            Invoke((System.Threading.ThreadStart) delegate()
            {
                UInt32 tid;

                try
                {
                    if (e.type == CallbackType.TAG_RANGING)
                    {
                        if (e.info.epc.GetLength() < e.info.pc.EPCLength + 3)
                        {
                            return;
                        }

                        tid = (UInt32)((e.info.epc.ToUshorts()[e.info.pc.EPCLength] << 16) | e.info.epc.ToUshorts()[e.info.pc.EPCLength + 1]);
                        if (tid != 0xe200b001U && tid != 0xe200b002U)
                        {
                            return;
                        }

                        CS9010Info(e.info);
                    }
                }
                catch (Exception ex)
                {
                }
            });
        }
        void ReaderXP_TagInventoryEvent(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
        {
            Invoke((System.Threading.ThreadStart) delegate()
            {
                //Using asyn delegate to update UI
                if (e.type == CallbackType.TAG_INVENTORY)
                {
                    string tid = e.info.epc.ToString().Substring((int)e.info.pc.EPCLength * 4, 8);

                    // E0361094 / E03610A1
                    if (tid.Substring(0, 6) == "E03610")
                    {
                        m_totaltag++;

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

                        UpdateRecords(e.info);
                    }

                    if (Program.appSetting.Cfg_blocking_mode)
                    {
                        Application.DoEvents();
                    }
                }
            });
        }
        void TagInventoryEvent(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
        {
            if (e.type != CSLibrary.Constants.CallbackType.TAG_RANGING)
            {
                return;
            }

            InvokeOnMainThread(() =>
            {
                _tagCountForAlert++;
                if (_tagCountForAlert == 1)
                {
                    if (BleMvxApplication._config.RFID_InventoryAlertSound)
                    {
                        if (_newTagFound)
                        {
                            Xamarin.Forms.DependencyService.Get <ISystemSound>().SystemSound(3);
                        }
                        else
                        {
                            Xamarin.Forms.DependencyService.Get <ISystemSound>().SystemSound(2);
                        }
                        _newTagFound = false;
                    }
                }
                else if (_tagCountForAlert >= 5)
                {
                    _tagCountForAlert = 0;
                }

                AddOrUpdateTagData(e.info);
                tagsCount++;
            });
        }
        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
            });
        }
Ejemplo n.º 8
0
 void ReaderXP_TagSearchAllEvent(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
 {
     this.Invoke((System.Threading.ThreadStart) delegate()
     {
         if (e.type == CallbackType.TAG_INVENTORY)
         {
             AddItem(e.info);
         }
     });
 }
        void TagInventoryEvent(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
        {
            Device.BeginInvokeOnMainThread(() =>
            {
                if (e.type != CSLibrary.Constants.CallbackType.TAG_RANGING || !_started)
                {
                    return;
                }

                _tagCount++;
            });
        }
Ejemplo n.º 10
0
        void ReaderXP_TagInventoryEvent(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
        {
            this.Invoke((System.Threading.ThreadStart) delegate()
            {
                //Using asyn delegate to update UI
                if (e.type == CallbackType.TAG_INVENTORY)
                {
                    //Device.BuzzerOn(2000, 40, BUZZER_SOUND.HIGH);

                    UpdateRecords(e.info);
                }
            });
        }
        void TagInventoryEvent(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
        {
            if (e.type != CSLibrary.Constants.CallbackType.TAG_RANGING)
            {
                return;
            }

            if (e.info.Bank1Data == null || e.info.Bank1Data.Length != 4) // TID
            {
                return;
            }

            if (e.info.Bank2Data == null || e.info.Bank2Data.Length != 5) // TID
            {
                return;
            }

            if (_waitingRFIDIdle) // ignore display tags
            {
                return;
            }

            InvokeOnMainThread(() =>
            {
                _tagCount4Display++;
                _tagCount4BeepSound++;

                if (_tagCount4BeepSound == 1)
                {
                    if (BleMvxApplication._config.RFID_InventoryAlertSound)
                    {
                        if (_newtagCount4BeepSound > 0)
                        {
                            Xamarin.Forms.DependencyService.Get <ISystemSound>().SystemSound(3);
                        }
                        else
                        {
                            Xamarin.Forms.DependencyService.Get <ISystemSound>().SystemSound(2);
                        }
                        _newtagCount4BeepSound = 0;
                    }
                }
                else if (_tagCount4BeepSound >= 40) // from 5
                {
                    _tagCount4BeepSound = 0;
                }

                AddOrUpdateTagData(e.info);
            });
        }
Ejemplo n.º 12
0
 void ReaderXP_OnAsyncCallback(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
 {
     if (e.type == CallbackType.TAG_RANGING)
     {
         if (!e.info.crcInvalid)
         {
             totalGoodRead++;
             syncQueue.Write(e.info.epc.ToString());
         }
         else
         {
             totalBadRead++;
         }
     }
 }
Ejemplo n.º 13
0
        void Reader_TagInventoryEvent(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
        {
            // Check Callback Type
            if (e.type != CSLibrary.Constants.CallbackType.TAG_RANGING)
            {
                return;
            }

            BeginInvoke((System.Threading.ThreadStart) delegate()
            {
                try
                {
                    string TID;
                    string EPC;
                    string PC;
                    int cnt;

                    // Get EPC string
                    EPC = e.info.epc.ToString().Substring(0, (int)(e.info.pc.EPCLength * 4));
                    TID = e.info.epc.ToString().Substring((int)(e.info.pc.EPCLength * 4));
                    PC  = e.info.pc.ToString();
                    for (cnt = 0; cnt < listView1.Items.Count; cnt++)
                    {
                        if (listView1.Items[cnt].SubItems[1].Text == TID)
                        {
                            break;
                        }
                    }

                    if (cnt == listView1.Items.Count)
                    {
                        ListViewItem ins = new ListViewItem((listView1.Items.Count + 1).ToString());
                        ins.SubItems.Add(TID);
                        ins.SubItems.Add(PC);
                        ins.SubItems.Add(EPC);
                        listView1.Items.Add(ins);
                    }
                }
                catch (Exception ex)
                {
                }
            });
        }
Ejemplo n.º 14
0
        void TagInventoryEvent(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
        {
            if (e.type != CSLibrary.Constants.CallbackType.TAG_RANGING)
            {
                return;
            }


            var msg = e.info.epc.ToString();

            Debug.WriteLine(msg);

            if (firstTime)
            {
                firstTime = false;
                TypeText(msg);

                RFIDInventoryOff();
            }
        }
Ejemplo n.º 15
0
        public void TagSearchOneEvent(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
        {
            switch (e.type)
            {
            case CSLibrary.Constants.CallbackType.TAG_SEARCHING:

                //Xamarin.Forms.DependencyService.Get<ISystemSound>().SystemSound(3);

                _rssi       = (int)(Math.Round(((CSLibrary.Structures.TagCallbackInfo)e.info).rssi));
                _noTagCount = 0;

                //_progressbarRSSIValue = ((CSLibrary.Structures.TagCallbackInfo)e.info).rssi / 100;
                if (BleMvxApplication._config.RFID_DBm)
                {
                    // Range -90 ~ -10 (16.98 ~ 96.98)
                    double displayRSSI = dBuV2dBm(((CSLibrary.Structures.TagCallbackInfo)e.info).rssi);
                    if (displayRSSI < -90)
                    {
                        _progressbarRSSIValue = 0;
                    }
                    else if (displayRSSI > -10)
                    {
                        _progressbarRSSIValue = 1;
                    }
                    else
                    {
                        _progressbarRSSIValue = (displayRSSI + 90) / 80;
                    }
                    _rssiString = displayRSSI.ToString();
                }
                else
                {
                    _progressbarRSSIValue = ((CSLibrary.Structures.TagCallbackInfo)e.info).rssi / 100;
                    _rssiString           = _rssi.ToString();
                }

                RaisePropertyChanged(() => rssiStart);
                RaisePropertyChanged(() => progressbarRSSIValue);
                break;
            }
        }
        void TagInventoryEvent(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
        {
            if (e.type != CSLibrary.Constants.CallbackType.TAG_RANGING)
            {
                return;
            }

            if (textBox2.Text.Length > 30000)
            {
                textBox2.Text = "";
            }

            if (checkBox_TID.Checked)
            {
                //textBox2.Text += "EPC:" + e.info.epc + " TID:" + CSLibrary.Tools.Hex.ToString(e.info.Bank1Data)  + Environment.NewLine;
                textBox2.Text = "EPC:" + e.info.epc + " TID:" + CSLibrary.Tools.Hex.ToString(e.info.Bank1Data) + Environment.NewLine + textBox2.Text;
            }
            else
            {
                //textBox2.Text += "EPC:" + e.info.epc + Environment.NewLine;
                textBox2.Text = "EPC:" + e.info.epc + Environment.NewLine + textBox2.Text;
            }
        }
Ejemplo n.º 17
0
        void TagInventoryEvent(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
        {
            if (e.type != CSLibrary.Constants.CallbackType.TAG_RANGING)
            {
                return;
            }

            //if (_waitingRFIDIdle) // ignore display tags
            //    return;

            AddOrUpdateTagData(e.info);

            /*
             *          InvokeOnMainThread(() =>
             *          {
             *              _tagCount4Display++;
             *              _tagCount4BeepSound++;
             *
             *              if (_tagCount4BeepSound == 1)
             *              {
             *                  if (BleMvxApplication._config.RFID_InventoryAlertSound)
             *                  {
             *                      if (_newtagCount4BeepSound > 0)
             *                          Xamarin.Forms.DependencyService.Get<ISystemSound>().SystemSound(3);
             *                      else
             *                          Xamarin.Forms.DependencyService.Get<ISystemSound>().SystemSound(2);
             *                      _newtagCount4BeepSound = 0;
             *                  }
             *              }
             *              else if (_tagCount4BeepSound >= 40) // from 5
             *                  _tagCount4BeepSound = 0;
             *
             *              AddOrUpdateTagData(e.info);
             *          });
             */
        }
Ejemplo n.º 18
0
        void Reader_TagInventoryEvent(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
        {
            // Check Callback Type
            if (e.type != CSLibrary.Constants.CallbackType.TAG_RANGING)
            {
                return;
            }

            UInt32 TID, TID1;
            string EPC;

            UInt16[] tagdata = e.info.epc.ToUshorts();

            // Check TID code (exclude if scan temp)
            //TID = (UInt32)((tagdata[e.info.pc.EPCLength] << 16) | tagdata[e.info.pc.EPCLength + 1]) & 0xffffffc0U;
            //if (TID != 0xe2806e80U && TID != 0xe2806e8fU && TID != 0xe2806800U)
            //    return;

            TID  = (UInt32)((tagdata[e.info.pc.EPCLength] << 16) | tagdata[e.info.pc.EPCLength + 1]);
            TID1 = TID & 0xffffffc0U;
            if (TID1 != 0xe2806e80U && TID1 != 0xe2806e8fU && TID1 != 0xe2806800U)
            {
                return;
            }

            EPC = e.info.epc.ToString().Substring(0, (int)(e.info.pc.EPCLength * 4)) + ":" + TID.ToString("X8");

            BeginInvoke((System.Threading.ThreadStart) delegate()
            {
                lock (listView1)
                {
                    int cnt;

                    for (cnt = 0; cnt < listView1.Items.Count; cnt++)
                    {
                        if (listView1.Items[cnt].SubItems[1].Text == EPC)
                        {
                            break;
                        }
                    }

                    if (cnt == listView1.Items.Count)
                    {
                        ListViewItem ins = new ListViewItem((listView1.Items.Count + 1).ToString());
                        ins.SubItems.Add(EPC);

                        if ((tagdata[e.info.pc.EPCLength + 2] & 0x0800) != 0x0000)
                        {
                            ins.SubItems.Add("1");
                        }
                        else
                        {
                            ins.SubItems.Add("0");
                        }

                        if ((tagdata[e.info.pc.EPCLength + 2] & 0x0040) != 0x0000)
                        {
                            ins.SubItems.Add("1");
                        }
                        else
                        {
                            ins.SubItems.Add("0");
                        }

                        if ((tagdata[e.info.pc.EPCLength + 2] & 0x0001) != 0x0000)
                        {
                            ins.SubItems.Add("1");
                        }
                        else
                        {
                            ins.SubItems.Add("0");
                        }

                        listView1.Items.Add(ins);
                    }
                    else
                    {
                        if ((tagdata[e.info.pc.EPCLength + 2] & 0x0800) != 0x0000)
                        {
                            listView1.Items[cnt].SubItems[2].Text = "1";
                        }
                        else
                        {
                            listView1.Items[cnt].SubItems[2].Text = "0";
                        }

                        if ((tagdata[e.info.pc.EPCLength + 2] & 0x0040) != 0x0000)
                        {
                            listView1.Items[cnt].SubItems[3].Text = "1";
                        }
                        else
                        {
                            listView1.Items[cnt].SubItems[3].Text = "0";
                        }

                        if ((tagdata[e.info.pc.EPCLength + 2] & 0x0001) != 0x0000)
                        {
                            listView1.Items[cnt].SubItems[4].Text = "1";
                        }
                        else
                        {
                            listView1.Items[cnt].SubItems[4].Text = "0";
                        }
                    }
                }
            });
        }
 void OnItemSelected(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
 {
     var a = 10;
 }
 void TagInventoryEvent(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
 {
     tagsCount++;
     AddOrUpdateTagData(e.info);
 }