Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int rdur = 0;
            int sdur = 0;

            frm1.rParms.isUniByEmd    = this.cbisunibynullemd.Checked;
            frm1.rParms.isChangeColor = this.cbischgcolor.Checked;
            frm1.rParms.isUniByAnt    = this.cbisunibyant.Checked;
            try
            {
                rdur = int.Parse(this.tbreaddur.Text.Trim());
                sdur = int.Parse(this.tbsleepdur.Text.Trim());
            }
            catch (Exception ex)
            {
                MessageBox.Show("Inventory duration and interval must be numbers in millisecond");
                return;
            }

            frm1.rParms.readdur      = rdur;
            frm1.rParms.sleepdur     = sdur;
            frm1.rParms.isRevertAnts = this.cbisrevertants.Checked;
            if (this.cbisOneReadOneTime.Checked)
            {
                frm1.rParms.isOneReadOneTime = true;
            }
            else
            {
                frm1.rParms.isOneReadOneTime = false;
            }

            if (this.cbisReadFixCount.Checked)
            {
                if (this.tbReadCount.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("please input inventory count");
                    return;
                }
                try
                {
                    frm1.rParms.FixReadCount = int.Parse(this.tbReadCount.Text.Trim());
                }
                catch (System.Exception ere)
                {
                    MessageBox.Show(ere.ToString());
                    return;
                }
                if (frm1.rParms.FixReadCount <= 0)
                {
                    MessageBox.Show("inventory count must be more than zero");
                    return;
                }
                frm1.rParms.isReadFixCount = true;
            }
            else
            {
                frm1.rParms.isReadFixCount = false;
                frm1.rParms.FixReadCount   = 0;
            }

            if (this.cbisfilter.Checked)
            {
                int ret = Form1.IsValidBinaryStr(this.tbfilterdata.Text.Trim());
                switch (ret)
                {
                case -3:
                    MessageBox.Show("please input data for match");
                    break;

                case -1:
                    MessageBox.Show("match data must be binary string");
                    break;
                }

                if (ret != 0)
                {
                    return;
                }
                if (this.cbbfilterbank.SelectedIndex == -1)
                {
                    MessageBox.Show("please select filter bank");
                    return;
                }

                if (this.cbbfilterrule.SelectedIndex == -1)
                {
                    MessageBox.Show("please select filter rule");
                    return;
                }

                int bitaddr = 0;
                if (this.tbfilteraddr.Text.Trim() == "")
                {
                    MessageBox.Show("please input starting address in bit");
                    return;
                }
                else
                {
                    try
                    {
                        bitaddr = int.Parse(this.tbfilteraddr.Text.Trim());
                    }
                    catch (Exception exc)
                    {
                        MessageBox.Show("starting address must be number");
                        return;
                    }
                    if (bitaddr < 0)
                    {
                        MessageBox.Show("starting address must be more than zero");
                        return;
                    }
                }

                byte[] filterbytes = new byte[(this.tbfilterdata.Text.Trim().Length - 1) / 8 + 1];
                for (int c = 0; c < filterbytes.Length; ++c)
                {
                    filterbytes[c] = 0;
                }

                int bitcnt = 0;
                foreach (Char ch in this.tbfilterdata.Text.Trim())
                {
                    if (ch == '1')
                    {
                        filterbytes[bitcnt / 8] |= (byte)(0x01 << (7 - bitcnt % 8));
                    }
                    bitcnt++;
                }

                Gen2TagFilter filter = new Gen2TagFilter(this.tbfilterdata.Text.Trim().Length, filterbytes,
                                                         (MemBank)this.cbbfilterbank.SelectedIndex + 1, bitaddr,
                                                         this.cbbfilterrule.SelectedIndex == 0 ? false : true);
                frm1.modulerdr.ParamSet("Singulation", filter);
            }
            else
            {
                frm1.modulerdr.ParamSet("Singulation", null);
            }


            if (!(frm1.rParms.readertype == ReaderType.PR_ONEANT || frm1.modulerdr.HwDetails.module == Reader.Module_Type.MODOULE_R902_MT100))
            {
                if (this.cbisaddiondata.Checked)
                {
                    int wordaddr = 0;
                    int ebbytescnt;

                    if (this.tbebstartaddr.Text.Trim() == "")
                    {
                        MessageBox.Show("please input starting address of embedded data bank in word");
                        return;
                    }
                    else
                    {
                        try
                        {
                            wordaddr = int.Parse(this.tbebstartaddr.Text.Trim());
                        }
                        catch (Exception exc)
                        {
                            MessageBox.Show("starting address must be number");
                            return;
                        }
                        if (wordaddr < 0)
                        {
                            MessageBox.Show("starting address must be more than zero");
                            return;
                        }
                    }

                    if (this.tbebbytescnt.Text.Trim() == "")
                    {
                        MessageBox.Show("please input starting address of embedded data bank in word");
                        return;
                    }
                    else
                    {
                        try
                        {
                            ebbytescnt = int.Parse(this.tbebbytescnt.Text.Trim());
                        }
                        catch (Exception exc)
                        {
                            MessageBox.Show("the byte count to read of embedded data must be number");
                            return;
                        }
                        if (ebbytescnt < 0 || ebbytescnt > 32)
                        {
                            MessageBox.Show("the byte count to read of embedded data must be in the range of 0-33");
                            return;
                        }
                    }


                    if (this.cbbebbank.SelectedIndex == -1)
                    {
                        MessageBox.Show("please select bank of embedded data");
                        return;
                    }

                    EmbededCmdData ecd = new EmbededCmdData((MemBank)this.cbbebbank.SelectedIndex, (UInt32)wordaddr,
                                                            (byte)ebbytescnt);

                    frm1.modulerdr.ParamSet("EmbededCmdOfInventory", ecd);
                }
                else
                {
                    frm1.modulerdr.ParamSet("EmbededCmdOfInventory", null);
                }


                if (this.cbispwd.Checked)
                {
                    int ret = Form1.IsValidPasswd(this.tbacspwd.Text.Trim());
                    {
                        switch (ret)
                        {
                        case -3:
                            MessageBox.Show("please input access password");
                            break;

                        case -2:
                        case -4:
                            MessageBox.Show("access password must be 8 of hexadecimal numbers");
                            break;

                        case -1:
                            MessageBox.Show("access password must be 8 of hexadecimal numbers");
                            break;
                        }
                    }
                    if (ret != 0)
                    {
                        return;
                    }
                    else
                    {
                        uint passwd = uint.Parse(this.tbacspwd.Text.Trim(), System.Globalization.NumberStyles.AllowHexSpecifier);
                        frm1.modulerdr.ParamSet("AccessPassword", passwd);
                    }
                }
                else
                {
                    frm1.modulerdr.ParamSet("AccessPassword", (uint)0);
                }
            }

            this.Close();
        }
