@@ -0,0 +1,3046 @@
+package com.digitalpetri.enip.logix.services;%0A%0Aimport java.util.function.Consumer;%0A%0Aimport com.digitalpetri.enip.cip.CipResponseException;%0Aimport com.digitalpetri.enip.cip.epath.EPath.PaddedEPath;%0Aimport com.digitalpetri.enip.cip.services.CipService;%0Aimport com.digitalpetri.enip.cip.structs.MessageRouterRequest;%0Aimport com.digitalpetri.enip.cip.structs.MessageRouterResponse;%0Aimport io.netty.buffer.ByteBuf;%0Aimport io.netty.buffer.Unpooled;%0Aimport io.netty.util.ReferenceCountUtil;%0A%0Apublic class WriteTagFragmentedService implements CipService%3CByteBuf%3E %7B%0A%0A    public static final int SERVICE_CODE = 0x53;%0A%0A    private final Consumer%3CByteBuf%3E dataEncoder = this::encode;%0A%0A    private final PaddedEPath requestPath;%0A    private final int elementCount;%0A    private final boolean structured;%0A    private final int tagType;%0A    private final ByteBuf data;%0A    private final int offset;%0A%0A    /**%0A     * @param requestPath  %7B@link PaddedEPath Path%7D of tag%0A     * @param structured   True if tag is structured%0A     * @param tagType      Type of tag%0A     * @param elementCount Total number of elements being sent. Usually the number of bytes, but%0A     *                     can vary based on data type.%0A     * @param offset       Total number of bytes of data transferred in previous requests%0A     * @param data         %7B@link ByteBuf Data%7D to be sent in request. Data should be a slice of original data, starting%0A     *                     at offset and ending at an appropriate length for the CIP connection size.%0A     */%0A    public WriteTagFragmentedService(%0A        PaddedEPath requestPath,%0A        boolean structured,%0A        int tagType,%0A        int elementCount,%0A        int offset,%0A        ByteBuf data%0A    ) %7B%0A%0A        this.requestPath = requestPath;%0A        this.structured = structured;%0A        this.tagType = tagType;%0A        this.elementCount = elementCount;%0A        this.offset = offset;%0A        this.data = data;%0A    %7D%0A%0A    @Override%0A    public void encodeRequest(ByteBuf buffer) %7B%0A        MessageRouterRequest request = new MessageRouterRequest(%0A            SERVICE_CODE,%0A            requestPath,%0A            dataEncoder%0A        );%0A%0A        MessageRouterRequest.encode(request, buffer);%0A    %7D%0A%0A    private void encode(ByteBuf buffer) %7B%0A        if (structured) %7B%0A            buffer.writeByte(0xA0).writeByte(0x02);%0A        %7D%0A%0A        buffer.writeShort(tagType);%0A        buffer.writeShort(elementCount);%0A        buffer.writeInt(offset);%0A        buffer.writeBytes(data);%0A    %7D%0A%0A    @Override%0A    public ByteBuf decodeResponse(ByteBuf buffer) throws CipResponseException %7B%0A        MessageRouterResponse response = MessageRouterResponse.decode(buffer);%0A%0A        int generalStatus = response.getGeneralStatus();%0A%0A        try %7B%0A            if (generalStatus == 0x00) %7B%0A                return Unpooled.EMPTY_BUFFER;%0A            %7D else %7B%0A                throw new CipResponseException(generalStatus, response.getAdditionalStatus());%0A            %7D%0A        %7D finally %7B%0A            ReferenceCountUtil.release(response.getData());%0A        %7D%0A    %7D%0A%0A%7D%0A

Add WriteWriteTagFragmentedService (#41)