Class 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
    • Field Detail

      • reqOffsets

        public int[] reqOffsets
        Array of inner requests in this request.
      • rspOffsets

        public int[] rspOffsets
      • 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 query
        source - 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 class CipRequest
        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 class CipRequest
        Returns:
        Returns the request to allow method chaining.
      • 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 interface CipMessage
        Overrides:
        setPayload in class CipRequest
        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 interface CipMessage
        Overrides:
        putPayload in class CipRequest
        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 interface CipMessage
        Overrides:
        payloadLength in class CipRequest
        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 class CipRequest
        Returns:
      • 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)