protected void UiWriteEpc() { AddToStatusAsync(""); string strdata = tvDataMemo.Text; if (strdata == "") { AddToStatusAsync("Input the write data."); tvDataMemo.Focus(); return; } string strpwd = tvPassword.Text; if (strpwd == "") { AddToStatusAsync("Input the tag password."); tvPassword.Focus(); return; } Cursor.Current = Cursors.WaitCursor; Cursor.Show(); string strcode = cbTargetTag.SelectedItem.ToString(); byte[] selcode = null; try { if (strcode != "") { selcode = Util.ConvertHexStringToByteArray(strcode); } byte[] bwritedata = Util.ConvertHexStringToByteArray(strdata); byte[] bpwd = Util.ConvertHexStringToByteArray(strpwd); string errInfo = ""; string strtmp = ""; if (TagOperation.WriteEpc(bpwd, bwritedata, selcode, selCodeArea, out errInfo)) { strtmp = "Write {0} bytes."; AddToStatusAsync(string.Format(strtmp, bwritedata.Length)); FormatConvert.SoundSucceed(); } else { //strtmp = CurLanguage.GetMsg("MSG_13"); //AddToStatusAsync(string.Format(strtmp, errInfo)); AddToStatusAsync(errInfo); FormatConvert.SoundError(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } Cursor.Current = Cursors.Default; }
protected void UiReadEpc() { AddToMemoAsync(""); string strcode = cbTargetTag.SelectedItem.ToString(); //MessageBox.Show("strCode es: " + strcode); byte[] selcode = null; if (strcode != "") { selcode = Util.ConvertHexStringToByteArray(strcode); //foreach (byte element in selcode) { // MessageBox.Show("selcode es: " + element.ToString()); //} } Cursor.Current = Cursors.WaitCursor; Cursor.Show(); try { string errInfo = ""; string strtmp = ""; byte[] readdata = null; bool ret = TagOperation.ReadEpc(selcode, selCodeArea, QValue, out readdata, out errInfo); if (ret && readdata != null) { //foreach(byte elemet in readdata){ // MessageBox.Show("readdata es: " + elemet.ToString()); //} //MessageBox.Show("decode readData: " + BitConverter.ToString(readdata)); byte[] tepc = null; int rssi = 0; string sepc = string.Empty; sepc = Util.ConvertByteArrayToHexString(readdata); AddToMemoAsync(sepc); strtmp = "Acquired data {0} bytes."; AddToStatusAsync(string.Format(strtmp, readdata.Length)); FormatConvert.SoundSucceed(); } else { //strtmp = CurLanguage.GetMsg("MSG_1"); //AddToStatusAsync(string.Format(strtmp, errInfo)); AddToStatusAsync(errInfo); FormatConvert.SoundError(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } Cursor.Current = Cursors.Default; }
protected void UiReadUserdata_6C() { MessageBox.Show("UiReadUserdata_6C"); AddToMemoAsync(""); string strcode = cbTargetTag.SelectedItem.ToString(); byte[] selcode = null; if (strcode != "") { MessageBox.Show("strCode: " + selcode); selcode = Util.ConvertHexStringToByteArray(strcode); } Cursor.Current = Cursors.WaitCursor; Cursor.Show(); try { uint offset = (uint)(Convert.ToUInt32(tvOffsetAddr.Text)); uint length = (uint)(Convert.ToUInt32(tvLength.Text)); byte[] readdata = null; string errInfo = ""; string strtmp = ""; bool ret = TagOperation.ReadUserdata_6C(offset, length, selcode, selCodeArea, out readdata, out errInfo); if (ret && readdata != null) { if (readdata != null) { foreach (byte element in readdata) { MessageBox.Show("readdata: " + element.ToString()); } string str = Util.ConvertByteArrayToHexString(readdata); AddToMemoAsync(str); strtmp = "Acquired data {0} bytes."; AddToStatusAsync(string.Format(strtmp, readdata.Length)); FormatConvert.SoundSucceed(); } } else { //strtmp = CurLanguage.GetMsg("MSG_1"); //AddToStatusAsync(string.Format(strtmp, errInfo)); AddToStatusAsync(errInfo); FormatConvert.SoundError(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } Cursor.Current = Cursors.Default; }
protected void UiReadUserdata_6B() { AddToMemoAsync(""); string strcode = cbTargetTag.SelectedItem.ToString(); byte[] selcode = null; if (strcode != "") { selcode = Util.ConvertHexStringToByteArray(strcode); } Cursor.Current = Cursors.WaitCursor; Cursor.Show(); try { uint offset = (uint)(Convert.ToUInt32(tvOffsetAddr.Text)); uint length = (uint)(Convert.ToUInt32(tvLength.Text)); byte[] readdata = null; string errInfo = ""; string strtmp = ""; bool ret = TagOperation.ReadUserdata_6B(selcode, offset, length, out readdata, out errInfo); if (ret && readdata != null) { if (readdata != null) { string str = Util.ConvertByteArrayToHexString(readdata); AddToMemoAsync(str); strtmp = "Acquired data {0} bytes."; AddToStatusAsync(string.Format(strtmp, readdata.Length)); FormatConvert.SoundSucceed(); } } else { strtmp = "ead failed, {0}!"; AddToStatusAsync(string.Format(strtmp, errInfo)); FormatConvert.SoundError(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } Cursor.Current = Cursors.Default; }
private void button2_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; this.button2.Enabled = false; if (!RfOn()) { FormatConvert.SoundError(); Cursor.Current = Cursors.Default; this.button2.Enabled = true; MessageBox.Show("Connect Failure !"); } else { btreadset.Enabled = true; this.btpower.Enabled = true; this.btscanrfid.Enabled = true; FormatConvert.SoundSucceed(); } Cursor.Current = Cursors.Default; }
/// <summary> /// Set Antenna Power /// </summary> private void SetAntennaPower() { if (cbdbm.SelectedIndex < 0) { return; } string errInfo = ""; byte val = Convert.ToByte(cbdbm.SelectedValue); if (TagOperation.SetAntennaPower(val, out errInfo)) { AddToStatusAsync("Set successfully."); FormatConvert.SoundSucceed(); Close(); return; } else { AddToStatusAsync("Failed," + errInfo); FormatConvert.SoundError(); } }
protected void UiWriteUserdata_6C() { AddToStatusAsync(""); string strdata = tvDataMemo.Text; if (strdata == "") { AddToStatusAsync("Input the write data."); tvDataMemo.Focus(); return; } string strpwd = tvPassword.Text; if (strpwd == "") { AddToStatusAsync("Input the tag password."); tvPassword.Focus(); return; } Cursor.Current = Cursors.WaitCursor; Cursor.Show(); string strcode = cbTargetTag.SelectedItem.ToString(); byte[] selcode = null; try { if (strcode != "") { selcode = Util.ConvertHexStringToByteArray(strcode); } uint offset = (ushort)(Convert.ToUInt32(tvOffsetAddr.Text)); //uint length = (ushort)(Convert.ToUInt32(tvLength.Text) / 2); byte[] bwritedata = Util.ConvertHexStringToByteArray(strdata); byte[] bpwd = Util.ConvertHexStringToByteArray(strpwd); int hadlen = 0; string errInfo = ""; bool ret = TagOperation.WriteUserdata_6C(offset, bpwd, bwritedata, selcode, selCodeArea, out errInfo); string strmsg = ""; string strtmp = ""; if (ret == true) { strtmp = "Write {0} bytes."; strmsg = string.Format(strtmp, bwritedata.Length); AddToStatusAsync(strmsg); FormatConvert.SoundSucceed(); } else { //strtmp = CurLanguage.GetMsg("MSG_13"); //AddToStatusAsync(string.Format(strtmp, errInfo)); AddToStatusAsync(errInfo); FormatConvert.SoundError(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } Cursor.Current = Cursors.Default; }
/// <summary> /// Set Read Value /// </summary> private void SetOK() { string strq = tvQValue.Text; if (strq == "") { strq = "8"; } else if (strq == "0") { strq = "1"; } RfidConfig.QValue = Convert.ToUInt16(strq); if (chkCharMode.Enabled) { RfidConfig.RfidModule = chkCharMode.SelectedIndex + 1; //1:Internal,2:Extern if (RfidConfig.RfidModule == 1) { RfidControl.SwitchRfid(RfidControl.RFIDModuleFlag.Internal); } else { RfidControl.SwitchRfid(RfidControl.RFIDModuleFlag.Extern); } } SetRssiStatus(chkRssi.Checked); string err = ""; try { ushort ival = 30; ival = Convert.ToUInt16(tvScanInterval.Text); if (ival < 30) { ival = 30; } else if (ival > 255) { ival = 255; } RfidConfig.SetScanInterval(ival, out err); } catch { } try { ushort tidlen = Convert.ToUInt16(tvDefaultTidLength.Text); if (RfidConfig.SetDefualtTidLength(tidlen, out err)) { RfidConfig.TidLength = tidlen; } } catch { } FormatConvert.SoundSucceed(); DialogResult = DialogResult.Yes; Close(); }