Пример #2
0
        private void btnResetReadProtect_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;
                }
            }

            byte[] pwd = null;

            ret = Form1.IsValidPasswd(this.tbaccesspasswd.Text.Trim());
            {
                switch (ret)
                {
                case -3:
                    MessageBox.Show("please input access password");
                    break;

                case -2:
                case -4:
                    MessageBox.Show("access password must be 8 of hexadecimal numbers");
                    break;

                case -1:
                    MessageBox.Show("access password must be 8 of hexadecimal numbers");
                    break;
                }
            }
            if (ret != 0)
            {
                return;
            }
            else
            {
                pwd = ByteFormat.FromHex(this.tbaccesspasswd.Text.Trim());
            }

            Gen2TagFilter filter = null;

            if (checkfilter(ref filter) != 0)
            {
                return;
            }

            try
            {
                NXP_ResetReadProtectPara para = new NXP_ResetReadProtectPara(pwd);
                mrdr.CustomCmd(filter, CustomCmdType.NXP_ResetReadProtect, para);
            }
            catch (OpFaidedException notagexp)
            {
                if (notagexp.ErrCode == 0x400)
                {
                    MessageBox.Show("no tag");
                }
                else
                {
                    MessageBox.Show("operation failed:" + notagexp.ToString());
                }

                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show("operation failed:" + ex.ToString());
                return;
            }
        }
