You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by GitBox <gi...@apache.org> on 2020/12/15 09:04:08 UTC

[GitHub] [plc4x] chrisdutz commented on a change in pull request #210: Bug/driver opcua read arrays [PLC4X-202]

chrisdutz commented on a change in pull request #210:
URL: https://github.com/apache/plc4x/pull/210#discussion_r543164459



##########
File path: plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/OpcuaField.java
##########
@@ -30,30 +30,34 @@ Licensed to the Apache Software Foundation (ASF) under one
  */
 public class OpcuaField implements PlcField {
 
-    public static final Pattern ADDRESS_PATTERN = Pattern.compile("^ns=(?<namespace>\\d+);(?<identifierType>[isgb])=((?<identifier>.+))?");
+    public static final Pattern ADDRESS_PATTERN = Pattern.compile("^ns=(?<namespace>\\d+);(?<identifierType>[isgb])=((?<identifier>[^:]+))?(:(?<datatype>[a-zA-Z_]+))?");
 
     private final OpcuaIdentifierType identifierType;
 
     private final int namespace;
 
     private final String identifier;
 
-    protected OpcuaField(int namespace, OpcuaIdentifierType identifierType, String identifier) {
+    private final String dataType;
+
+    protected OpcuaField(int namespace, OpcuaIdentifierType identifierType, String identifier, String dataType) {
         this.namespace = namespace;
         this.identifier = identifier;
         this.identifierType = identifierType;
         if (this.identifier == null || this.namespace < 0) {
             throw new IllegalArgumentException("Identifier can not be null or Namespace can not be lower then 0.");
         }
+        this.dataType = dataType != null ? dataType.toUpperCase() : null;
     }
 

Review comment:
       Problem with enums are that they are not extendable. So if we have a driver that generally supports the normal IEC types, but has more, we couldn't reference them 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org