From f5303cb3a7545d0f6d973f199cd111c2ebc2d889 Mon Sep 17 00:00:00 2001 From: Michele Cattafesta Date: Mon, 2 May 2016 00:38:51 +0200 Subject: [PATCH] ReadMultipleVars: removed returned List, that was of no use, and added documentation. Signed-off-by: Michele Cattafesta --- S7.Net/PLC.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/S7.Net/PLC.cs b/S7.Net/PLC.cs index 6c1a31d..3ee2edc 100644 --- a/S7.Net/PLC.cs +++ b/S7.Net/PLC.cs @@ -273,12 +273,14 @@ namespace S7.Net } /// - /// Reads multiple vars in a single request. You have to create and pass a list of DataItems and you obtain in response the same list with the values. + /// Reads multiple vars in a single request. + /// You have to create and pass a list of DataItems and you obtain in response the same list with the values. + /// Values are stored in the property "Value" of the dataItem and are already converted. + /// If you don't want the conversion, just create a dataItem of bytes. /// DataItems must not be more than 20 (protocol restriction) and bytes must not be more than 200 + 22 of header (protocol restriction). /// /// List of dataitems that contains the list of variables that must be read. Maximum 20 dataitems are accepted. - /// List of dataItem containing the values of the variables - public List ReadMultipleVars(List dataItems) + public void ReadMultipleVars(List dataItems) { int cntBytes = dataItems.Sum(dataItem => VarTypeToByteLength(dataItem.VarType, dataItem.Count)); @@ -318,20 +320,16 @@ namespace S7.Net dataItem.Value = ParseBytes(dataItem.VarType, bytes, dataItem.Count); } - - return dataItems; } catch (SocketException socketException) { LastErrorCode = ErrorCode.WriteData; LastErrorString = socketException.Message; - return null; } catch (Exception exc) { LastErrorCode = ErrorCode.WriteData; LastErrorString = exc.Message; - return null; } }