private void btRealTimeInventory_Click() { try { m_curInventoryBuffer.ClearInventoryPar(); m_curInventoryBuffer.btRepeat = Convert.ToByte("1"); // Repeat per command m_curInventoryBuffer.bLoopCustomizedSession = false; // Not session ID Defined m_curInventoryBuffer.lAntenna.Add(0x00); // Antenna 1 (00) as source if (m_curInventoryBuffer.bLoopInventory) { m_bInventory = false; m_curInventoryBuffer.bLoopInventory = false; } else { m_bInventory = true; m_curInventoryBuffer.bLoopInventory = true; } m_curInventoryBuffer.bLoopInventoryReal = true; m_curInventoryBuffer.ClearInventoryRealResult(); m_nTotal = 0; byte btWorkAntenna = m_curInventoryBuffer.lAntenna[m_curInventoryBuffer.nIndexAntenna]; reader.SetWorkAntenna(m_curSetting.btReadId, btWorkAntenna); m_curSetting.btWorkAntenna = btWorkAntenna; } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }
private static void Connect() { string strException = string.Empty; string strComPort = _Com_Port; int nBaudrate = Convert.ToInt32(_Boud_Rate); int nRet = reader.OpenCom(strComPort, nBaudrate, out strException); if (nRet != 0) { string strLog = "Connection failed, failure cause: " + strException; Logger(strLog); throw new Exception(strLog); } else { #region Set Function Default htxtSendData = "A0 04 FF A0 00"; CalculateCheckSumCommand(null, EventArgs.Empty); string SendCommandStr = htxtSendData + htxtCheckData; string[] reslut = CCommondMethod.StringToStringArray(SendCommandStr.ToUpper(), 2); byte[] btArySendData = CCommondMethod.StringArrayToByteArray(reslut, reslut.Length); reader.SendMessage(btArySendData); #endregion Set Function Default string strLog = "Connect" + strComPort + "@" + nBaudrate.ToString(); Logger(strLog); if (_Start_Read == "Start") { try { strLog = "Started to read tags"; Logger(strLog); m_curInventoryBuffer.ClearInventoryPar(); m_curInventoryBuffer.btRepeat = Convert.ToByte(repeatCommand); m_curInventoryBuffer.bLoopCustomizedSession = false; m_curInventoryBuffer.lAntenna.Add(0x00); m_curInventoryBuffer.lAntenna.Add(0x01); m_curInventoryBuffer.lAntenna.Add(0x02); m_curInventoryBuffer.lAntenna.Add(0x03); if (m_curInventoryBuffer.lAntenna.Count == 0) { Logger("One antenna must be selected"); } m_bInventory = true; m_curInventoryBuffer.bLoopInventory = true; m_curInventoryBuffer.bLoopInventoryReal = true; m_nTotal = 0; byte btWorkAntenna = m_curInventoryBuffer.lAntenna[m_curInventoryBuffer.nIndexAntenna]; reader.SetWorkAntenna(m_curSetting.btReadId, btWorkAntenna); m_curSetting.btWorkAntenna = btWorkAntenna; timerInventory.Enabled = true; timerInventory.Enabled = true; } catch (Exception ex) { Logger(ex.Message); } } } }