Пример #3
0
        private void btnsetimpinjqt_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;
                }
            }

            byte[] pwd = null;

            ret = Form1.IsValidPasswd(this.tbaccesspasswd.Text.Trim());
            {
                switch (ret)
                {
                case -3:
                    MessageBox.Show("please input access password");
                    break;

                case -2:
                case -4:
                    MessageBox.Show("access password must be 8 of hexadecimal numbers");
                    break;

                case -1:
                    MessageBox.Show("access password must be 8 of hexadecimal numbers");
                    break;
                }
            }
            if (ret != 0)
            {
                return;
            }
            else
            {
                pwd = ByteFormat.FromHex(this.tbaccesspasswd.Text.Trim());
            }

            Gen2TagFilter filter = null;

            if (checkfilter(ref filter) != 0)
            {
                return;
            }

            if ((!this.rbimpinjqtread.Checked) && (!this.rbimpinjwrite.Checked))
            {
                MessageBox.Show("please select command type");
                return;
            }

            try
            {
                if (this.rbimpinjqtread.Checked)
                {
                    IMPINJ_M4_QtPara para = new IMPINJ_M4_QtPara(pwd);

                    IMPINJ_M4_QtResult qtret = (IMPINJ_M4_QtResult)mrdr.CustomCmd(filter, CustomCmdType.IMPINJ_M4_Qt, para);
                    if (qtret.MemType == IMPINJ_M4_QtPara.IMPINJ_Qt_Mem_Type.IMPINJ_Qt_Mem_Private)
                    {
                        this.rbimpinjqtmemprivate.Checked = true;
                    }
                    else
                    {
                        this.rbimpinjqtmempublic.Checked = true;
                    }
                    if (qtret.RangeType == IMPINJ_M4_QtPara.IMPINJ_Qt_Range_Type.IMPINJ_Qt_Range_FarField)
                    {
                        this.rbimpinjqtfarfield.Checked = true;
                    }
                    else
                    {
                        this.rbimpinjqtnearfiled.Checked = true;
                    }
                }
                else
                {
                    if ((!rbimpinjqtnearfiled.Checked) && (!rbimpinjqtfarfield.Checked))
                    {
                        MessageBox.Show("please select reading distance");
                        return;
                    }
                    if ((!rbimpinjqtmemprivate.Checked) && (!rbimpinjqtmempublic.Checked))
                    {
                        MessageBox.Show("please select memory profile");
                        return;
                    }
                    if ((!rbimpinjqtperm.Checked) && (!rbimpinjqttemp.Checked))
                    {
                        MessageBox.Show("please select persistence type");
                        return;
                    }

                    IMPINJ_M4_QtPara.IMPINJ_Qt_Range_Type   trange   = IMPINJ_M4_QtPara.IMPINJ_Qt_Range_Type.IMPINJ_Qt_Range_Invalid;
                    IMPINJ_M4_QtPara.IMPINJ_Qt_Persist_Type tpersist = IMPINJ_M4_QtPara.IMPINJ_Qt_Persist_Type.IMPINJ_Qt_Persist_Invalid;
                    IMPINJ_M4_QtPara.IMPINJ_Qt_Mem_Type     tmem     = IMPINJ_M4_QtPara.IMPINJ_Qt_Mem_Type.IMPINJ_Qt_Mem_Invalid;

                    if (rbimpinjqtnearfiled.Checked)
                    {
                        trange = IMPINJ_M4_QtPara.IMPINJ_Qt_Range_Type.IMPINJ_Qt_Range_NearField;
                    }
                    else
                    {
                        trange = IMPINJ_M4_QtPara.IMPINJ_Qt_Range_Type.IMPINJ_Qt_Range_FarField;
                    }
                    if (rbimpinjqtmemprivate.Checked)
                    {
                        tmem = IMPINJ_M4_QtPara.IMPINJ_Qt_Mem_Type.IMPINJ_Qt_Mem_Private;
                    }
                    else
                    {
                        tmem = IMPINJ_M4_QtPara.IMPINJ_Qt_Mem_Type.IMPINJ_Qt_Mem_Public;
                    }
                    if (rbimpinjqtperm.Checked)
                    {
                        tpersist = IMPINJ_M4_QtPara.IMPINJ_Qt_Persist_Type.IMPINJ_Qt_Persist_Perm;
                    }
                    else
                    {
                        tpersist = IMPINJ_M4_QtPara.IMPINJ_Qt_Persist_Type.IMPINJ_Qt_Persist_Temp;
                    }

                    IMPINJ_M4_QtPara para = new IMPINJ_M4_QtPara(pwd, tpersist, trange, tmem);
                    mrdr.CustomCmd(filter, CustomCmdType.IMPINJ_M4_Qt, para);
                }
            }
            catch (OpFaidedException notagexp)
            {
                if (notagexp.ErrCode == 0x400)
                {
                    MessageBox.Show("no tag");
                }
                else
                {
                    MessageBox.Show("operation failed:" + notagexp.ToString());
                }

                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show("operation failed:" + ex.ToString());
                return;
            }
        }
