private void btnSetRF_Click(object sender, EventArgs e) { #region Set reader mode; byte b = 0x00; if (cbReaderMode.Text == "Fast Read") { b = 0x04; } else if (cbReaderMode.Text == "Dense Reader M=2") { b = 0x05; } else if (cbReaderMode.Text == "Dense Reader M=4") { b = 0x02; } else if (cbReaderMode.Text == "AutoSet") { b = 0xff; } else { MessageBox.Show("Error setting mode = default to Fast Read"); b = 0x04; } lbl_msg.Text = ""; IRP1.SysConfig_800 order = new IRP1.SysConfig_800((Byte)0x19, new Byte[] { b }); if (reader.Send(order)) { lbl_msg.Text = lbl_msg.Text + "Reader Mode = " + cbReaderMode.Text; } else { lbl_msg.Text = lbl_msg.Text + "Error setting Reader Mode"; } #endregion #region Set Session and Inventory Flag byte[] bs = new byte[2]; bs[0] = (Byte)cbSession.SelectedIndex; bs[1] = (Byte)cbFlag.SelectedIndex; IRP1.TagOperationConfig_6C order1 = new IRP1.TagOperationConfig_6C(0x12, bs); if (reader.Send(order1)) { lbl_msg.Text = lbl_msg.Text + " Session = " + cbSession.Text + " Flag = " + cbFlag.Text; } else { lbl_msg.Text = lbl_msg.Text + "Error setting Session and Inventory Flag"; } #endregion // MessageBox.Show(cbSession.SelectedIndex.ToString() + " " + cbFlag.SelectedIndex.ToString()); }
private void btnApplyTxPwr_Click(object sender, EventArgs e) { #region Configure Antenna 1; if (nudAnt1.Text != string.Empty) { lbl_msg.Text = ""; String strSuc1 = ""; String strFai1 = ""; Byte[] aData = new Byte[2]; aData[0] = 0x00;//Antenna #1 aData[1] = (Byte)Convert.ToInt16(nudAnt1.Text); IRP1.SysConfig_800 order = new IRP1.SysConfig_800(0x65, aData); if (reader.Send(order)) { strSuc1 += "1,"; } else { strFai1 += "1,"; } if (strSuc1 == "1,") { lbl_msg.Text = lbl_msg.Text + "Ant1 Success, "; } else { lbl_msg.Text = lbl_msg.Text + "Ant1 Fail, "; } } #endregion #region Configure Antenna 2; if (nudAnt2.Text != string.Empty) { String strSuc = ""; String strFai = ""; Byte[] aData = new Byte[2]; aData[0] = 0x01;//Antenna #2 aData[1] = (Byte)Convert.ToInt16(nudAnt2.Text); IRP1.SysConfig_800 order = new IRP1.SysConfig_800(0x65, aData); if (reader.Send(order)) { strSuc += "1,"; } else { strFai += "1,"; } if (strSuc == "1,") { lbl_msg.Text = lbl_msg.Text + "Ant2 Success, "; } else { lbl_msg.Text = lbl_msg.Text + "Ant2 Fail, "; } #endregion } #region Configure Antenna 3; if (nudAnt3.Text != string.Empty) { String strSuc = ""; String strFai = ""; Byte[] aData = new Byte[2]; aData[0] = 0x02;//Antenna #3 aData[1] = (Byte)Convert.ToInt16(nudAnt3.Text); IRP1.SysConfig_800 order = new IRP1.SysConfig_800(0x65, aData); if (reader.Send(order)) { strSuc += "1,"; } else { strFai += "1,"; } if (strSuc == "1,") { lbl_msg.Text = lbl_msg.Text + "Ant3 Success, "; } else { lbl_msg.Text = lbl_msg.Text + "Ant3 Fail, "; } #endregion } #region Configure Antenna 4; if (nudAnt4.Text != string.Empty) { String strSuc = ""; String strFai = ""; Byte[] aData = new Byte[2]; aData[0] = 0x03;//Antenna #4 aData[1] = (Byte)Convert.ToInt16(nudAnt4.Text); IRP1.SysConfig_800 order = new IRP1.SysConfig_800(0x65, aData); if (reader.Send(order)) { strSuc += "1,"; } else { strFai += "1,"; } if (strSuc == "1,") { lbl_msg.Text = lbl_msg.Text + "Ant4 Success, "; } else { lbl_msg.Text = lbl_msg.Text + "Ant4 Fail, "; } #endregion } #region Configure Memory Bank, Antenna, Read Method and Q value IRP1.ReadTag.ReadMemoryBank rmb = (IRP1.ReadTag.ReadMemoryBank)Enum.Parse(typeof(IRP1.ReadTag.ReadMemoryBank), cbReadMB.Items[cbReadMB.SelectedIndex].ToString()); msg = new IRP1.ReadTag(rmb); // MessageBox.Show("Q = " + msg.Q.ToString() + " Is loop = " + msg.IsLoop.ToString()); byte a = 0x80;// if (cbAnt1.Checked) { a += 0x01; } if (cbAnt2.Checked) { a += 0x02; } if (cbAnt3.Checked) { a += 0x04; } if (cbAnt4.Checked) { a += 0x08; } msg.Antenna = a; msg.IsLoop = (rbContinuous.Checked) ? true : false; msg.Q = (byte)numQ.Value; //set Q byte[] bs = new byte[1]; bs[0] = (Byte)numQ.Value; IRP1.TagOperationConfig_6C msg1 = new IRP1.TagOperationConfig_6C(0x10, bs); if (reader.Send(msg1)) { lbl_msg.Text = lbl_msg.Text + "Q = " + numQ.Value.ToString(); } else { lbl_msg.Text = lbl_msg.Text + "Error Setting Q"; } #endregion }