/// <summary> /// 当上位机通过发送命令数据块让读写器执行该命令后,将获得读写器的信息, /// 这其中包括读写器地址(Adr)、读写器软件版本(Version)、读写器类型 /// 代码、读写器协议支持信息、读写器的频率范围、读写器的功率、询查时间 /// 等信息。 /// </summary> /// <returns></returns> public async Task <GetInformationInfo> GetInformationAsync() { byte[] frame = CreateGetInformationFrame(); CommunicationReturnInfo cri = await com.SendAsync(frame); if (cri.ReturnValue != ReturnMessage.Success) { GetInformationInfo gii = new GetInformationInfo(); gii.SendByte = frame; gii.ReturnValue = cri.ReturnValue; gii.ExceptionMessage = cri.ExceptionMessage; return(gii); } GetInformationInfo info = HandleGetInformationFrame(cri.RecvByte); info.SendByte = frame; return(info); }
protected GetInformationInfo HandleGetInformationFrame(byte[] frame) { GetInformationInfo info = new GetInformationInfo(frame); ReturnMessage returnCode = CheckFrame(info); if (returnCode != ReturnMessage.Success) { info.ReturnValue = returnCode; return(info); } Array.Copy(frame, 4, info.Version, 0, 2); //拷贝版本号 info.Type = frame[6]; info.TrType = frame[7]; info.Dmaxfre = frame[8]; info.Dminfre = frame[9]; info.Power = frame[10]; info.Scntm = frame[11]; info.ReturnValue = ReturnMessage.Success; return(info); }