protected ReadValueInfo HandleReadValueFrame(byte[] frame) { ReadValueInfo info = new ReadValueInfo(frame); ReturnMessage returnCode = CheckFrame(info); if (returnCode != ReturnMessage.Success) { info.ReturnValue = returnCode; return(info); } Array.Copy(frame, 3, info.ValueData, 0, 4); //拷贝返回的块中的数据 info.ReturnValue = ReturnMessage.Success; return(info); }
/// <summary> /// 读取钱包数据块(值块)的值 /// </summary> /// <param name="blockNum">钱包数据块(值块)的绝对块号</param> /// <returns></returns> public async Task <ReadValueInfo> ReadValueAsync(byte blockNum) { byte[] frame = CreateReadValueFrame(blockNum); CommunicationReturnInfo cri = await com.SendAsync(frame); if (cri.ReturnValue != ReturnMessage.Success) { ReadValueInfo ib = new ReadValueInfo(); ib.SendByte = frame; ib.ReturnValue = cri.ReturnValue; ib.ExceptionMessage = cri.ExceptionMessage; return(ib); } ReadValueInfo info = HandleReadValueFrame(cri.RecvByte); info.SendByte = frame; return(info); }