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 class
MultipleReq.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 boolean
doInnerCallbacks
CipReply[]
replies
int[]
reqOffsets
Array of inner requests in this request.CipRequest[]
requests
int[]
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 MultipleReq
addCallback(int idx, CipReplyConsumer callback)
Requests are expected to generate a reply some time after submission to an Origin.MultipleReq
addCallback(CipReplyConsumer callback)
Requests are expected to generate a reply some time after submission to an Origin.MultipleReq
clone()
int
payloadLength()
Subclasses must override this unless they populate the payload and payloadActual fields.protected java.lang.String
payloadString()
protected java.lang.String
payloadString(int startIdx)
void
putPayload(java.nio.ByteBuffer dest)
Subclasses that encode fields into their payloads must override this.int
replyLength()
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.String
replyPayloadString(CipReply reply)
protected java.lang.String
serviceName()
void
setPayload(java.nio.ByteBuffer source)
Subclasses should override this method to permit reparsing of protocol packets into the desired request type.java.lang.String
substReplyString(CipReply reply)
protected java.lang.String
substRequestString()
-
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:CipRequest
Requests 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:
addCallback
in classCipRequest
- Returns:
- Returns the request to allow method chaining.
-
addCallback
public MultipleReq addCallback(int idx, CipReplyConsumer callback)
Description copied from class:CipRequest
Requests 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:
addCallback
in classCipRequest
- Returns:
- Returns the request to allow method chaining.
-
clone
public MultipleReq clone()
- Overrides:
clone
in classCipRequest
-
setPayload
public void setPayload(java.nio.ByteBuffer source)
Description copied from class:CipRequest
Subclasses should override this method to permit reparsing of protocol packets into the desired request type.- Specified by:
setPayload
in interfaceCipMessage
- Overrides:
setPayload
in classCipRequest
- Parameters:
source
- Source buffer containing the encoded new payload.
-
putPayload
public void putPayload(java.nio.ByteBuffer dest)
Description copied from class:CipRequest
Subclasses that encode fields into their payloads must override this.- Specified by:
putPayload
in interfaceCipMessage
- Overrides:
putPayload
in classCipRequest
- Parameters:
dest
- Destination buffer for the encoded payload.
-
payloadLength
public int payloadLength()
Description copied from class:CipRequest
Subclasses must override this unless they populate the payload and payloadActual fields.- Specified by:
payloadLength
in interfaceCipMessage
- Overrides:
payloadLength
in 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:
replyLength
in classCipRequest
- Returns:
-
serviceName
protected java.lang.String serviceName()
- Overrides:
serviceName
in classCipRequest
-
payloadString
protected java.lang.String payloadString()
- Overrides:
payloadString
in 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)
-
-