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



##########
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:
       Without using class lookups, I'm not sure if there is a better way to 
handle the PLC4X->Milo data type mapping within 
plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/connection/OpcuaTcpPlcConnection.java
   
   Having a project goal of being able to easily provide a way to extend 
drivers with custom data types, adding an enum for the data types wouldn't be 
towards that.
   
   Having a function similar to <T> getObject() within PlcValue instead of 
Object getObject() might be one way to improve the logic but will leave that 
open for a future work.




----------------------------------------------------------------
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:
[email protected]


Reply via email to