open62541-nodeset-loader icon indicating copy to clipboard operation
open62541-nodeset-loader copied to clipboard

Custom/Aliased UADataTypes and UAVariableTypes not supported

Open paddor opened this issue 3 months ago • 12 comments

I noticed that UA_findDataTypeWithCustom() can't find the data types of imported UAVariables with custom/aliased UADataTypes.

Given the following namespaces:

  <NamespaceUris>
    <Uri>http://foobar.example.com/Types/v2</Uri>
    <Uri>http://foobar.example.com/Instances</Uri>
  </NamespaceUris>

Given these Aliases:

    <Alias Alias="DataItemType">i=2365</Alias>
    <Alias Alias="AlarmStateStates">ns=1;s=af28ed20-dbb6-5624-aa65-4b42023ab1c4</Alias>
    <Alias Alias="AlarmStateType">ns=1;s=0cde5300-0cef-4699-b5c3-acb5011e0aa3</Alias>

And this UADataType:

  <UADataType NodeId="ns=1;s=af28ed20-dbb6-5624-aa65-4b42023ab1c4" BrowseName="1:AlarmStateStates">
    <DisplayName>AlarmStateStates</DisplayName>
    <Description Locale="de">Alarm- und Fehlerzustände</Description>
    <References>
      <Reference ReferenceType="HasProperty">ns=1;s=91428b80-ccb1-5adb-8685-5d51c867a0d3</Reference>
      <Reference ReferenceType="HasSubtype" IsForward="false">Enumeration</Reference>
    </References>
    <Definition Name="1:AlarmStateStates">
      <Field Name="Inaktiv" Value="0"/>
      <Field Name="Aktiv" Value="1"/>
    </Definition>
  </UADataType>

And this UAVariableType:

  <UAVariableType NodeId="ns=1;s=0cde5300-0cef-4699-b5c3-acb5011e0aa3" BrowseName="1:AlarmStateType" DataType="AlarmStateStates">
    <DisplayName>AlarmStateType</DisplayName>
    <Description Locale="de">Alarm- und Fehlerzustände</Description>
    <References>
      <Reference ReferenceType="HasSubtype" IsForward="false">DataItemType</Reference>
    </References>
  </UAVariableType>

And this UAVariable:

  <UAVariable NodeId="ns=2;g=16001624-6a1d-42d5-81d1-f54af84f5325" BrowseName="1:E_ComState" ParentNodeId="ns=2;g=33b2b39b-57a5-4d9f-af09-ae2f00ae1776" DataType="AlarmStateStates" AccessLevel="1">
    <DisplayName>E_ComState</DisplayName>
    <Description Locale="de">Energiemessung Messzelle Z.X Fehler: Kommunikation</Description>
    <References>
      <Reference ReferenceType="HasComponent" IsForward="false">ns=2;g=33b2b39b-57a5-4d9f-af09-ae2f00ae1776</Reference>
      <Reference ReferenceType="HasTypeDefinition">AlarmStateType</Reference>
    </References>
  </UAVariable>

(Sorry, I can't provide a full XML nodeset right now. But maybe this info is already enough.)

As preparation for UA_Server_writeDataValue(), my code can't find the data type by the type nodeId AlarmStateStates nor the type nodeId ns=2;s=af28ed20-dbb6-5624-aa65-4b42023ab1c4 (adjusted for runtime NS index) using UA_findDataTypeWithCustom(). Any ideas?

paddor avatar Mar 15 '24 12:03 paddor