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 2019/08/29 13:12:13 UTC

[plc4x] 01/02: Addition of single bit read from Integer files

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

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

commit f4aaecae53a34779628238bafa85b4c0233c5c73
Author: v.emmert <v....@pragmaticminds.de>
AuthorDate: Wed Aug 28 11:16:08 2019 +0200

    Addition of single bit read from Integer files
---
 .../java/org/apache/plc4x/java/abeth/model/types/FileType.java   | 3 ++-
 .../org/apache/plc4x/java/abeth/protocol/Plc4xAbEthProtocol.java | 9 ++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/sandbox/test-java-ab-eth-driver/src/main/java/org/apache/plc4x/java/abeth/model/types/FileType.java b/sandbox/test-java-ab-eth-driver/src/main/java/org/apache/plc4x/java/abeth/model/types/FileType.java
index ebc02ef..22f41f6 100644
--- a/sandbox/test-java-ab-eth-driver/src/main/java/org/apache/plc4x/java/abeth/model/types/FileType.java
+++ b/sandbox/test-java-ab-eth-driver/src/main/java/org/apache/plc4x/java/abeth/model/types/FileType.java
@@ -35,7 +35,8 @@ public enum FileType {
     INPUT((short) 0x8C),
     STRING((short) 0x8D),
     ASCII((short) 0x8E),
-    BCD((short) 0x8F);
+    BCD((short) 0x8F),
+    INTBIT((short) 0x89); // reads single bit from Integer file, no official AB type
 
     private final short typeCode;
 
diff --git a/sandbox/test-java-ab-eth-driver/src/main/java/org/apache/plc4x/java/abeth/protocol/Plc4xAbEthProtocol.java b/sandbox/test-java-ab-eth-driver/src/main/java/org/apache/plc4x/java/abeth/protocol/Plc4xAbEthProtocol.java
index 6c3965d..4096fa5 100644
--- a/sandbox/test-java-ab-eth-driver/src/main/java/org/apache/plc4x/java/abeth/protocol/Plc4xAbEthProtocol.java
+++ b/sandbox/test-java-ab-eth-driver/src/main/java/org/apache/plc4x/java/abeth/protocol/Plc4xAbEthProtocol.java
@@ -167,7 +167,7 @@ public class Plc4xAbEthProtocol extends PlcMessageToMessageCodec<CIPEncapsulatio
             if (responseCode == PlcResponseCode.OK) {
                 try {
                     switch (field.getFileType()) {
-                        case HURZ:
+                        case INTEGER: //HURZ
                             if(plcReadResponse.getResponse() instanceof DF1CommandResponseMessageProtectedTypedLogicalRead) {
                                 DF1CommandResponseMessageProtectedTypedLogicalRead df1PTLR = (DF1CommandResponseMessageProtectedTypedLogicalRead) plcReadResponse.getResponse();
                                 short[] data = df1PTLR.getData();
@@ -178,6 +178,13 @@ public class Plc4xAbEthProtocol extends PlcMessageToMessageCodec<CIPEncapsulatio
                                 fieldItem = new DefaultShortFieldItem(convData);
                             }
                             break;
+                        case INTBIT:
+                            if(plcReadResponse.getResponse() instanceof DF1CommandResponseMessageProtectedTypedLogicalRead) {
+                                DF1CommandResponseMessageProtectedTypedLogicalRead df1PTLR = (DF1CommandResponseMessageProtectedTypedLogicalRead) plcReadResponse.getResponse();
+                                short[] data = df1PTLR.getData();
+
+                            }
+                            break;
                         default:
                             logger.warn("Problem during decoding of field {}: Decoding of file type not implemented; " +
                                 "FieldInformation: {}", fieldName, field);