Пример #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            int rdur = 0;
            int sdur = 0;

            //added on 3-26
            if (this.cbisidtant.Checked)
            {
                if ((!this.rbidtantbydur.Checked) && (!this.rbidtantafter.Checked))
                {
                    MessageBox.Show("请选择判决模式");
                    return;
                }
                if (this.rbidtantbydur.Checked)
                {
                    if (this.tbidtdur.Text.Trim() == string.Empty)
                    {
                        MessageBox.Show("请输入判决时间");
                        return;
                    }
                    try
                    {
                        int pjsj = int.Parse(this.tbidtdur.Text.Trim());
                        if (pjsj <= 0)
                        {
                            MessageBox.Show("判决时间必须大于0");
                            return;
                        }
                    }
                    catch
                    {
                        MessageBox.Show("判决时间必须大于0");
                        return;
                    }
                }
                if (this.rbidtantafter.Checked)
                {
                    if (this.tbafttime.Text.Trim() == string.Empty)
                    {
                        MessageBox.Show("请输入等待时间");
                        return;
                    }
                    try
                    {
                        int ddsj = int.Parse(this.tbafttime.Text.Trim());
                        if (ddsj <= 0)
                        {
                            MessageBox.Show("等待时间必须大于0");
                            return;
                        }
                    }
                    catch
                    {
                        MessageBox.Show("等待时间必须大于0");
                        return;
                    }
                }
            }

            frm1.rParms.isUniByEmd    = this.cbisunibynullemd.Checked;
            frm1.rParms.isChangeColor = this.cbischgcolor.Checked;
            frm1.rParms.isUniByAnt    = this.cbisunibyant.Checked;
            try
            {
                rdur = int.Parse(this.tbreaddur.Text.Trim());
                sdur = int.Parse(this.tbsleepdur.Text.Trim());
            }
            catch (Exception ex)
            {
                MessageBox.Show("读时长和读间隔只能输入整数,单位为毫秒");
                return;
            }

            frm1.rParms.readdur      = rdur;
            frm1.rParms.sleepdur     = sdur;
            frm1.rParms.isRevertAnts = this.cbisrevertants.Checked;
            if (this.cbisOneReadOneTime.Checked)
            {
                frm1.rParms.isOneReadOneTime = true;
            }
            else
            {
                frm1.rParms.isOneReadOneTime = false;
            }

            if (this.cbisReadFixCount.Checked)
            {
                if (this.tbReadCount.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("请输入固定读次数");
                    return;
                }
                try
                {
                    frm1.rParms.FixReadCount = int.Parse(this.tbReadCount.Text.Trim());
                }
                catch (System.Exception ere)
                {
                    MessageBox.Show(ere.ToString());
                    return;
                }
                if (frm1.rParms.FixReadCount <= 0)
                {
                    MessageBox.Show("读次数必须大于0");
                    return;
                }
                frm1.rParms.isReadFixCount = true;
            }
            else
            {
                frm1.rParms.isReadFixCount = false;
                frm1.rParms.FixReadCount   = 0;
            }

            if (this.cbisfilter.Checked)
            {
                int ret = Form1.IsValidBinaryStr(this.tbfilterdata.Text.Trim());
                switch (ret)
                {
                case -3:
                    MessageBox.Show("匹配数据不能为空");
                    break;

                case -1:
                    MessageBox.Show("匹配数据只能是二进制字符串");
                    break;
                }

                if (ret != 0)
                {
                    return;
                }
                if (this.cbbfilterbank.SelectedIndex == -1)
                {
                    MessageBox.Show("请选择过滤bank");
                    return;
                }

                if (this.cbbfilterrule.SelectedIndex == -1)
                {
                    MessageBox.Show("请输入过滤规则");
                    return;
                }

                int bitaddr = 0;
                if (this.tbfilteraddr.Text.Trim() == "")
                {
                    MessageBox.Show("请输入过滤bank的起始地址,以字为最小单位");
                    return;
                }
                else
                {
                    try
                    {
                        bitaddr = int.Parse(this.tbfilteraddr.Text.Trim());
                    }
                    catch (Exception exc)
                    {
                        MessageBox.Show("起始地址请输入数字");
                        return;
                    }
                    if (bitaddr < 0)
                    {
                        MessageBox.Show("地址必须大于零");
                        return;
                    }
                }

                byte[] filterbytes = new byte[(this.tbfilterdata.Text.Trim().Length - 1) / 8 + 1];
                for (int c = 0; c < filterbytes.Length; ++c)
                {
                    filterbytes[c] = 0;
                }

                int bitcnt = 0;
                foreach (Char ch in this.tbfilterdata.Text.Trim())
                {
                    if (ch == '1')
                    {
                        filterbytes[bitcnt / 8] |= (byte)(0x01 << (7 - bitcnt % 8));
                    }
                    bitcnt++;
                }

                Gen2TagFilter filter = new Gen2TagFilter(this.tbfilterdata.Text.Trim().Length, filterbytes,
                                                         (MemBank)this.cbbfilterbank.SelectedIndex + 1, bitaddr,
                                                         this.cbbfilterrule.SelectedIndex == 0 ? false : true);
                frm1.modulerdr.ParamSet("Singulation", filter);
            }
            else
            {
                frm1.modulerdr.ParamSet("Singulation", null);
            }

            //|| frm1.modulerdr.HwDetails.module == Reader.Module_Type.MODOULE_R902_MT100
            if (!(frm1.rParms.readertype == ReaderType.PR_ONEANT))
            {
                if (this.cbisaddiondata.Checked)
                {
                    int wordaddr = 0;
                    int ebbytescnt;

                    if (this.tbebstartaddr.Text.Trim() == "")
                    {
                        MessageBox.Show("请输入附加数据bank的起始地址,以字为最小单位");
                        return;
                    }
                    else
                    {
                        try
                        {
                            wordaddr = int.Parse(this.tbebstartaddr.Text.Trim());
                        }
                        catch (Exception exc)
                        {
                            MessageBox.Show("起始地址请输入数字");
                            return;
                        }
                        if (wordaddr < 0)
                        {
                            MessageBox.Show("地址必须大于零");
                            return;
                        }
                    }

                    if (this.tbebbytescnt.Text.Trim() == "")
                    {
                        MessageBox.Show("请输入附加数据bank的起始地址,以字为最小单位");
                        return;
                    }
                    else
                    {
                        try
                        {
                            ebbytescnt = int.Parse(this.tbebbytescnt.Text.Trim());
                        }
                        catch (Exception exc)
                        {
                            MessageBox.Show("附加数据字节数请输入数字");
                            return;
                        }
                        if (ebbytescnt < 0 || ebbytescnt > 128)
                        {
                            MessageBox.Show("附加数据字节数必须大于零且小于等于128");
                            return;
                        }
                    }


                    if (this.cbbebbank.SelectedIndex == -1)
                    {
                        MessageBox.Show("请选择附加数据的bank");
                        return;
                    }

                    EmbededCmdData ecd = new EmbededCmdData((MemBank)this.cbbebbank.SelectedIndex, (UInt32)wordaddr,
                                                            (byte)ebbytescnt);


                    frm1.modulerdr.ParamSet("EmbededCmdOfInventory", ecd);
                }
                else
                {
                    frm1.modulerdr.ParamSet("EmbededCmdOfInventory", null);
                }


                if (this.cbispwd.Checked)
                {
                    int ret = Form1.IsValidPasswd(this.tbacspwd.Text.Trim());
                    {
                        switch (ret)
                        {
                        case -3:
                            MessageBox.Show("访问密码不能为空");
                            break;

                        case -2:
                        case -4:
                            MessageBox.Show("访问密码必须是8个16进制数");
                            break;

                        case -1:
                            MessageBox.Show("访问密码只能是16进制数字");
                            break;
                        }
                    }
                    if (ret != 0)
                    {
                        return;
                    }
                    else
                    {
                        uint passwd = uint.Parse(this.tbacspwd.Text.Trim(), System.Globalization.NumberStyles.AllowHexSpecifier);
                        frm1.modulerdr.ParamSet("AccessPassword", passwd);
                    }
                }
                else
                {
                    frm1.modulerdr.ParamSet("AccessPassword", (uint)0);
                }
                //     if (frm1.modulerdr.HwDetails.board != Reader.MaindBoard_Type.MAINBOARD_ARM9)
                //     {
                if (this.gbpotlweight.Enabled)
                {
                    if (this.tbwtgen2.Text.Trim() == string.Empty || this.tbwt180006b.Text.Trim() == string.Empty ||
                        this.tbwtipx256.Text.Trim() == string.Empty || this.tbwtipx64.Text.Trim() == string.Empty)
                    {
                        MessageBox.Show("请输入协议权重值");
                        return;
                    }
                    else
                    {
                        frm1.rParms.weight180006b = int.Parse(this.tbwt180006b.Text.Trim());
                        frm1.rParms.weightgen2    = int.Parse(this.tbwtgen2.Text.Trim());
                        frm1.rParms.weightipx256  = int.Parse(this.tbwtipx256.Text.Trim());
                        frm1.rParms.weightipx64   = int.Parse(this.tbwtipx64.Text.Trim());
                    }
                }

                if (this.gbsecureread.Enabled)
                {
                    if (this.cbissecureread.Checked)
                    {
                        uint srpwd          = 0;
                        int  srindexsbit    = 96;
                        int  srindexbitsnum = 8;
                        EmdSecureReadData.ESRD_TagType tagtype = EmdSecureReadData.ESRD_TagType.ESRD_TagType_None;

                        if (this.tbsraddress.Text.Trim() == string.Empty)
                        {
                            MessageBox.Show("请输入安全附加数据起始地址");
                            return;
                        }
                        if (this.tbsrblks.Text.Trim() == string.Empty)
                        {
                            MessageBox.Show("请输入安全附加数据读块数");
                            return;
                        }
                        if (this.cbbsrbank.SelectedIndex == -1)
                        {
                            MessageBox.Show("请选择安全附加数据bank");
                            return;
                        }
                        if (this.cbbsrpwdtype.SelectedIndex == -1)
                        {
                            MessageBox.Show("请选择密码类型");
                            return;
                        }
                        if (this.cbbsrpwdtype.SelectedIndex == 0)
                        {
                            if (this.tbsracspwd.Text.Trim() == string.Empty)
                            {
                                MessageBox.Show("请输入固定的访问密码");
                                return;
                            }
                            srpwd = uint.Parse(this.tbsracspwd.Text.Trim(), System.Globalization.NumberStyles.AllowHexSpecifier);
                        }
                        if (this.cbbsrpwdtype.SelectedIndex == 1)
                        {
                            if (this.tbsrindexstartbit.Text.Trim() == string.Empty)
                            {
                                MessageBox.Show("请输入索引起始 bit");
                                return;
                            }
                            srindexsbit = int.Parse(this.tbsrindexstartbit.Text.Trim());

                            if (this.tbindexbitsnum.Text.Trim() == string.Empty)
                            {
                                MessageBox.Show("请输入索引bit数");
                                return;
                            }
                            srindexbitsnum = int.Parse(this.tbindexbitsnum.Text.Trim());
                        }
                        if (this.cbbsrtagtype.SelectedIndex == -1)
                        {
                            MessageBox.Show("请选择标签类型");
                            return;
                        }
                        else if (this.cbbsrtagtype.SelectedIndex == 0)
                        {
                            tagtype = EmdSecureReadData.ESRD_TagType.ESRD_Alien_Higgs3;
                        }
                        else
                        {
                            tagtype = EmdSecureReadData.ESRD_TagType.ESRD_Impinj_M4;
                        }
                        EmdSecureReadData esrd = null;
                        if (this.cbbsrpwdtype.SelectedIndex == 0)
                        {
                            esrd = new EmdSecureReadData(tagtype,
                                                         (MemBank)this.cbbsrbank.SelectedIndex, int.Parse(this.tbsraddress.Text.Trim()),
                                                         int.Parse(this.tbsrblks.Text.Trim()), srpwd);
                        }
                        else
                        {
                            esrd = new EmdSecureReadData(tagtype,
                                                         srindexsbit, srindexbitsnum, (MemBank)this.cbbsrbank.SelectedIndex,
                                                         int.Parse(this.tbsraddress.Text.Trim()), int.Parse(this.tbsrblks.Text.Trim()));
                        }

                        frm1.modulerdr.ParamSet("EmdSecureDataOfInventory", esrd);
                    }
                    else
                    {
                        frm1.modulerdr.ParamSet("EmdSecureDataOfInventory", null);
                    }
                }
                //    }
            }

            //added on 3-26
            try
            {
                if (this.gbidentifyants.Enabled)
                {
                    if (this.cbisidtant.Checked)
                    {
                        frm1.rParms.isIdtAnts = true;
                        if (this.rbidtantbydur.Checked)
                        {
                            frm1.rParms.IdtAntsType = 1;
                            frm1.rParms.DurIdtval   = int.Parse(this.tbidtdur.Text.Trim());
                        }
                        else if (this.rbidtantafter.Checked)
                        {
                            frm1.rParms.IdtAntsType     = 2;
                            frm1.rParms.AfterIdtWaitval = int.Parse(this.tbafttime.Text.Trim());
                        }

                        frm1.modulerdr.ParamSet("IsTagdataRecordHighestRssi", true);
                        frm1.rParms.isUniByAnt = true;
                    }
                    else
                    {
                        frm1.modulerdr.ParamSet("IsTagdataRecordHighestRssi", false);
                        frm1.rParms.IdtAntsType = 0;
                        frm1.rParms.isUniByAnt  = this.cbisunibyant.Checked;
                        frm1.rParms.isIdtAnts   = false;
                    }
                }
            }
            catch (System.Exception ex)
            {
            }


            this.Close();
        }
