Пример #1
0
        public override string getProcessedData(object inData)
        {
            string value = null;

            if (inData != null && (string)inData != "ok")
            {
                value = RFIDHelper.GetEPCFormUII((string)inData);
            }
            return(value);
        }
Пример #2
0
 public void setEPC(string epc)
 {
     this.epc         = epc;
     this.nextCommand =
         RFIDHelper.RmuWriteDataCommandCompose(RMU_CommandType.RMU_SingleWriteData,
                                               null,
                                               1,
                                               2,
                                               this.epc,
                                               null);
 }
Пример #3
0
 public operateActionInventoryWriteEpc(string epc)
 {
     this.epc         = epc;
     this.invokeEvent = RFIDEventType.RMU_CardIsReady;
     this.nextCommand =
         RFIDHelper.RmuWriteDataCommandCompose(RMU_CommandType.RMU_SingleWriteData,
                                               null,
                                               1,
                                               2,
                                               this.epc,
                                               null);
     this.nextCommandType = RFIDEventType.RMU_SingleWriteData;
     this.exceptionMsg    = "写入标签异常";
 }
Пример #4
0
        /// <summary>
        /// 锁定保留内存、epc存储器和tid存储器
        /// </summary>
        public void RmuLockTagReserverdEpcTid(string pwd, string uii)
        {
            if (null == pwd || uii == null)
            {
                return;
            }
            string lockCommand = null;

            lockCommand = RFIDHelper.RmuLockCommandComposer(RMU_CommandType.RMU_LockMem,
                                                            pwd, "0ffeac", uii);
            if (null != lockCommand)
            {
                SendCommand(lockCommand, RFIDEventType.RMU_LockMem);
            }
        }
Пример #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 = RFIDHelper.PwdCheck(pwd);
            int nLen = 1 + 1 + 4 + 3 + 14;

            strCommand = "aa" + nLen.ToString("X2") + "16" + pwd + lockData + uii + "55";
            return(strCommand);
        }
Пример #6
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 = RFIDHelper.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);
        }
Пример #7
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 = RFIDHelper.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);
        }