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 2018/01/11 14:35:58 UTC
[incubator-plc4x] branch refactoring/java_generify updated: small
pre-merge fixes.
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch refactoring/java_generify
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
The following commit(s) were added to refs/heads/refactoring/java_generify by this push:
new ea71d93 small pre-merge fixes.
ea71d93 is described below
commit ea71d93b636c1cb0e8f1a7c1a250a7dca2154da4
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Thu Jan 11 15:35:54 2018 +0100
small pre-merge fixes.
---
.../apache/plc4x/edgent/PlcConnectionAdapter.java | 5 +++--
.../plc4x/java/s7/netty/Plc4XS7Protocol.java | 22 +++++++++-------------
2 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcConnectionAdapter.java b/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcConnectionAdapter.java
index 9854500..b92015b 100644
--- a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcConnectionAdapter.java
+++ b/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcConnectionAdapter.java
@@ -18,7 +18,8 @@ under the License.
*/
package org.apache.plc4x.edgent;
-import com.google.gson.JsonObject;
+import java.util.Calendar;
+
import org.apache.edgent.function.Consumer;
import org.apache.edgent.function.Function;
import org.apache.edgent.function.Supplier;
@@ -34,7 +35,7 @@ import org.apache.plc4x.java.api.model.Address;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.Calendar;
+import com.google.gson.JsonObject;
/**
* PlcConnectionAdapter encapsulates a plc4x {@link PlcConnection}.
diff --git a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java
index eb1eeb3..7b2aaa2 100644
--- a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java
+++ b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java
@@ -168,18 +168,16 @@ public class Plc4XS7Protocol extends MessageToMessageCodec<S7Message, PlcRequest
// All Ok.
else {
byte[] data = payloadItem.getData();
- Class datatype = requestItem.getDatatype();
- List value = decodeData(datatype, data);
+ Class<?> datatype = requestItem.getDatatype();
+ List<?> value = decodeData(datatype, data);
responseItem = new ReadResponseItem(requestItem, responseCode, value);
}
responseItems.add(responseItem);
}
if (plcReadRequest instanceof TypeSafePlcReadRequest) {
- response = new TypeSafePlcReadResponse((TypeSafePlcReadRequest) plcReadRequest, responseItems.isEmpty() ? null : responseItems.get(0));
- } else if (plcReadRequest instanceof PlcReadRequest) {
+ response = new TypeSafePlcReadResponse((TypeSafePlcReadRequest) plcReadRequest, responseItems);
+ } else {
response = new PlcReadResponse(plcReadRequest, responseItems);
- } else {
- response = null;
}
}
@@ -210,12 +208,10 @@ public class Plc4XS7Protocol extends MessageToMessageCodec<S7Message, PlcRequest
responseItems.add(responseItem);
}
- if (plcWriteRequest instanceof PlcWriteRequest) {
- response = new PlcWriteResponse(plcWriteRequest, responseItems);
- } else if (plcWriteRequest instanceof TypeSafePlcWriteRequest) {
- response = new TypeSafePlcWriteResponse((TypeSafePlcWriteRequest) plcWriteRequest, responseItems.isEmpty() ? null : responseItems.get(0));
+ if (plcWriteRequest instanceof TypeSafePlcWriteRequest) {
+ response = new TypeSafePlcWriteResponse((TypeSafePlcWriteRequest) plcWriteRequest, responseItems);
} else {
- response = null;
+ response = new PlcWriteResponse(plcWriteRequest, responseItems);
}
}
@@ -257,7 +253,7 @@ public class Plc4XS7Protocol extends MessageToMessageCodec<S7Message, PlcRequest
}
}
- private TransportSize encodeTransportSize(Class datatype) {
+ private TransportSize encodeTransportSize(Class<?> datatype) {
if (datatype == Boolean.class) {
return TransportSize.BIT;
} else if (datatype == Byte.class) {
@@ -276,7 +272,7 @@ public class Plc4XS7Protocol extends MessageToMessageCodec<S7Message, PlcRequest
return null;
}
- private DataTransportSize encodeDataTransportSize(Class datatype) {
+ private DataTransportSize encodeDataTransportSize(Class<?> datatype) {
if (datatype == Boolean.class) {
return DataTransportSize.BIT;
} else if (datatype == Byte.class) {
--
To stop receiving notification emails like this one, please contact
['"commits@plc4x.apache.org" <co...@plc4x.apache.org>'].