public override string getProcessedData(object inData)
        {
            string value = null;

            if (inData != null && (string)inData != "ok")
            {
                value = Rmu900RFIDHelper.GetEPCFormUII((string)inData);
            }
            return(value);
        }
 public string ChekcInventoryOnce()
 {
     foreach (RFIDEventArg a in this.returned_commmand_list)
     {
         if (a._type == RFIDEventType.RMU_InventorySingle && ((string)a._arg) != string.Empty)
         {
             return(Rmu900RFIDHelper.GetEPCFormUII(a._arg as string));
         }
     }
     return(string.Empty);
 }
        public void StartWriteEpc(string epc)
        {
            List <string> commands = Rmu900RFIDHelper.RmuWriteDataCommandCompose(RMU_CommandType.RMU_SingleWriteData,
                                                                                 null,
                                                                                 1,
                                                                                 2,
                                                                                 epc,
                                                                                 null);

            this.SendCommand(commands);
        }
Beispiel #4
0
        /// <summary>
        /// 锁定保留内存、epc存储器和tid存储器
        /// </summary>
        public void RmuLockTagReserverdEpcTid(string pwd, string uii)
        {
            if (null == pwd || uii == null)
            {
                return;
            }
            string lockCommand = null;

            lockCommand = Rmu900RFIDHelper.RmuLockCommandComposer(RMU_CommandType.RMU_LockMem,
                                                                  pwd, "0ffeac", uii);
            if (null != lockCommand)
            {
                SendCommand(lockCommand, RFIDEventType.RMU_LockMem);
            }
        }
Beispiel #5
0
        public static string RmuLockCommandComposer(RMU_CommandType type, string pwd, string lockData, string uii)
        {
            string strCommand = "";

            if (type != RMU_CommandType.RMU_LockMem ||
                lockData == null ||
                uii == null)
            {
                return(null);
            }
            pwd = Rmu900RFIDHelper.PwdCheck(pwd);
            int nLen = 1 + 1 + 4 + 3 + 14;

            strCommand = "aa" + nLen.ToString("X2") + "16" + pwd + lockData + uii + "55";
            return(strCommand);
        }
        public string CheckInventory()
        {
            string r = string.Empty;

            foreach (RFIDEventArg a in this.returned_commmand_list)
            {
                if (a._type == RFIDEventType.RMU_Inventory && ((string)a._arg) != string.Empty)
                {
                    r = Rmu900RFIDHelper.GetEPCFormUII(a._arg as string);
                    break;
                }
            }
            this.returned_commmand_list.Clear();

            return(r);
        }
Beispiel #7
0
        public Form1()
        {
            InitializeComponent();
            string strPortName = "com25";

            this.comboBox1.Items.Clear();
            this.comboBox1.Items.Add("RMU900");
            this.comboBox1.Items.Add("2600");
            this.comboBox1.SelectedIndex = 0;
            dataTransfer = new SerialPortDataTransfer();
            comport      = new SerialPort(strPortName, 57600, Parity.None, 8, StopBits.One);
            ((SerialPortDataTransfer)dataTransfer).Comport = comport;
            rmu900Helper = new Rmu900RFIDHelper(dataTransfer);
            rmu900Helper.Subscribe(this);
            dataTransfer.AddParser(rmu900Helper);

            this.label2.Text = "当前使用的端口为 " + strPortName;
        }
        public void setEPC(string epc)
        {
            this.epc         = epc;
            this.nextCommand =
                Rmu900RFIDHelper.RmuWriteDataCommandCompose(RMU_CommandType.RMU_SingleWriteData,
                                                            null,
                                                            1,
                                                            2,
                                                            this.epc,
                                                            null);
            //这里因为不需要在命令里面注明要写入数据的标签的UII,因此可以把所有写入命令
            //放到一个字符串里面一次写入
            string strCommand = string.Empty;

            foreach (string s in this.nextCommand)
            {
                strCommand += s;
            }
            this.nextCommand.Clear();
            this.nextCommand.Add(strCommand);
        }
        public operateActionRmu900InventoryWriteEpc(string epc)
        {
            this.epc         = epc;
            this.invokeEvent = RFIDEventType.RMU_CardIsReady;
            this.nextCommand =
                Rmu900RFIDHelper.RmuWriteDataCommandCompose(RMU_CommandType.RMU_SingleWriteData,
                                                            null,
                                                            1,
                                                            2,
                                                            this.epc,
                                                            null);
            //这里因为不需要在命令里面注明要写入数据的标签的UII,因此可以把所有写入命令
            //放到一个字符串里面一次写入
            string strCommand = string.Empty;

            foreach (string s in this.nextCommand)
            {
                strCommand += s;
            }
            this.nextCommand.Clear();
            this.nextCommand.Add(strCommand);
            this.nextCommandType = RFIDEventType.RMU_SingleWriteData;
            this.exceptionMsg    = "写入标签异常";
        }
