Class S7ProtocolLogic
- java.lang.Object
-
- org.apache.plc4x.java.spi.Plc4xProtocolBase<TPKTPacket>
-
- org.apache.plc4x.java.s7.readwrite.protocol.S7ProtocolLogic
-
public class S7ProtocolLogic extends Plc4xProtocolBase<TPKTPacket>
The S7 Protocol states that there can not be more then {min(maxAmqCaller, maxAmqCallee} "ongoing" requests. So we need to limit those. Thus, each request goes to a Work Queue and this Queue ensures, that only 3 are open at the same time.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classS7ProtocolLogic.StringSizes
-
Field Summary
Fields Modifier and Type Field Description static DurationREQUEST_TIMEOUT-
Fields inherited from class org.apache.plc4x.java.spi.Plc4xProtocolBase
context, driverContext
-
-
Constructor Summary
Constructors Constructor Description S7ProtocolLogic()
-
Method Summary
-
Methods inherited from class org.apache.plc4x.java.spi.Plc4xProtocolBase
browse, browseWithInterceptor, getDriverContext, onDiscover, ping, setContext
-
-
-
-
Field Detail
-
REQUEST_TIMEOUT
public static final Duration REQUEST_TIMEOUT
-
-
Method Detail
-
setDriverContext
public void setDriverContext(DriverContext driverContext)
- Overrides:
setDriverContextin classPlc4xProtocolBase<TPKTPacket>
-
close
public void close(ConversationContext<TPKTPacket> context)
- Specified by:
closein classPlc4xProtocolBase<TPKTPacket>
-
onConnect
public void onConnect(ConversationContext<TPKTPacket> context)
- Overrides:
onConnectin classPlc4xProtocolBase<TPKTPacket>
-
onDisconnect
public void onDisconnect(ConversationContext<TPKTPacket> context)
- Overrides:
onDisconnectin classPlc4xProtocolBase<TPKTPacket>
-
read
public CompletableFuture<PlcReadResponse> read(PlcReadRequest readRequest)
- Overrides:
readin classPlc4xProtocolBase<TPKTPacket>
-
write
public CompletableFuture<PlcWriteResponse> write(PlcWriteRequest writeRequest)
- Overrides:
writein classPlc4xProtocolBase<TPKTPacket>
-
subscribe
public CompletableFuture<PlcSubscriptionResponse> subscribe(PlcSubscriptionRequest subscriptionRequest)
- Overrides:
subscribein classPlc4xProtocolBase<TPKTPacket>
-
unsubscribe
public CompletableFuture<PlcUnsubscriptionResponse> unsubscribe(PlcUnsubscriptionRequest unsubscriptionRequest)
- Overrides:
unsubscribein classPlc4xProtocolBase<TPKTPacket>
-
decode
protected void decode(ConversationContext<TPKTPacket> context, TPKTPacket msg) throws Exception
DECODE: This method is called when there is no handler for the message. By default it must correspond to asynchronous events, which if so, must be transferred to the event queue. The event's own information is encapsulated in the parameters and payload field. From this it is abstracted to the corresponding event model. 01. S7ModeEvent: 02. S7UserEvent: 03. S7SysEvent: 04. S7AlarmEvent 05. S7CyclicEvent: 06. S7CyclicEvent: TODO: Use mspec to generate types that allow better interpretation of the code using "instanceof".- Overrides:
decodein classPlc4xProtocolBase<TPKTPacket>- Throws:
Exception
-
encodeS7Address
protected S7Address encodeS7Address(PlcTag tag)
Currently we only support the S7 Any type of addresses. This helper simply converts the S7Tag from PLC4X into S7Address objects.- Parameters:
tag- S7Tag instance we need to convert into an S7Address- Returns:
- the S7Address
-
getStringSizes
protected CompletableFuture<Map<S7StringVarLengthTag,S7ProtocolLogic.StringSizes>> getStringSizes(PlcTagRequest request)
-
-