コード例 #1
0
        /// <summary>
        /// ReadEpc
        /// </summary>
        private void ReadEpc()
        {
            byte[] tagEpc = null;
            byte[] data;
            string strerr;

            TagOperation.RfidConnecte();
            if (TagOperation.ReadEpc(tagEpc, selCodeArea, 1, out data, out strerr))
            {
                tagEpc = data;
                string epc = Util.ConvertByteArrayToHexWordString(data);
                for (int i = 0; i < tvEpcData.Items.Count; i++)
                {
                    if (epc == tvEpcData.Items[i].ToString())
                    {
                        FormatConvert.SoundSucceed();
                        return;
                    }
                }
                tvEpcData.Items.Add(epc);
                this.tvEpcData.Text = epc;
                AddToStatusAsync("");
                FormatConvert.SoundSucceed();
            }
            else
            {
                AddToStatusAsync("Read failure," + strerr);
                FormatConvert.SoundError();
            }
        }
コード例 #2
0
ファイル: FrWriteTags.cs プロジェクト: Elielo03/InvengoApp
        /// <summary>
        /// Read Tag Data
        /// </summary>
        private void UiReadData()
        {
            this.lblStatus.Text = "";
            //byte[] selCode = null;
            byte[] data    = null;
            string strerr  = null;
            int    _offset = 0;
            int    _length = 28;
            string errinfo;

            if (rbEpc.Checked)
            {
                if (TagOperation.ReadEpc(tagID, selCodeArea, 1, out data, out strerr))
                {
                    this.tvDataMemo.Text = Util.ConvertByteArrayToHexWordString(data);
                    FormatConvert.SoundSucceed();
                }
                else
                {
                    errinfo = string.Format("Read failure,{0}", strerr);
                    AddToStatusAsync(errinfo);
                    FormatConvert.SoundError();
                }
            }
            else if (rbTid.Checked)
            {
                if (TagOperation.ReadTID(tagID, selCodeArea, 1, out data, out strerr))
                {
                    tagID = data;
                    string tid = Util.ConvertByteArrayToHexWordString(data);
                    for (int i = 0; i < cbtid.Items.Count; i++)
                    {
                        if (tid == cbtid.Items[i].ToString())
                        {
                            this.tvDataMemo.Text = "";
                            FormatConvert.SoundSucceed();
                            return;
                        }
                    }
                    cbtid.Items.Add(tid);
                    this.cbtid.Text      = tid;
                    this.tvDataMemo.Text = "";
                    FormatConvert.SoundSucceed();
                }
                else
                {
                    errinfo = string.Format("Read failure,{0}", strerr);
                    AddToStatusAsync(errinfo);
                    FormatConvert.SoundError();
                }
            }
            else
            {
                if (TagOperation.ReadUserdata_6C((ushort)_offset, (ushort)_length, tagID, selCodeArea, out data, out strerr))
                {
                    this.tvDataMemo.Text = Util.ConvertByteArrayToHexWordString(data);
                    FormatConvert.SoundSucceed();
                }
                else
                {
                    errinfo = string.Format("Read failure,{0}", strerr);
                    AddToStatusAsync(errinfo);
                    FormatConvert.SoundError();
                }
            }
        }