private void timer1_Tick(object sender, EventArgs e) { TagChipType nxpchiptype = TagChipType.TagChipType_None; try { this.labEASAlert.BackColor = Color.Gray; if (this.cbbnxpchiptype.SelectedIndex == 0) { nxpchiptype = TagChipType.TagChipType_NXP_G2X; } else if (this.cbbnxpchiptype.SelectedIndex == 1) { nxpchiptype = TagChipType.TagChipType_NXP_G2i; } NXP_EASAlarmPara EasAlarmPara = new NXP_EASAlarmPara(0x01, 0x02, 0x01, nxpchiptype); NXP_EASAlarmResult result = (NXP_EASAlarmResult)mrdr.CustomCmd(null, CustomCmdType.NXP_EASAlarm, EasAlarmPara); tbEASAlarmData.Text = ByteFormat.ToHex(result.EASAlarmData); System.Media.SystemSounds.Beep.Play(); this.labEASAlert.BackColor = Color.Red; } catch (Exception ex) { } }
private void btnEASAlarm_Click(object sender, EventArgs e) { int ret; ret = IsAntSet(); if (ret == -1) { MessageBox.Show("please select antenna"); return; } else if (ret == 1) { DialogResult stat = DialogResult.OK; stat = MessageBox.Show("execute operation on the port without finding antenna ?", "tip-off", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (stat != DialogResult.OK) { return; } } try { NXP_EASAlarmPara EasAlarmPara = new NXP_EASAlarmPara(0x01, 0x02, 0x01); NXP_EASAlarmResult result = (NXP_EASAlarmResult)mrdr.CustomCmd(CustomCmdType.NXP_EASAlarm, EasAlarmPara); tbEASAlarmData.Text = ByteFormat.ToHex(result.EASAlarmData); } catch (OpFaidedException notagexp) { if (notagexp.ErrCode == 0x400) { MessageBox.Show("no tag"); } else { MessageBox.Show("operation failed:" + notagexp.ToString()); } return; } catch (Exception ex) { MessageBox.Show("EASAlarm failed:" + ex.ToString()); return; } }
private void timer1_Tick(object sender, EventArgs e) { try { this.labEASAlert.BackColor = Color.Gray; NXP_EASAlarmPara EasAlarmPara = new NXP_EASAlarmPara(0x01, 0x02, 0x01); NXP_EASAlarmResult result = (NXP_EASAlarmResult)mrdr.CustomCmd(CustomCmdType.NXP_EASAlarm, EasAlarmPara); tbEASAlarmData.Text = ByteFormat.ToHex(result.EASAlarmData); System.Media.SystemSounds.Beep.Play(); this.labEASAlert.BackColor = Color.Red; } catch (Exception ex) { } }
private void btnEASAlarm_Click(object sender, EventArgs e) { TagChipType nxpchiptype = TagChipType.TagChipType_None; int ret; ret = IsAntSet(); if (ret == -1) { MessageBox.Show("请选择操作天线"); return; } else if (ret == 1) { DialogResult stat = DialogResult.OK; stat = MessageBox.Show("在未检测到天线的端口执行操作,真的要执行吗?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (stat != DialogResult.OK) { return; } } if (this.cbbnxpchiptype.SelectedIndex == -1) { MessageBox.Show("请选择芯片类型"); return; } else { if (this.cbbnxpchiptype.SelectedIndex == 0) { nxpchiptype = TagChipType.TagChipType_NXP_G2X; } else if (this.cbbnxpchiptype.SelectedIndex == 1) { nxpchiptype = TagChipType.TagChipType_NXP_G2i; } } try { NXP_EASAlarmPara EasAlarmPara = new NXP_EASAlarmPara(0x01, 0x02, 0x01, nxpchiptype); NXP_EASAlarmResult result = (NXP_EASAlarmResult)mrdr.CustomCmd(null, CustomCmdType.NXP_EASAlarm, EasAlarmPara); tbEASAlarmData.Text = ByteFormat.ToHex(result.EASAlarmData); } catch (OpFaidedException notagexp) { if (notagexp.ErrCode == 0x400) { MessageBox.Show("没法发现标签"); } else { MessageBox.Show("操作失败:" + notagexp.ToString()); } return; } catch (Exception ex) { MessageBox.Show("EASAlarm失败:" + ex.ToString()); return; } }