Kaynağa Gözat

Types which extend from Enumeration (ns=0;i=29) allow Int32 values only (#1081)

* Types which extend from Enumeration allow Int32 values only

* replaced all leading tabs by 4 blanks
Thomas Bender 7 yıl önce
ebeveyn
işleme
1cc9d18524
1 değiştirilmiş dosya ile 6 ekleme ve 0 silme
  1. 6 0
      src/server/ua_services_attribute.c

+ 6 - 0
src/server/ua_services_attribute.c

@@ -89,6 +89,12 @@ compatibleDataType(UA_Server *server, const UA_NodeId *dataType,
     if(UA_NodeId_equal(constraintDataType, &UA_TYPES[UA_TYPES_VARIANT].typeId))
         return true;
 
+    /* Enum allows Int32 (only) */
+    UA_NodeId enumNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_ENUMERATION);
+    if (isNodeInTree(server->nodestore, constraintDataType, &enumNodeId, &subtypeId, 1)) {
+        return UA_NodeId_equal(dataType, &UA_TYPES[UA_TYPES_INT32].typeId);
+    }
+
     return isNodeInTree(server->nodestore, dataType, constraintDataType, &subtypeId, 1);
 }