protected ReadMultipleBlockInfo HandleReadMultipleBlockFrame(I15693BlockLen blockLen, byte[] frame) { int dataLen = frame.Length - 5; ReadMultipleBlockInfo info = new ReadMultipleBlockInfo(blockLen, frame); ReturnMessage returnCode = CheckFrame(info); if (returnCode != ReturnMessage.Success) { info.ReturnValue = returnCode; return(info); } Array.Copy(frame, 3, info.Data, 0, dataLen); info.ReturnValue = ReturnMessage.Success; return(info); }
/// <summary> /// 上位机发送该命令读取电子标签中多个指定块的数据(每个块4或8个字节)和安全状态信息。 /// 当块的长度为4个字节时一次最多能读12个块,当块的长度为8个字节时一次最多能读6个块。 /// 上位机可指定的块的范围和每个块的大小因电子标签的生产厂商的不同而有所差异。 /// 该命令可以在address mode和select mode下运行。 /// </summary> /// <param name="blockLen">卡的数据块所占空间的字节数,4或8</param> /// <param name="start">读取的开始块号</param> /// <param name="count">读取的块的个数</param> /// <returns></returns> public async Task <ReadMultipleBlockInfo> ReadMultipleBlockAsync(I15693BlockLen blockLen, byte start, byte count) { byte[] frame = CreateReadMultipleBlockFrame(blockLen, start, count); CommunicationReturnInfo cri = await com.SendAsync(frame); if (cri.ReturnValue != ReturnMessage.Success) { ReadMultipleBlockInfo ib = new ReadMultipleBlockInfo(); ib.SendByte = frame; ib.ReturnValue = cri.ReturnValue; ib.ExceptionMessage = cri.ExceptionMessage; return(ib); } ReadMultipleBlockInfo info = HandleReadMultipleBlockFrame(blockLen, cri.RecvByte); info.SendByte = frame; return(info); }