Class MultipleReq
- java.lang.Object
-
- com.automation_pros.odva.cip.requests.CipRequest
-
- com.automation_pros.odva.cip.requests.MultipleReq
-
- All Implemented Interfaces:
CipReplyConsumer,CipMessage,java.io.Externalizable,java.io.Serializable
public class MultipleReq extends CipRequest
The Multiple Service Packet service, code 0x0a, is described in appendix A of the CIP Specification. It is used to execute multiple services within a target using a single packet. The payload is a count of nested services, a list of byte offsets for each, and the Message Router Request payloads for each.This service returns a count of nested responses, a list of byte offsets for each response, and the Message Router Response payloads for each.
If any nested response is an error, the outer response will have General status code 0x1e, "Embedded Service Error". This can be ignored if all nested requests have their own callbacks.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classMultipleReq.InnerCallbacks-
Nested classes/interfaces inherited from class com.automation_pros.odva.cip.requests.CipRequest
CipRequest.CallbackException, CipRequest.ChainedException, CipRequest.ReplyFuture
-
-
Field Summary
Fields Modifier and Type Field Description booleandoInnerCallbacksCipReply[]repliesint[]reqOffsetsArray of inner requests in this request.CipRequest[]requestsint[]rspOffsets-
Fields inherited from class com.automation_pros.odva.cip.requests.CipRequest
acceptTrace, acceptTS, callbacks, creationTrace, deadline, forecastReply, maxreply, path, scheduler, sentTS, sLogger, svccode
-
-
Constructor Summary
Constructors Constructor Description MultipleReq()CIP Requests are externalizable, so must have a public no-args constructor.MultipleReq(CipPath target, CipRequest... requests)Create this service request from scratch, specifying an array of inner requests to compose the body of this request.MultipleReq(CipPath target, java.nio.ByteBuffer source)Construct this service request given an application target path and an encoded payload buffer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MultipleReqaddCallback(int idx, CipReplyConsumer callback)Requests are expected to generate a reply some time after submission to an Origin.MultipleReqaddCallback(CipReplyConsumer callback)Requests are expected to generate a reply some time after submission to an Origin.MultipleReqclone()intpayloadLength()Subclasses must override this unless they populate the payload and payloadActual fields.protected java.lang.StringpayloadString()protected java.lang.StringpayloadString(int startIdx)voidputPayload(java.nio.ByteBuffer dest)Subclasses that encode fields into their payloads must override this.intreplyLength()If this request was created with inner requests that all know their reply sizes, this request's reply size can be forecast.protected java.lang.StringreplyPayloadString(CipReply reply)protected java.lang.StringserviceName()voidsetPayload(java.nio.ByteBuffer source)Subclasses should override this method to permit reparsing of protocol packets into the desired request type.java.lang.StringsubstReplyString(CipReply reply)protected java.lang.StringsubstRequestString()-
Methods inherited from class com.automation_pros.odva.cip.requests.CipRequest
accept, accept, accept, addFutureCallback, bytes, decode, forecast, getPayload, getServiceCode, getSyncReply, getSyncReply, getTarget, payloadBytes, put, putSyncReplyPayload, putSyncReplyPayload, readExternal, rewrapRequest, service, service, set, takeCallbacks, toBytes, toString, writeExternal
-
-
-
-
Field Detail
-
reqOffsets
public int[] reqOffsets
Array of inner requests in this request.
-
requests
public CipRequest[] requests
-
rspOffsets
public int[] rspOffsets
-
replies
public CipReply[] replies
-
doInnerCallbacks
public boolean doInnerCallbacks
-
-
Constructor Detail
-
MultipleReq
public MultipleReq()
CIP Requests are externalizable, so must have a public no-args constructor.
-
MultipleReq
public MultipleReq(CipPath target, CipRequest... requests)
Create this service request from scratch, specifying an array of inner requests to compose the body of this request.- Parameters:
target- Application object to query (Supposed to be the Message Router)requests- CIP Requests to be nested in this request. They are expected to already have callbacks assigned.
-
MultipleReq
public MultipleReq(CipPath target, java.nio.ByteBuffer source)
Construct this service request given an application target path and an encoded payload buffer.- Parameters:
target- Application object to querysource- A buffer containing a 16-bit unsigned integer attribute count, followed by that many 16-bit unsigned integer attribute numbers.
-
-
Method Detail
-
addCallback
public MultipleReq addCallback(CipReplyConsumer callback)
Description copied from class:CipRequestRequests are expected to generate a reply some time after submission to an Origin. The caller must add the callbacks that will consume the corresponding reply. For the consumer's convenience, the reply will have this request attached.- Overrides:
addCallbackin classCipRequest- Returns:
- Returns the request to allow method chaining.
-
addCallback
public MultipleReq addCallback(int idx, CipReplyConsumer callback)
Description copied from class:CipRequestRequests are expected to generate a reply some time after submission to an Origin. The caller must add the callbacks that will consume the corresponding reply. For the consumer's convenience, the reply will have this request attached. This overloaded form allows a callback to be inserted at any desired point.- Overrides:
addCallbackin classCipRequest- Returns:
- Returns the request to allow method chaining.
-
clone
public MultipleReq clone()
- Overrides:
clonein classCipRequest
-
setPayload
public void setPayload(java.nio.ByteBuffer source)
Description copied from class:CipRequestSubclasses should override this method to permit reparsing of protocol packets into the desired request type.- Specified by:
setPayloadin interfaceCipMessage- Overrides:
setPayloadin classCipRequest- Parameters:
source- Source buffer containing the encoded new payload.
-
putPayload
public void putPayload(java.nio.ByteBuffer dest)
Description copied from class:CipRequestSubclasses that encode fields into their payloads must override this.- Specified by:
putPayloadin interfaceCipMessage- Overrides:
putPayloadin classCipRequest- Parameters:
dest- Destination buffer for the encoded payload.
-
payloadLength
public int payloadLength()
Description copied from class:CipRequestSubclasses must override this unless they populate the payload and payloadActual fields.- Specified by:
payloadLengthin interfaceCipMessage- Overrides:
payloadLengthin classCipRequest- Returns:
- The byte length of the encoded payload only.
-
replyLength
public int replyLength()
If this request was created with inner requests that all know their reply sizes, this request's reply size can be forecast.- Overrides:
replyLengthin classCipRequest- Returns:
-
serviceName
protected java.lang.String serviceName()
- Overrides:
serviceNamein classCipRequest
-
payloadString
protected java.lang.String payloadString()
- Overrides:
payloadStringin classCipRequest
-
payloadString
protected java.lang.String payloadString(int startIdx)
-
substReplyString
public java.lang.String substReplyString(CipReply reply)
-
substRequestString
protected java.lang.String substRequestString()
-
replyPayloadString
protected java.lang.String replyPayloadString(CipReply reply)
-
-