From e5d42d51f78ddb74d58e7d8ab2a520d48ec76b55 Mon Sep 17 00:00:00 2001 From: gisellevonbingen Date: Mon, 24 Jul 2023 13:30:18 +0900 Subject: [PATCH] ENIPCodec#ExchangeSendRRData accept CommandItem as params --- Giselle.Net.EtherNetIP/ENIP/ENIPCodec.cs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Giselle.Net.EtherNetIP/ENIP/ENIPCodec.cs b/Giselle.Net.EtherNetIP/ENIP/ENIPCodec.cs index e7a96c8..2591fb2 100644 --- a/Giselle.Net.EtherNetIP/ENIP/ENIPCodec.cs +++ b/Giselle.Net.EtherNetIP/ENIP/ENIPCodec.cs @@ -125,9 +125,9 @@ public void UnRegisterSession(Stream stream) public SendRRData CreateSendRRData(IEnumerable items) => new SendRRData(items) { Timeout = this.SendRRDataTimeout }; - public CommandItems ExchangeSendRRData(Stream stream, CommandItem request) + public CommandItems ExchangeSendRRData(Stream stream, params CommandItem[] requests) { - var req = this.CreateSendRRData(request); + var req = this.CreateSendRRData(requests); return this.ExchangeSendRRData(stream, req); } @@ -138,28 +138,28 @@ public CommandItems ExchangeSendRRData(Stream stream, SendRRData request) return this.ReadCommandData(res, false).Items; } - private RES ExchangeSendRRData(Stream stream, CommandItem request, Func responseFunc) + private RES ExchangeSendRRData(Stream stream, Func responseFunc, params CommandItem[] requests) { - var response = this.ExchangeSendRRData(stream, request); + var response = this.ExchangeSendRRData(stream, requests); return responseFunc(response); } public DataProcessor GetAttribute(Stream stream, AttributePath path) => this.ExchangeSendRRData(stream, - this.CIPCodec.CreateGetAttribute(path), - this.CIPCodec.HandleGetAttribute); + this.CIPCodec.HandleGetAttribute, + this.CIPCodec.CreateGetAttribute(path)); public byte SetAttribute(Stream stream, AttributePath path, byte[] values) => this.ExchangeSendRRData(stream, - this.CIPCodec.CreateSetAttribute(path, values), - this.CIPCodec.HandleSetAttribute); + this.CIPCodec.HandleSetAttribute, + this.CIPCodec.CreateSetAttribute(path, values)); public ForwardOpenResult ForwardOpen(Stream stream, ForwardOpenOptions options) => this.ExchangeSendRRData(stream, - this.CIPCodec.CreateForwardOpen(options), - response => this.CIPCodec.HandleForwardOpen(response, options)); + response => this.CIPCodec.HandleForwardOpen(response, options), + this.CIPCodec.CreateForwardOpen(options)); public ForwardCloseResult ForwardClose(Stream stream, ForwardCloseOptions options) => this.ExchangeSendRRData(stream, - this.CIPCodec.CreateForwardClose(options), - response => this.CIPCodec.HandleForwardClose(response, options)); + response => this.CIPCodec.HandleForwardClose(response, options), + this.CIPCodec.CreateForwardClose(options)); }