Пример #5
0
        private void btnsetimpinjqt_Click(object sender, EventArgs e)
        {
            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;
                }
            }

            byte[] pwd = null;

            ret = Form1.IsValidPasswd(this.tbaccesspasswd.Text.Trim());
            {
                switch (ret)
                {
                case -3:
                    MessageBox.Show("访问密码不能为空");
                    break;

                case -2:
                case -4:
                    MessageBox.Show("访问密码必须是8个16进制数");
                    break;

                case -1:
                    MessageBox.Show("访问密码只能是16进制数字");
                    break;
                }
            }
            if (ret != 0)
            {
                return;
            }
            else
            {
                pwd = ByteFormat.FromHex(this.tbaccesspasswd.Text.Trim());
            }

            Gen2TagFilter filter = null;

            if (checkfilter(ref filter) != 0)
            {
                return;
            }

            if ((!this.rbimpinjqtread.Checked) && (!this.rbimpinjwrite.Checked))
            {
                MessageBox.Show("请选择命令类型");
                return;
            }

            try
            {
                if (this.rbimpinjqtread.Checked)
                {
                    IMPINJ_M4_QtPara para = new IMPINJ_M4_QtPara(pwd);

                    IMPINJ_M4_QtResult qtret = (IMPINJ_M4_QtResult)mrdr.CustomCmd(filter, CustomCmdType.IMPINJ_M4_Qt, para);
                    if (qtret.MemType == IMPINJ_M4_QtPara.IMPINJ_Qt_Mem_Type.IMPINJ_Qt_Mem_Private)
                    {
                        this.rbimpinjqtmemprivate.Checked = true;
                    }
                    else
                    {
                        this.rbimpinjqtmempublic.Checked = true;
                    }
                    if (qtret.RangeType == IMPINJ_M4_QtPara.IMPINJ_Qt_Range_Type.IMPINJ_Qt_Range_FarField)
                    {
                        this.rbimpinjqtfarfield.Checked = true;
                    }
                    else
                    {
                        this.rbimpinjqtnearfiled.Checked = true;
                    }
                }
                else
                {
                    if ((!rbimpinjqtnearfiled.Checked) && (!rbimpinjqtfarfield.Checked))
                    {
                        MessageBox.Show("请选择识别距离");
                        return;
                    }
                    if ((!rbimpinjqtmemprivate.Checked) && (!rbimpinjqtmempublic.Checked))
                    {
                        MessageBox.Show("请选择内存视图");
                        return;
                    }
                    if ((!rbimpinjqtperm.Checked) && (!rbimpinjqttemp.Checked))
                    {
                        MessageBox.Show("请选择状态类型");
                        return;
                    }

                    IMPINJ_M4_QtPara.IMPINJ_Qt_Range_Type   trange   = IMPINJ_M4_QtPara.IMPINJ_Qt_Range_Type.IMPINJ_Qt_Range_Invalid;
                    IMPINJ_M4_QtPara.IMPINJ_Qt_Persist_Type tpersist = IMPINJ_M4_QtPara.IMPINJ_Qt_Persist_Type.IMPINJ_Qt_Persist_Invalid;
                    IMPINJ_M4_QtPara.IMPINJ_Qt_Mem_Type     tmem     = IMPINJ_M4_QtPara.IMPINJ_Qt_Mem_Type.IMPINJ_Qt_Mem_Invalid;

                    if (rbimpinjqtnearfiled.Checked)
                    {
                        trange = IMPINJ_M4_QtPara.IMPINJ_Qt_Range_Type.IMPINJ_Qt_Range_NearField;
                    }
                    else
                    {
                        trange = IMPINJ_M4_QtPara.IMPINJ_Qt_Range_Type.IMPINJ_Qt_Range_FarField;
                    }
                    if (rbimpinjqtmemprivate.Checked)
                    {
                        tmem = IMPINJ_M4_QtPara.IMPINJ_Qt_Mem_Type.IMPINJ_Qt_Mem_Private;
                    }
                    else
                    {
                        tmem = IMPINJ_M4_QtPara.IMPINJ_Qt_Mem_Type.IMPINJ_Qt_Mem_Public;
                    }
                    if (rbimpinjqtperm.Checked)
                    {
                        tpersist = IMPINJ_M4_QtPara.IMPINJ_Qt_Persist_Type.IMPINJ_Qt_Persist_Perm;
                    }
                    else
                    {
                        tpersist = IMPINJ_M4_QtPara.IMPINJ_Qt_Persist_Type.IMPINJ_Qt_Persist_Temp;
                    }

                    IMPINJ_M4_QtPara para = new IMPINJ_M4_QtPara(pwd, tpersist, trange, tmem);
                    mrdr.CustomCmd(filter, CustomCmdType.IMPINJ_M4_Qt, para);
                }
            }
            catch (OpFaidedException notagexp)
            {
                if (notagexp.ErrCode == 0x400)
                {
                    MessageBox.Show("没法发现标签");
                }
                else
                {
                    MessageBox.Show("操作失败:" + notagexp.ToString());
                }

                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show("操作失败:" + ex.ToString());
                return;
            }
        }
