Beispiel #1
0
        protected InventoryInfo HandleInventoryFrame(byte[] frame)
        {
            InventoryInfo info       = new InventoryInfo(frame);
            ReturnMessage returnCode = CheckFrame(info);

            if (returnCode != ReturnMessage.Success)
            {
                info.ReturnValue = returnCode;
                return(info);
            }

            info.DSFID = frame[3];                //拷贝 DSFID
            Array.Copy(frame, 4, info.UID, 0, 8); //拷贝UID
            info.ReturnValue = ReturnMessage.Success;
            return(info);
        }
Beispiel #2
0
        /// <summary>
        /// 带AFI的Inventory。
        /// AFI相符的电子标签才能响应,但只是返回一张电子标签的UID,并让这张电子标签进入Quiet状态
        /// </summary>
        /// <param name="afi">类型识别码</param>
        /// <returns></returns>
        public async Task <InventoryInfo> InventoryWithAFIAsync(byte afi)
        {
            byte[] frame = CreateInventoryWithAFIFrame(afi);
            CommunicationReturnInfo cri = await com.SendAsync(frame);

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

            InventoryInfo info = HandleInventoryFrame(cri.RecvByte);

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