Esempio n. 1
0
 public AppForm()
 {
     InitializeComponent();
     m_ReadTag             = new Symbol.RFID3.TagData();
     m_UpdateStatusHandler = new UpdateStatus(myUpdateStatus);
     m_UpdateReadHandler   = new UpdateRead(myUpdateRead);
     m_ConnectionForm      = new ConnectionForm(this);
     m_ReadForm            = new ReadForm(this);
     m_TagTable            = new Hashtable();
     m_AccessOpResult      = new AccessOperationResult();
     m_IsConnected         = false;
     m_TagTotalCount       = 0;
 }
        public FrmBarcodeScanSearch(StartAudit_Form appForm)
        {
            InitializeComponent();
            this.m_appForm = appForm;
            status = "Connect";
            this.m_UpdateReadHandler = new UpdateRead(myUpdateRead);
            this.m_UpdateStatusHandler = new UpdateStatus(myUpdateStatus);
            this.m_ReadTag = new Symbol.RFID3.TagData();

            m_ReaderAPI = m_appForm.m_ReaderAPI;
            m_ReaderAPI = new RFIDReader("127.0.0.1", 5084, 0);

            this.m_AntennaInfoForm = m_appForm.m_AntennaInfoForm;
            this.m_AntennaConfigForm = m_appForm.m_AntennaConfigForm;
            this.m_PostFilterForm = m_appForm.m_PostFilterForm;
            this.m_AccessFilterForm = m_appForm.m_AccessFilterForm;
            this.m_TriggerForm = m_appForm.m_TriggerForm;

            this.m_ReaderMgmt = new ReaderManagement();
            this.m_TagTable = new Hashtable(1023);
            this.m_AccessOpResult = new AccessOperationResult();
            this.m_IsConnected = false;
            this.m_TagTotalCount = 0;
            this.m_ReaderInitiatedDisconnectionReceived = false;
            this.m_isBeepingEnabled = true;

            //Barcode scan start
            try
            {
                // Let's use the first available scanner.
                scanner = new Barcode2();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Barcode2 instantiation failed with " + ex.Message);
                this.Close();
                return;
            }

            // Let's use triggers to fire up the scanner.
            scanner.Config.TriggerMode = TRIGGERMODES.HARD;

            // Register a scan event handler
            //scanner.OnScan += new Barcode2.OnScanHandler(barcode21_OnScan);
            scanner.OnScan += new Barcode2.OnScanHandler(barcode21_OnScan);
               // scanner.OnStatus += new Barcode2.OnStatusHandler(barcode21_OnStatus);

            //Barcode scan end
        }
        public StartAudit_Form()
        {
            InitializeComponent();
            status = "Connect";

            m_AntennaInfoForm = new AntennaInfoForm(this);
            m_AntennaConfigForm = new AntennaConfigForm(this);
            m_PostFilterForm = new PostFilterForm(this);
            m_AccessFilterForm = new AccessFilterForm(this);
            m_TriggerForm = new TriggerForm(this);

            m_ReaderMgmt = new ReaderManagement();
            m_AccessOpResult = new AccessOperationResult();
            m_IsConnected = false;
            m_ReaderInitiatedDisconnectionReceived = false;
            sinfm = new ScanInventory_Form(this);
        }
        public SearchBarcodeForm(StartAudit_Form appForm)
        {
            InitializeComponent();
            this.m_appForm = appForm;
            status = "Connect";
            this.m_UpdateReadHandler = new UpdateRead(myUpdateRead);
            this.m_UpdateStatusHandler = new UpdateStatus(myUpdateStatus);
            this.m_ReadTag = new Symbol.RFID3.TagData();

            m_ReaderAPI = m_appForm.m_ReaderAPI;
            m_ReaderAPI = new RFIDReader("127.0.0.1", 5084, 0);

            this.m_AntennaInfoForm = m_appForm.m_AntennaInfoForm;
            this.m_AntennaConfigForm = m_appForm.m_AntennaConfigForm;
            this.m_PostFilterForm = m_appForm.m_PostFilterForm;
            this.m_AccessFilterForm = m_appForm.m_AccessFilterForm;
            this.m_TriggerForm = m_appForm.m_TriggerForm;

            this.m_ReaderMgmt = new ReaderManagement();
            this.m_TagTable = new Hashtable(1023);
            this.m_AccessOpResult = new AccessOperationResult();
            this.m_IsConnected = false;
            this.m_TagTotalCount = 0;
            this.m_ReaderInitiatedDisconnectionReceived = false;
            this.m_isBeepingEnabled = true;
        }
