You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by jf...@apache.org on 2020/10/21 13:42:19 UTC

[plc4x] 01/08: Cherry Picked SIMOTION support to rel/0.6 and adapted to "native" works (without generated mspec).

This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch rel/0.6
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit f3f5f79b0942d978f3805e0836a21044d8f73966
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Mon Aug 10 10:11:28 2020 +0200

    Cherry Picked SIMOTION support to rel/0.6 and adapted to "native" works (without generated mspec).
---
 .../src/main/java/org/apache/plc4x/java/s7/model/S7Field.java  | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java
index c256d79..8f7f63c 100644
--- a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java
+++ b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java
@@ -18,11 +18,15 @@ under the License.
 */
 package org.apache.plc4x.java.s7.model;
 
+import org.apache.commons.codec.DecoderException;
+import org.apache.commons.codec.binary.Hex;
 import org.apache.commons.lang3.NotImplementedException;
 import org.apache.plc4x.java.api.exceptions.PlcInvalidFieldException;
 import org.apache.plc4x.java.api.model.PlcField;
 import org.apache.plc4x.java.s7.netty.model.types.MemoryArea;
 import org.apache.plc4x.java.s7.netty.model.types.TransportSize;
+import org.apache.plc4x.java.utils.ParseException;
+import org.apache.plc4x.java.utils.ReadBuffer;
 
 import java.time.LocalDate;
 import java.time.LocalDateTime;
@@ -202,14 +206,14 @@ public class S7Field implements PlcField {
             short bitOffset = 0;
             if(matcher.group(BIT_OFFSET) != null) {
                 bitOffset = Short.parseShort(matcher.group(BIT_OFFSET));
-            } else if(dataType == TransportSize.BOOL) {
+            } else if (dataType == TransportSize.BOOL) {
                 throw new PlcInvalidFieldException("Expected bit offset for BOOL parameters.");
             }
             int numElements = 1;
-            if(matcher.group(NUM_ELEMENTS) != null) {
+            if (matcher.group(NUM_ELEMENTS) != null) {
                 numElements = Integer.parseInt(matcher.group(NUM_ELEMENTS));
             }
-            numElements = calcNumberOfElementsForIndividualTypes(numElements,dataType);
+            numElements = calcNumberOfElementsForIndividualTypes(numElements, dataType);
             return new S7Field(dataType, memoryArea, blockNumber, byteOffset, bitOffset, numElements);
         }
         throw new PlcInvalidFieldException("Unable to parse address: " + fieldString);