Пример #6
0
        private void btnResetReadProtect_Click(object sender, EventArgs e)
        {
            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;
                }
            }

            byte[] pwd = null;

            ret = Form1.IsValidPasswd(this.tbaccesspasswd.Text.Trim());
            {
                switch (ret)
                {
                case -3:
                    MessageBox.Show("访问密码不能为空");
                    break;

                case -2:
                case -4:
                    MessageBox.Show("访问密码必须是8个16进制数");
                    break;

                case -1:
                    MessageBox.Show("访问密码只能是16进制数字");
                    break;
                }
            }
            if (ret != 0)
            {
                return;
            }
            else
            {
                pwd = ByteFormat.FromHex(this.tbaccesspasswd.Text.Trim());
            }

            Gen2TagFilter filter = null;

            if (checkfilter(ref filter) != 0)
            {
                return;
            }

            try
            {
                NXP_ResetReadProtectPara para = new NXP_ResetReadProtectPara(pwd);
                mrdr.CustomCmd(filter, CustomCmdType.NXP_ResetReadProtect, para);
            }
            catch (OpFaidedException notagexp)
            {
                if (notagexp.ErrCode == 0x400)
                {
                    MessageBox.Show("没法发现标签");
                }
                else
                {
                    MessageBox.Show("操作失败:" + notagexp.ToString());
                }

                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show("操作失败:" + ex.ToString());
                return;
            }
        }
