You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2019/12/18 22:29:44 UTC
[plc4x] branch next-gen-core updated: make decode optional as you
can handle the response in the send now
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch next-gen-core
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/next-gen-core by this push:
new e40563b make decode optional as you can handle the response in the send now
e40563b is described below
commit e40563b5a5962e1261d20b49871586e107ec35ac
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed Dec 18 23:29:32 2019 +0100
make decode optional as you can handle the response in the send now
---
.../java/org/apache/plc4x/java/spi/Plc4xProtocolBase.java | 12 +++++++++++-
.../plc4x/java/s7/readwrite/protocol/Plc4xS7Protocol.java | 12 ++----------
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/Plc4xProtocolBase.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/Plc4xProtocolBase.java
index 419a279..33e5618 100644
--- a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/Plc4xProtocolBase.java
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/Plc4xProtocolBase.java
@@ -37,6 +37,16 @@ public abstract class Plc4xProtocolBase<T> {
protected abstract void encode(ConversationContext<T> context, PlcRequestContainer msg) throws Exception;
- protected abstract void decode(ConversationContext<T> context, T msg) throws Exception;
+ /**
+ * TODO document me
+ * <p>
+ * Can be used for non request incoming messages
+ *
+ * @param context
+ * @param msg
+ * @throws Exception
+ */
+ protected void decode(ConversationContext<T> context, T msg) throws Exception {
+ }
}
diff --git a/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/protocol/Plc4xS7Protocol.java b/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/protocol/Plc4xS7Protocol.java
index 0c66795..cf0c742 100644
--- a/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/protocol/Plc4xS7Protocol.java
+++ b/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/protocol/Plc4xS7Protocol.java
@@ -68,8 +68,6 @@ public class Plc4xS7Protocol extends Plc4xProtocolBase<TPKTPacket> {
private S7ControllerType controllerType;
private static final AtomicInteger tpduGenerator = new AtomicInteger(10);
- @Deprecated
- private final Map<Integer, PlcRequestContainer> requests;
public Plc4xS7Protocol(int callingTsapId, int calledTsapId, COTPTpduSize tpduSize,
int maxAmqCaller, int maxAmqCallee, S7ControllerType controllerType) {
@@ -82,8 +80,6 @@ public class Plc4xS7Protocol extends Plc4xProtocolBase<TPKTPacket> {
this.maxAmqCaller = maxAmqCaller;
this.maxAmqCallee = maxAmqCallee;
this.controllerType = controllerType;
-
- requests = new HashMap<>();
}
@Override
@@ -238,13 +234,9 @@ public class Plc4xS7Protocol extends Plc4xProtocolBase<TPKTPacket> {
e.printStackTrace();
}
});
+ } else {
+ throw new NotImplementedException("Implement me");
}
- throw new NotImplementedException("Implement me");
- }
-
-
- @Override
- protected void decode(ConversationContext<TPKTPacket> context, TPKTPacket msg) throws Exception {
}
private PlcResponse decodeReadResponse(S7MessageResponse responseMessage, PlcRequestContainer requestContainer) throws PlcProtocolException {