Beispiel #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="commandtype"></param>
        /// <param name="strPwd_in">4位</param>
        /// <param name="strBank_in"></param>
        /// <param name="nAddress"></param>
        /// <param name="strUii"></param>
        /// <returns></returns>
        public static string RmuReadDataCommandComposer(RMU_CommandType commandtype
                                                        , string strPwd_in,
                                                        int Bank_in,
                                                        int nAddress,
                                                        int nCount,
                                                        string strUii)
        {
            string commandR = null;

            if (!Enum.IsDefined(typeof(RMU_CommandType), commandtype.ToString()))
            {
                return(commandR);
            }
            if (Bank_in < 0 || nAddress < 0 || nCount <= 0)
            {
                return(commandR);
            }
            strPwd_in = Rmu900RFIDHelper.PwdCheck(strPwd_in);
            switch ((int)commandtype)
            {
            case (int)RMU_CommandType.RMU_SingleReadData:

                commandR = "aa0920" + strPwd_in + Bank_in.ToString("X2") + nAddress.ToString("X2") + nCount.ToString("X2") + "55";
                break;

            case (int)RMU_CommandType.RMU_ReadData:
                if (null == strUii || !Regex.IsMatch(strUii, "[0-9a-zA-Z]{14}"))
                {
                    return(commandR);
                }
                int nLength = 1 + 1 + 4 + 1 + 1 + 1 + 14;
                commandR = "aa" + nLength.ToString("X2") + "13" + strPwd_in + Bank_in.ToString("X2") + nAddress.ToString("X2") + nCount.ToString("X2") + strUii + "55";
                break;
            }
            return(commandR);
        }
Beispiel #11
0
        /// <summary>
        /// 将传入的参数组合成命令字符串
        /// </summary>
        /// <param name="strRmuCmd_in"></param>
        /// <param name="strPwd_in"></param>
        /// <param name="strBank_in"></param>
        /// <param name="nAddress"></param>
        /// <param name="strData_in"></param>
        /// <param name="strUii"></param>
        /// <returns>返回的命令可能有0或者多个,调用者应对返回值做检查</returns>
        public static List <string> RmuWriteDataCommandCompose(RMU_CommandType commandType
                                                               , string strPwd_in
                                                               , int Bank_in
                                                               , int nAddress
                                                               , string strData_in
                                                               , string strUii)
        {
            List <string> commandList = new List <string>();

            if (!Enum.IsDefined(typeof(RMU_CommandType), commandType.ToString()))
            {
                return(commandList);
            }
            if (Bank_in < 0 || nAddress < 0)
            {
                return(commandList);
            }

            strPwd_in = Rmu900RFIDHelper.PwdCheck(strPwd_in);

            for (int i = 0; i < strData_in.Length; i += 4, nAddress++)
            {
                string strAddress_in = nAddress.ToString("X2");
                string strData2Send  = strData_in.Substring(i, 4);
                string strCmd        = "aa";

                int nLength = 0;                     // 命令长度,以byte计算
                nLength = 1 + 1 + 4 + 1 + 1 + 1 + 2; // length +cmd +pwd + bank + address + cnt + data len
                switch ((int)commandType)
                {
                case (int)RMU_CommandType.RMU_SingleWriteData:
                    strCmd += "21";
                    break;

                case (int)RMU_CommandType.RMU_WriteData:
                {
                    if (null == strUii)
                    {
                        return(commandList);
                    }
                    nLength += 14;        // strUii.Length / 2;// 加上uii的长度
                    strCmd  += "14";
                }
                break;
                }
                strCmd = strCmd.Insert(2, nLength.ToString("X2"));
                //strCmd += nLength.ToString("X2");
                //strCmd += commandType;

                strCmd += strPwd_in;
                strCmd += Bank_in.ToString("X2");
                strCmd += strAddress_in;
                strCmd += "01";                                   //目前硬件只支持 1
                strCmd += strData2Send;
                if (commandType == RMU_CommandType.RMU_WriteData) //指定UII
                {
                    strCmd += strUii;
                }
                strCmd += "55";
                commandList.Add(strCmd);
            }
            return(commandList);
        }