Преглед на файлове

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 години
родител
ревизия
1cc9d18524
променени са 1 файла, в които са добавени 6 реда и са изтрити 0 реда
  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);
 }