private void applyButton_Click(object sender, EventArgs e) { try { if (m_AppForm.m_ReaderAPI.IsConnected) { ArrayList checkList = new ArrayList(); foreach (CheckBox cb in m_CheckBox) { if (cb.Checked) { checkList.Add(cb.Text); } } if (checkList.Count == 0) { foreach (CheckBox cb in m_CheckBox) { cb.Checked = true; selectAll_CB.Checked = true; checkList.Add(cb.Text); } } if (checkList.Count > 0) { ushort[] antList = new ushort[checkList.Count]; for (int index = 0; index < checkList.Count; index++) { antList[index] = ushort.Parse(checkList[index].ToString()); } if (null == m_AntennaList) { m_AntennaList = new Symbol.RFID3.AntennaInfo(antList); } else { m_AntennaList.AntennaID = antList; } } m_AppForm.functionCallStatusLabel.Text = "Set Antenna Successfully"; } } catch (InvalidUsageException iue) { m_AppForm.functionCallStatusLabel.Text = iue.VendorMessage; } catch (OperationFailureException ofe) { m_AppForm.functionCallStatusLabel.Text = ofe.StatusDescription; } catch (Exception ex) { m_AppForm.functionCallStatusLabel.Text = ex.Message; } this.Close(); }
/// <summary> /// 初始化读取器 /// </summary> /// <param name="strIP"></param> /// <param name="strPort"></param> /// <param name="connTimeOut"></param> /// <param name="readerPowerList"></param> /// <param name="readerAntennasList"></param> /// <returns></returns> public ReturnMessage InitReader(string strIP, string strPort, string connTimeOut, List <string> readerPowerList, List <string> readerAntennasList) { ReturnMessage returnMsg = new ReturnMessage(); //初始化 Fixed Reader日志记录对象 DeclaimerReaderLog.InstanceLogger(LoggerClassType.DeclaimerWaitingGodotRollingFileAppender); //默认值设置 if (string.IsNullOrEmpty(strPort)) { strPort = "5084"; } if (string.IsNullOrEmpty(connTimeOut)) { connTimeOut = "0"; } if (readerPowerList == null) { readerPowerList = new List <string>() { "3000", "3000", "3000", "3000" }; } if (readerAntennasList == null) { readerAntennasList = new List <string>() { "1", "2", "3", "4" }; } this.ReaderIP = strIP; this.ReaderPort = strPort; this.ConnectTimeOut = connTimeOut; this.ReaderPowerList = readerPowerList; this.ReaderAntennasList = readerAntennasList; m_TagTable = new Hashtable(1023); //默认全开 AvailableAntennas ushort[] antList = new ushort[] { 1, 2, 3, 4 }; m_AntennaList = new Symbol.RFID3.AntennaInfo(antList); //创建读取器对象 m_RFIDReader = new RFIDReader(this.ReaderIP, uint.Parse(this.ReaderPort), uint.Parse(this.ConnectTimeOut)); //设置允许连接 IsAllowConnect = true; returnMsg.CallMessage = "Reader Init Success."; returnMsg.CallStatus = true; //日志记录 DeclaimerReaderLog.Info("[Reader Init Success.] ==== [" + DateTime.Now.ToString() + "]"); return(returnMsg); }
private void antennaInfoButton_Click(object sender, EventArgs e) { try { if (m_AppForm.m_ReaderAPI.IsConnected) { ArrayList checkList = new ArrayList(); foreach (CheckBox cb in m_CheckBox) { if (cb.Checked) { checkList.Add(cb.Text); } } if (checkList.Count == 0) { foreach (CheckBox cb in m_CheckBox) { cb.Checked = true; selectAll_CB.Checked = true; checkList.Add(cb.Text); } } if (checkList.Count > 0) { ushort[] antList = new ushort[checkList.Count]; for (int index = 0; index < checkList.Count; index++) { antList[index] = ushort.Parse(checkList[index].ToString()); } if (null == m_AntennaList) { m_AntennaList = new Symbol.RFID3.AntennaInfo(antList); } else { m_AntennaList.AntennaID = antList; } } } else { this.m_AppForm.notifyUser("Please connect to a reader", "Write Operation"); } this.Close(); } catch (Exception ex) { this.m_AppForm.notifyUser(ex.Message, "Antenna Info"); } }
/// <summary> /// 设置天线开启 /// </summary> /// <param name="powerList"></param> /// <returns></returns> private void SetReaderAntennas(List <string> ValidAntennasList) { ushort[] antList = new ushort[ValidAntennasList.Count]; //为空则默认开启全部天线 if (ValidAntennasList.Count == 0) { m_AntennaList.AntennaID = m_RFIDReader.Config.Antennas.AvailableAntennas; } for (int index = 0; index < ValidAntennasList.Count; index++) { antList[index] = ushort.Parse(ValidAntennasList[index].ToString()); } if (null == m_AntennaList) { m_AntennaList = new Symbol.RFID3.AntennaInfo(antList); } else { m_AntennaList.AntennaID = antList; } }