Class S7RequestSizeCalculator

java.lang.Object
org.apache.plc4x.java.s7.netty.util.S7RequestSizeCalculator

public class S7RequestSizeCalculator
extends Object
When sending S7 messages we have to pay attention to the size of the message in it's serialized form as we have to stay below the agreed upon maximum PDU size. This helper calculates this message size and hereby helps implementing different strategies for optimizing requests.
  • Method Details

    • getRequestMessageSize

      public static short getRequestMessageSize​(S7RequestMessage requestMessage)
      Calculate the size of a request message.
      Parameters:
      requestMessage - the request message we want to get the size for.
      Returns:
      the size in bytes this message will have.
    • getRequestItemTotalSize

      public static short getRequestItemTotalSize​(VarParameterItem varParameterItem, VarPayloadItem varPayloadItem)
      Calculates the size adding an item (parameter and eventually payload) would add to any existing message.
      Parameters:
      varParameterItem - parameter item.
      varPayloadItem - corresponding payload (can be null).
      Returns:
      size in bytes this item would add to an existing request message.