public OperateResult WriteTag(string address, byte[] value, bool IsBool = false) { OperateResult <byte[]> command = ToyopucHelper.BuildWriteCommand(address, value, IsBool); if (!command.IsSuccess) { return(command); } // 核心交互 OperateResult <byte[]> read = ReadFromCoreServer(command.Content); if (!read.IsSuccess) { return(read); } // 检查反馈 OperateResult check = CheckResponse(read.Content); if (!check.IsSuccess) { return(OperateResult.CreateFailedResult <byte[]>(check)); } // 提取写入结果 return(read); }
public OperateResult <byte[]> Read(string address, ushort length, bool IsBool = false) { var datas = ToyopucHelper.BuildReadCommand(address, length, IsBool); if (!datas.IsSuccess) { return(datas); } var read = ReadFromCoreServer(datas.Content); if (!read.IsSuccess) { return(read); } var check = CheckResponse(read.Content); if (!check.IsSuccess) { return(OperateResult.CreateFailedResult <byte[]>(check)); } return(ToyopucHelper.ExtractActualData(read.Content)); }