Example #1
0
        protected ULAnticollInfo HandleULAnticollFrame(byte[] frame)
        {
            ULAnticollInfo info       = new ULAnticollInfo(frame);
            ReturnMessage  returnCode = CheckFrame(info);

            if (returnCode != ReturnMessage.Success)
            {
                info.ReturnValue = returnCode;
                return(info);
            }
            Array.Copy(frame, 3, info.UL_UID, 0, 7); //拷贝返回的 UL_UID
            info.ReturnValue = ReturnMessage.Success;
            return(info);
        }
Example #2
0
        /// <summary>
        /// UtraLight标签防冲突操作,返回一张标签的UID。
        /// </summary>
        /// <returns></returns>
        public async Task <ULAnticollInfo> ULAnticollAsync()
        {
            byte[] frame = CreateULAnticollFrame();
            CommunicationReturnInfo cri = await com.SendAsync(frame);

            if (cri.ReturnValue != ReturnMessage.Success)
            {
                ULAnticollInfo uai = new ULAnticollInfo();
                uai.SendByte         = frame;
                uai.ReturnValue      = cri.ReturnValue;
                uai.ExceptionMessage = cri.ExceptionMessage;
                return(uai);
            }

            ULAnticollInfo info = HandleULAnticollFrame(cri.RecvByte);

            info.SendByte = frame;
            return(info);
        }