Пример #7
0
        private void btnbrl_Click(object sender, EventArgs e)
        {
            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;
                }
            }

            byte[] pwd = null;

            ret = Form1.IsValidPasswd(this.tbaccesspasswd.Text.Trim());
            {
                switch (ret)
                {
                case -3:
                    MessageBox.Show("访问密码不能为空");
                    break;

                case -2:
                case -4:
                    MessageBox.Show("访问密码必须是8个16进制数");
                    break;

                case -1:
                    MessageBox.Show("访问密码只能是16进制数字");
                    break;
                }
            }
            if (ret != 0)
            {
                return;
            }
            else
            {
                pwd = ByteFormat.FromHex(this.tbaccesspasswd.Text.Trim());
            }

            byte bitmap = 0;

            if (cb1.Checked)
            {
                bitmap |= 1 << 7;
            }
            if (cb2.Checked)
            {
                bitmap |= 1 << 6;
            }
            if (cb3.Checked)
            {
                bitmap |= 1 << 5;
            }
            if (cb4.Checked)
            {
                bitmap |= 1 << 4;
            }
            if (cb5.Checked)
            {
                bitmap |= 1 << 3;
            }
            if (cb6.Checked)
            {
                bitmap |= 1 << 2;
            }
            if (cb7.Checked)
            {
                bitmap |= 1 << 1;
            }
            if (cb8.Checked)
            {
                bitmap |= 1 << 0;
            }

            Gen2TagFilter filter = null;

            if (checkfilter(ref filter) != 0)
            {
                return;
            }

            try
            {
                ALIEN_Higgs3_BlockReadLockPara para = new ALIEN_Higgs3_BlockReadLockPara(bitmap, pwd);
                mrdr.CustomCmd(filter, CustomCmdType.ALIEN_Higgs3_BlockReadLock, para);
            }
            catch (OpFaidedException notagexp)
            {
                if (notagexp.ErrCode == 0x400)
                {
                    MessageBox.Show("没法发现标签");
                }
                else
                {
                    MessageBox.Show("操作失败:" + notagexp.ToString());
                }

                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show("操作失败" + ex.ToString());
                return;
            }
        }
