예제 #1
0
 public override void ListenReader()
 {
     Task.Factory.StartNew(() =>
     {
         while (shouldListenReader)
         {
             int sleepTime         = _defaultThreadSleepTime;
             byte AdrTID           = 0;
             byte LenTID           = 0;
             byte TIDFlag          = 0;
             byte[] EPC            = new byte[5000];
             int TotalLen          = 0;
             int CardNum           = 0;
             int InventoryResponse = ReaderB.StaticClassReaderB.Inventory_G2(ref _comAdr, AdrTID, LenTID, TIDFlag, EPC, ref TotalLen, ref CardNum, _comPortIndex);
             if (InventoryResponse == 1)
             {
                 RFIDTag tag = BuildEPCTagFromBytes(TotalLen, EPC);
                 TagCatchEvent?.Invoke(new TagCatchEventArgs
                 {
                     Tag = tag
                 });
                 sleepTime = 2000;
             }
             Thread.Sleep(sleepTime);
         }
     });
 }
예제 #2
0
        protected virtual void RFIDTagCallback(IntPtr p, Int32 nEvt)
        {
            RFIDTag rfidTag = (RFIDTag)Marshal.PtrToStructure(p, typeof(RFIDTag));

            TagCatchEvent?.Invoke(new TagCatchEventArgs
            {
                Tag = rfidTag
            });
        }