Ejemplo n.º 1
0
        protected GetReaderInformationInfo HandleGetReaderInformationFrame(byte[] frame)
        {
            GetReaderInformationInfo info       = new GetReaderInformationInfo(frame);
            ReturnMessage            returnCode = CheckFrame(info);

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

            Array.Copy(frame, 3, info.Version, 0, 2);      //拷贝版本号
            info.ReaderType = frame[7];                    //拷贝读卡器类型
            Array.Copy(frame, 8, info.ProtocolType, 0, 2); //拷贝协议类型
            info.InventoryScanTime = frame[10];
            info.ReturnValue       = ReturnMessage.Success;
            return(info);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 上位机发送该命令以获得读写器的信息,包括读写器地址(Com_adr)、
        /// 读写器软件版本(Version)、读写器类型代码、读写器协议支持信息和
        /// InventoryScanTime的信息。
        /// </summary>
        /// <param name="addr">读写器地址</param>
        /// <returns></returns>
        public async Task <GetReaderInformationInfo> GetReaderInformationAsync(byte?addr)
        {
            byte[] frame = CreateGetReaderInformationFrame(addr ?? Com_adr);
            CommunicationReturnInfo cri = await com.SendAsync(frame);

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

            GetReaderInformationInfo info = HandleGetReaderInformationFrame(cri.RecvByte);

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