Пример #8
0
        private void btnChangeEAS_Click(object sender, EventArgs e)
        {
            int         ret;
            TagChipType nxpchiptype = TagChipType.TagChipType_None;

            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.rbEASset.Checked) && (!this.rbEASreset.Checked))
            {
                MessageBox.Show("请选择EAS状态");
                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;
                }
            }

            bool isSet = false;

            if (this.rbEASset.Checked)
            {
                isSet = true;
            }
            else
            {
                isSet = false;
            }

            byte [] pwd = null;

            ret = Form1.IsValidPasswd(this.tbaccesspasswd.Text.Trim());
            {
                switch (ret)
                {
                case -3:
                    MessageBox.Show("访问密码不能为空");
                    break;

                case -2:
                case -4:
                    MessageBox.Show("访问密码必须是8个16进制数");
                    break;

                case -1:
                    MessageBox.Show("访问密码只能是16进制数字");
                    break;
                }
            }
            if (ret != 0)
            {
                return;
            }
            else
            {
                pwd = ByteFormat.FromHex(this.tbaccesspasswd.Text.Trim());
            }
            Gen2TagFilter filter = null;

            if (checkfilter(ref filter) != 0)
            {
                return;
            }
            NXP_ChangeEASPara ChEasPara = new NXP_ChangeEASPara(pwd, isSet, nxpchiptype);

            try
            {
                mrdr.CustomCmd(filter, CustomCmdType.NXP_ChangeEAS, ChEasPara);
            }
            catch (OpFaidedException notagexp)
            {
                if (notagexp.ErrCode == 0x400)
                {
                    MessageBox.Show("没法发现标签");
                }
                else
                {
                    MessageBox.Show("操作失败:" + notagexp.ToString());
                }

                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show("ChangeEAS失败:" + ex.ToString());
                return;
            }
        }