You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by hu...@apache.org on 2021/08/20 19:15:15 UTC

[plc4x] branch develop updated: Fix/ when reading OPCUA boolean type a byte is returned instead of boolean value

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

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


The following commit(s) were added to refs/heads/develop by this push:
     new 2957ed1  Fix/ when reading OPCUA boolean type a byte is returned instead of boolean value
2957ed1 is described below

commit 2957ed1c1060e7c6f5b3f1be4cb8b673637268bd
Author: hutcheb <hu...@apache.org>
AuthorDate: Sat Aug 21 05:13:48 2021 +1000

    Fix/ when reading OPCUA boolean type a byte is returned instead of boolean value
---
 .../org/apache/plc4x/java/opcua/protocol/OpcuaProtocolLogic.java  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/OpcuaProtocolLogic.java b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/OpcuaProtocolLogic.java
index 2ea9078..aa7dfa3 100644
--- a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/OpcuaProtocolLogic.java
+++ b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/OpcuaProtocolLogic.java
@@ -236,9 +236,13 @@ public class OpcuaProtocolLogic extends Plc4xProtocolBase<OpcuaAPU> implements H
                 if (variant instanceof VariantBoolean) {
                     byte[] array = ((VariantBoolean) variant).getValue();
                     int length = array.length;
-                    Byte[] tmpValue = new Byte[length];
+                    Boolean[] tmpValue = new Boolean[length];
                     for (int i = 0; i < length; i++) {
-                        tmpValue[i] = array[i];
+                        if (array[i] == 0) {
+                            tmpValue[i] = false;
+                        } else {
+                            tmpValue[i] = true;
+                        }
                     }
                     value = IEC61131ValueHandler.of(tmpValue);
                 } else if (variant instanceof VariantSByte) {