コード例 #1
0
        protected void UiWriteUserdata_6B()
        {
            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));
                byte[] bwritedata = Util.ConvertHexStringToByteArray(strdata);
                byte[] bpwd       = Util.ConvertHexStringToByteArray(strpwd);
                string errInfo    = "";
                bool   ret        = false;
                ret = TagOperation.WriteUserdata_6B(selcode, offset, bwritedata, 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 = "Write failed, {0}";
                    AddToStatusAsync(string.Format(strtmp, errInfo));
                    FormatConvert.SoundError();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            Cursor.Current = Cursors.Default;
        }
コード例 #2
0
        /// <summary>
        /// Add To List
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddToList(object sender, EventArgs e)
        {
            if (lvCodes.Items.Count > 1000)
            {
                lvCodes.Items.Clear();
            }
            string msg    = (string)sender;
            bool   exists = false;

            foreach (ListViewItem lvi in lvCodes.Items)
            {
                if (lvi == null)
                {
                    continue;
                }
                if (msg == lvi.SubItems[2].Text)
                {
                    exists = true;
                    int ic = Convert.ToInt32(lvi.SubItems[1].Text);
                    ic += 1;
                    lvi.SubItems[1].Text = ic.ToString();
                    break;
                }
            }

            if (!exists)
            {
                n++;
                ListViewItem lvi = new ListViewItem(new string[] { n.ToString(), "1", msg });
                lvCodes.Items.Add(lvi);
                lvCodes.EnsureVisible(lvCodes.Items.Count - 1);
            }
            FormatConvert.SoundRecord();
        }
コード例 #3
0
ファイル: FrAntennaPower.cs プロジェクト: Elielo03/InvengoApp
        /// <summary>
        /// Get Power List
        /// </summary>
        private void GetAntennaPower()
        {
            byte[] powerlist = null;
            string errInfo   = "";

            if (TagOperation.GetAntennaPower(out powerlist, out errInfo))
            {
                if (powerlist != null && powerlist.Length > 0)
                {
                    int val   = powerlist[0];
                    int count = 0;
                    foreach (ComboBindData o in cbdbm.Items)
                    {
                        if (val == (int)o.ValueMember)
                        {
                            cbdbm.SelectedIndex = count;
                            break;
                        }
                        count++;
                    }
                    string strtmp   = "The Power is :{0} dBm.";
                    string strpower = string.Format(strtmp, _startpower + val);
                    AddToStatusAsync(strpower);
                    FormatConvert.SoundSucceed();
                }
            }
            else
            {
                AddToStatusAsync("Query failed," + errInfo);
            }
        }
コード例 #4
0
        private void SetOK()
        {
            string err = "";

            try
            {
                ushort tidlen = Convert.ToUInt16(tvDefaultTidLength.Text);

                if (!TagOperation.SetDefualtTidLength(tidlen, out err))
                {
                    this.lbmsg.Text = string.Format("Set Defualt Tid Length Failure,{0}!", err);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return;
            }

            try
            {
                ushort ival = 30;
                ival = Convert.ToUInt16(tvScanInterval.Text);

                if (ival < 0)
                {
                    ival = 0;
                }
                else if (ival > 255)
                {
                    ival = 255;
                }

                if (TagOperation.SetScanInterval(ival, out err))
                {
                    if (ival == 0)
                    {
                        TagOperation.SetLoopRead(out err);
                    }
                }
                else
                {
                    this.lbmsg.Text = this.lbmsg.Text + string.Format("Set Defualt Tid Length Failure,{0}!", err);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return;
            }
            if (err != "")
            {
                FormatConvert.SoundError(); return;
            }
            FormatConvert.SoundSucceed();
            Close();
        }
コード例 #5
0
        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;
        }
コード例 #6
0
        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;
        }
コード例 #7
0
        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;
        }
コード例 #8
0
        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;
        }
コード例 #9
0
        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;
        }
コード例 #10
0
ファイル: FrAntennaPower.cs プロジェクト: Elielo03/InvengoApp
        /// <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();
            }
        }
コード例 #11
0
ファイル: FrReadSet.cs プロジェクト: Elielo03/InvengoApp
        /// <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();
        }