Skip to content

Commit

Permalink
ENIPCodec#ExchangeSendRRData accept CommandItem as params
Browse files Browse the repository at this point in the history
  • Loading branch information
gisellevonbingen committed Jul 24, 2023
1 parent d057214 commit e5d42d5
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions Giselle.Net.EtherNetIP/ENIP/ENIPCodec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ public void UnRegisterSession(Stream stream)

public SendRRData CreateSendRRData(IEnumerable<CommandItem> 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);
}

Expand All @@ -138,28 +138,28 @@ public CommandItems ExchangeSendRRData(Stream stream, SendRRData request)
return this.ReadCommandData(res, false).Items;
}

private RES ExchangeSendRRData<RES>(Stream stream, CommandItem request, Func<CommandItems, RES> responseFunc)
private RES ExchangeSendRRData<RES>(Stream stream, Func<CommandItems, RES> 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));

}

Expand Down

0 comments on commit e5d42d5

Please sign in to comment.