Exemple #1
0
        protected AnticollInfo HandleAnticollFrame(byte[] frame)
        {
            AnticollInfo  info       = new AnticollInfo(frame);
            ReturnMessage returnCode = CheckFrame(info);

            if (returnCode != ReturnMessage.Success)
            {
                info.ReturnValue = returnCode;
                return(info);
            }
            Array.Copy(frame, 3, info.UID, 0, 4); //拷贝返回的 UID
            info.ReturnValue = ReturnMessage.Success;
            return(info);
        }
Exemple #2
0
        /// <summary>
        /// 防冲突操作,必须在Request命令后立即执行。如果事先知道所需要
        /// 操作的电子标签的序列号,可以越过此调用,在Request命令后直接
        /// 调用Select 即可。
        /// </summary>
        /// <param name="ml">
        /// ml=MultiLable.AllowOne 不允许多张电子标签进入感应场
        /// m1=MultiLable.AllowMulti 允许多张电子标签进入感应场
        /// </param>
        /// <returns></returns>
        public async Task <AnticollInfo> Anticoll2Async(MultiLable ml)
        {
            byte[] frame = CreateAnticoll2Frame(ml);
            CommunicationReturnInfo cri = await com.SendAsync(frame);

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

            AnticollInfo info = HandleAnticollFrame(cri.RecvByte);

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