Class DefaultS7MessageProcessor
- java.lang.Object
-
- org.apache.plc4x.java.s7.readwrite.optimizer.DefaultS7MessageProcessor
-
- All Implemented Interfaces:
S7MessageProcessor
public class DefaultS7MessageProcessor extends Object implements S7MessageProcessor
While a SetupCommunication message is no problem, when reading or writing data, situations could arise that have to be handled. The following situations have to be handled: - The number of request items is so big, that the resulting PDU would exceed the agreed upon PDU size: The request has to be split up into multiple requests. - If large blocks of data are requested by request items the result of a request could exceed the PDU size: The requests has to be split up into multiple requests where each requests response doesn't exceed the PDU size.The following optimizations should be implemented: - If blocks are read which are in near proximity to each other it could be better to replace multiple requests by one that includes multiple blocks. - Rearranging the order of request items could reduce the number of needed PDUs.
-
-
Field Summary
Fields Modifier and Type Field Description static intEMPTY_READ_REQUEST_SIZEstatic intEMPTY_READ_RESPONSE_SIZEstatic intEMPTY_WRITE_REQUEST_SIZEstatic intEMPTY_WRITE_RESPONSE_SIZE
-
Constructor Summary
Constructors Constructor Description DefaultS7MessageProcessor(AtomicInteger tpduGenerator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<S7MessageRequest>processRequest(S7MessageRequest request, int pduSize)S7MessageResponseDataprocessResponse(S7MessageRequest originalRequest, Map<S7MessageRequest,io.vavr.control.Either<S7MessageResponseData,Throwable>> result)
-
-
-
Field Detail
-
EMPTY_READ_REQUEST_SIZE
public static final int EMPTY_READ_REQUEST_SIZE
-
EMPTY_READ_RESPONSE_SIZE
public static final int EMPTY_READ_RESPONSE_SIZE
-
EMPTY_WRITE_REQUEST_SIZE
public static final int EMPTY_WRITE_REQUEST_SIZE
-
EMPTY_WRITE_RESPONSE_SIZE
public static final int EMPTY_WRITE_RESPONSE_SIZE
-
-
Constructor Detail
-
DefaultS7MessageProcessor
public DefaultS7MessageProcessor(AtomicInteger tpduGenerator)
-
-
Method Detail
-
processRequest
public Collection<S7MessageRequest> processRequest(S7MessageRequest request, int pduSize) throws PlcException
- Specified by:
processRequestin interfaceS7MessageProcessor- Throws:
PlcException
-
processResponse
public S7MessageResponseData processResponse(S7MessageRequest originalRequest, Map<S7MessageRequest,io.vavr.control.Either<S7MessageResponseData,Throwable>> result)
- Specified by:
processResponsein interfaceS7MessageProcessor
-
-