Esempio n. 5
0
        private void BackgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs accessEvents)
        {
            int index = 0;

            if (accessEvents.Error != null)
            {
                functionCallStatusLabel.Text = accessEvents.Error.Message;
            }
            else
            {
                // Handle AccessWait Operations
                AccessOperationResult accessOpResult = (AccessOperationResult)accessEvents.Result;
                if (accessOpResult.m_Result == RFIDResults.RFID_API_SUCCESS)
                {
                    if (accessOpResult.m_OpCode == ACCESS_OPERATION_CODE.ACCESS_OPERATION_READ)
                    {
                        if (inventoryList.SelectedItems.Count > 0)
                        {
                            ListViewItem item  = inventoryList.SelectedItems[0];
                            string       tagID = m_ReadTag.TagID + m_ReadTag.MemoryBank.ToString()
                                                 + m_ReadTag.MemoryBankDataOffset.ToString();

                            if (item.SubItems[5].Text.Length > 0)
                            {
                                bool isFound = false;

                                // Search or add new one
                                lock (m_TagTable.SyncRoot)
                                {
                                    isFound = m_TagTable.ContainsKey(tagID);
                                }

                                if (!isFound)
                                {
                                    ListViewItem newItem = new ListViewItem(m_ReadTag.TagID);
                                    ListViewItem.ListViewSubItem subItem = new ListViewItem.ListViewSubItem(newItem, m_ReadTag.AntennaID.ToString());
                                    newItem.SubItems.Add(subItem);
                                    subItem = new ListViewItem.ListViewSubItem(item, m_ReadTag.TagSeenCount.ToString());
                                    newItem.SubItems.Add(subItem);
                                    subItem = new ListViewItem.ListViewSubItem(item, m_ReadTag.PeakRSSI.ToString());
                                    newItem.SubItems.Add(subItem);
                                    subItem = new ListViewItem.ListViewSubItem(item, m_ReadTag.PC.ToString("X"));
                                    newItem.SubItems.Add(subItem);
                                    subItem = new ListViewItem.ListViewSubItem(item, m_ReadTag.MemoryBankData);
                                    newItem.SubItems.Add(subItem);

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

                                    subItem = new ListViewItem.ListViewSubItem(item, memoryBank);
                                    newItem.SubItems.Add(subItem);
                                    subItem = new ListViewItem.ListViewSubItem(item, m_ReadTag.MemoryBankDataOffset.ToString());
                                    newItem.SubItems.Add(subItem);

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

                                    lock (m_TagTable.SyncRoot)
                                    {
                                        m_TagTable.Add(tagID, newItem);
                                    }
                                }
                            }
                            else
                            {
                                // Empty Memory Bank Slot
                                item.SubItems[5].Text = m_ReadTag.MemoryBankData;

                                string memoryBank = m_ReadForm.m_ReadParams.MemoryBank.ToString();
                                index = memoryBank.LastIndexOf('_');
                                if (index != -1)
                                {
                                    memoryBank = memoryBank.Substring(index + 1);
                                }
                                item.SubItems[6].Text = memoryBank;
                                item.SubItems[7].Text = m_ReadTag.MemoryBankDataOffset.ToString();

                                lock (m_TagTable.SyncRoot)
                                {
                                    if (m_ReadTag.TagID != null)
                                    {
                                        m_TagTable.Remove(m_ReadTag.TagID);
                                    }
                                    m_TagTable.Add(tagID, item);
                                }
                            }
                            this.m_ReadForm.ReadData_TB.Text = m_ReadTag.MemoryBankData;
                            functionCallStatusLabel.Text     = "Read Succeed";
                        }
                    }
                    else if (accessOpResult.m_OpCode == ACCESS_OPERATION_CODE.ACCESS_OPERATION_WRITE)
                    {
                        functionCallStatusLabel.Text = "Write Succeed";
                    }
                    else if (accessOpResult.m_OpCode == ACCESS_OPERATION_CODE.ACCESS_OPERATION_LOCK)
                    {
                        functionCallStatusLabel.Text = "Lock Succeed";
                    }
                    else if (accessOpResult.m_OpCode == ACCESS_OPERATION_CODE.ACCESS_OPERATION_KILL)
                    {
                        functionCallStatusLabel.Text = "Kill Succeed";
                    }
                    else if (accessOpResult.m_OpCode == ACCESS_OPERATION_CODE.ACCESS_OPERATION_BLOCK_ERASE)
                    {
                        functionCallStatusLabel.Text = "BlockErase Succeed";
                    }
                }
                else
                {
                    functionCallStatusLabel.Text = accessOpResult.m_StatusDescription + " [" + accessOpResult.m_VendorMessage + "]";
                }
                resetButtonState();
            }
        }