Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for optional DisplayName in NodeSet2.xml #2630

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps/ua-nodeset
Submodule ua-nodeset updated 155 files
2 changes: 1 addition & 1 deletion src/pubsub/ua_pubsub.c
Expand Up @@ -960,7 +960,7 @@ UA_DataSetWriter_generateDataSetMessage(UA_Server *server, UA_DataSetMessage *da

/* The field encoding depends on the flags inside the writer config.
* TODO: This can be moved to the encoding layer. */
if((u64)dataSetWriter->config.dataSetFieldContentMask & (u64)UA_DATASETFIELDCONTENTMASK_RAWDATAENCODING) {
if(dataSetWriter->config.dataSetFieldContentMask & (u64)UA_DATASETFIELDCONTENTMASK_RAWDATA) {
dataSetMessage->header.fieldEncoding = UA_FIELDENCODING_RAWDATA;
} else if((u64)dataSetWriter->config.dataSetFieldContentMask &
((u64)UA_DATASETFIELDCONTENTMASK_SOURCETIMESTAMP | (u64)UA_DATASETFIELDCONTENTMASK_SERVERPICOSECONDS |
Expand Down
17 changes: 14 additions & 3 deletions src/server/ua_nodes.c
Expand Up @@ -282,9 +282,20 @@ static UA_StatusCode
copyStandardAttributes(UA_Node *node, const UA_NodeAttributes *attr) {
/* retval = UA_NodeId_copy(&item->requestedNewNodeId.nodeId, &node->nodeId); */
/* retval |= UA_QualifiedName_copy(&item->browseName, &node->browseName); */
UA_StatusCode retval = UA_LocalizedText_copy(&attr->displayName,
&node->displayName);
retval |= UA_LocalizedText_copy(&attr->description, &node->description);

UA_StatusCode retval;
/* The new nodeset format has optional display name.
* See https://github.com/open62541/open62541/issues/2627
* If display name is NULL, then we take the name part of the browse name */
if (attr->displayName.text.length == 0) {
retval = UA_String_copy(&node->browseName.name,
&node->displayName.text);
} else {
retval = UA_LocalizedText_copy(&attr->displayName,
&node->displayName);
retval |= UA_LocalizedText_copy(&attr->description, &node->description);
}

node->writeMask = attr->writeMask;
return retval;
}
Expand Down
16 changes: 10 additions & 6 deletions tools/nodeset_compiler/backend_open62541_nodes.py
Expand Up @@ -430,12 +430,16 @@ def generateNodeCode_begin(node, nodeset, generate_ns0, parentref, encode_binary
code.extend(generateDataTypeNodeCode(node))
elif isinstance(node, ViewNode):
code.extend(generateViewNodeCode(node))
code.append("attr.displayName = " + generateLocalizedTextCode(node.displayName, alloc=False) + ";")
code.append("#ifdef UA_ENABLE_NODESET_COMPILER_DESCRIPTIONS")
code.append("attr.description = " + generateLocalizedTextCode(node.description, alloc=False) + ";")
code.append("#endif")
code.append("attr.writeMask = %d;" % node.writeMask)
code.append("attr.userWriteMask = %d;" % node.userWriteMask)
if node.displayName is not None:
code.append("attr.displayName = " + generateLocalizedTextCode(node.displayName, alloc=False) + ";")
if node.description is not None:
code.append("#ifdef UA_ENABLE_NODESET_COMPILER_DESCRIPTIONS")
code.append("attr.description = " + generateLocalizedTextCode(node.description, alloc=False) + ";")
code.append("#endif")
if node.writeMask is not None:
code.append("attr.writeMask = %d;" % node.writeMask)
if node.userWriteMask is not None:
code.append("attr.userWriteMask = %d;" % node.userWriteMask)

# AddNodes call
code.append("retVal |= UA_Server_addNode_begin(server, UA_NODECLASS_{},".
Expand Down
14 changes: 7 additions & 7 deletions tools/nodeset_compiler/nodes.py
Expand Up @@ -68,13 +68,13 @@ def RefOrAlias(s):

class Node(object):
def __init__(self):
self.id = NodeId()
self.browseName = QualifiedName()
self.displayName = LocalizedText()
self.description = LocalizedText()
self.symbolicName = String()
self.writeMask = 0
self.userWriteMask = 0
self.id = None
self.browseName = None
self.displayName = None
self.description = None
self.symbolicName = None
self.writeMask = None
self.userWriteMask = None
self.references = set()
self.hidden = False
self.modelUri = None
Expand Down
231 changes: 170 additions & 61 deletions tools/schema/NodeIds.csv

Large diffs are not rendered by default.

186 changes: 42 additions & 144 deletions tools/schema/Opc.Ua.NodeSet2.Minimal.xml
@@ -1,7 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<UANodeSet xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" LastModified="2016-12-31T00:00:00Z" xmlns="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd">
<?xml version="1.0" encoding="utf-8" ?>
<!--
* Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved.
*
* OPC Foundation MIT License 1.00
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* The complete license agreement can be found here:
* http://opcfoundation.org/License/MIT/1.00/
-->

<UANodeSet xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" LastModified="2019-01-31T00:00:00Z" xmlns="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd">
<Models>
<Model ModelUri="http://opcfoundation.org/UA/" Version="1.04" PublicationDate="2016-12-31T00:00:00Z" />
<Model ModelUri="http://opcfoundation.org/UA/" Version="1.04" PublicationDate="2019-01-31T00:00:00Z" />
</Models>
<Aliases>
<Alias Alias="Boolean">i=1</Alias>
Expand Down Expand Up @@ -274,13 +303,12 @@
<Description>The abstract base type for all references.</Description>
<References />
</UAReferenceType>
<UAReferenceType NodeId="i=32" BrowseName="NonHierarchicalReferences" IsAbstract="true">
<UAReferenceType NodeId="i=32" BrowseName="NonHierarchicalReferences" IsAbstract="true" Symmetric="true">
<DisplayName>NonHierarchicalReferences</DisplayName>
<Description>The abstract base type for all non-hierarchical references.</Description>
<References>
<Reference ReferenceType="HasSubtype" IsForward="false">i=31</Reference>
</References>
<InverseName>NonHierarchicalReferences</InverseName>
</UAReferenceType>
<UAReferenceType NodeId="i=33" BrowseName="HierarchicalReferences" IsAbstract="true">
<DisplayName>HierarchicalReferences</DisplayName>
Expand Down Expand Up @@ -340,7 +368,7 @@
</UAReferenceType>
<UAReferenceType NodeId="i=40" BrowseName="HasTypeDefinition">
<DisplayName>HasTypeDefinition</DisplayName>
<Description>The type for references from a instance node its type definition node.</Description>
<Description>The type for references from a instance node its type defintion node.</Description>
<References>
<Reference ReferenceType="HasSubtype" IsForward="false">i=32</Reference>
</References>
Expand Down Expand Up @@ -656,7 +684,6 @@
<References>
<Reference ReferenceType="HasProperty">i=112</Reference>
<Reference ReferenceType="HasTypeDefinition">i=77</Reference>
<Reference ReferenceType="Organizes" IsForward="false">i=2996</Reference>
</References>
</UAObject>
<UAVariable NodeId="i=112" BrowseName="NamingRule" ParentNodeId="i=78" DataType="i=120">
Expand All @@ -676,7 +703,6 @@
<References>
<Reference ReferenceType="HasProperty">i=113</Reference>
<Reference ReferenceType="HasTypeDefinition">i=77</Reference>
<Reference ReferenceType="Organizes" IsForward="false">i=2996</Reference>
</References>
</UAObject>
<UAVariable NodeId="i=113" BrowseName="NamingRule" ParentNodeId="i=80" DataType="i=120">
Expand Down Expand Up @@ -772,13 +798,6 @@
<Reference ReferenceType="HasSubtype" IsForward="false">i=58</Reference>
</References>
</UAObjectType>
<UAObjectType NodeId="i=2033" BrowseName="VendorServerInfoType">
<DisplayName>VendorServerInfoType</DisplayName>
<Description>A base type for vendor specific server information.</Description>
<References>
<Reference ReferenceType="HasSubtype" IsForward="false">i=58</Reference>
</References>
</UAObjectType>
<UAObject NodeId="i=2011" BrowseName="VendorServerInfo" ParentNodeId="i=2004">
<DisplayName>VendorServerInfo</DisplayName>
<Description>Server information provided by the vendor.</Description>
Expand Down Expand Up @@ -811,6 +830,13 @@
<Reference ReferenceType="HasSubtype" IsForward="false">i=58</Reference>
</References>
</UAObjectType>
<UAObjectType NodeId="i=2033" BrowseName="VendorServerInfoType">
<DisplayName>VendorServerInfoType</DisplayName>
<Description>A base type for vendor specific server information.</Description>
<References>
<Reference ReferenceType="HasSubtype" IsForward="false">i=58</Reference>
</References>
</UAObjectType>
<UAObjectType NodeId="i=2034" BrowseName="ServerRedundancyType">
<DisplayName>ServerRedundancyType</DisplayName>
<Description>A base type for an object that describe how a server supports redundancy.</Description>
Expand Down Expand Up @@ -1204,7 +1230,6 @@
<Reference ReferenceType="HasProperty">i=3704</Reference>
<Reference ReferenceType="HasComponent">i=2996</Reference>
<Reference ReferenceType="HasComponent">i=2997</Reference>
<Reference ReferenceType="HasComponent">i=11192</Reference>
<Reference ReferenceType="HasTypeDefinition">i=2013</Reference>
<Reference ReferenceType="HasComponent" IsForward="false">i=2253</Reference>
</References>
Expand Down Expand Up @@ -1588,133 +1613,6 @@
</ListOfExtensionObject>
</Value>
</UAVariable>
<UAObject NodeId="i=11192" BrowseName="HistoryServerCapabilities">
<DisplayName>HistoryServerCapabilities</DisplayName>
<References>
<Reference ReferenceType="HasProperty">i=11193</Reference>
<Reference ReferenceType="HasProperty">i=11242</Reference>
<Reference ReferenceType="HasProperty">i=11273</Reference>
<Reference ReferenceType="HasProperty">i=11274</Reference>
<Reference ReferenceType="HasProperty">i=11196</Reference>
<Reference ReferenceType="HasProperty">i=11197</Reference>
<Reference ReferenceType="HasProperty">i=11198</Reference>
<Reference ReferenceType="HasProperty">i=11199</Reference>
<Reference ReferenceType="HasProperty">i=11200</Reference>
<Reference ReferenceType="HasProperty">i=11281</Reference>
<Reference ReferenceType="HasProperty">i=11282</Reference>
<Reference ReferenceType="HasProperty">i=11283</Reference>
<Reference ReferenceType="HasProperty">i=11502</Reference>
<Reference ReferenceType="HasProperty">i=11275</Reference>
<Reference ReferenceType="HasComponent">i=11201</Reference>
<Reference ReferenceType="HasComponent" IsForward="false">i=2268</Reference>
<Reference ReferenceType="HasTypeDefinition">i=2330</Reference>
</References>
</UAObject>
<UAVariable NodeId="i=11193" BrowseName="AccessHistoryDataCapability" ParentNodeId="i=11192" DataType="Boolean">
<DisplayName>AccessHistoryDataCapability</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasProperty" IsForward="false">i=11192</Reference>
</References>
</UAVariable>
<UAVariable NodeId="i=11242" BrowseName="AccessHistoryEventsCapability" ParentNodeId="i=11192" DataType="Boolean">
<DisplayName>AccessHistoryEventsCapability</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasProperty" IsForward="false">i=11192</Reference>
</References>
</UAVariable>
<UAVariable NodeId="i=11273" BrowseName="MaxReturnDataValues" ParentNodeId="i=11192" DataType="UInt32">
<DisplayName>MaxReturnDataValues</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasProperty" IsForward="false">i=11192</Reference>
</References>
</UAVariable>
<UAVariable NodeId="i=11274" BrowseName="MaxReturnEventValues" ParentNodeId="i=11192" DataType="UInt32">
<DisplayName>MaxReturnEventValues</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasProperty" IsForward="false">i=11192</Reference>
</References>
</UAVariable>
<UAVariable NodeId="i=11196" BrowseName="InsertDataCapability" ParentNodeId="i=11192" DataType="Boolean">
<DisplayName>InsertDataCapability</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasProperty" IsForward="false">i=11192</Reference>
</References>
</UAVariable>
<UAVariable NodeId="i=11197" BrowseName="ReplaceDataCapability" ParentNodeId="i=11192" DataType="Boolean">
<DisplayName>ReplaceDataCapability</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasProperty" IsForward="false">i=11192</Reference>
</References>
</UAVariable>
<UAVariable NodeId="i=11198" BrowseName="UpdateDataCapability" ParentNodeId="i=11192" DataType="Boolean">
<DisplayName>UpdateDataCapability</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasProperty" IsForward="false">i=11192</Reference>
</References>
</UAVariable>
<UAVariable NodeId="i=11199" BrowseName="DeleteRawCapability" ParentNodeId="i=11192" DataType="Boolean">
<DisplayName>DeleteRawCapability</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasProperty" IsForward="false">i=11192</Reference>
</References>
</UAVariable>
<UAVariable NodeId="i=11200" BrowseName="DeleteAtTimeCapability" ParentNodeId="i=11192" DataType="Boolean">
<DisplayName>DeleteAtTimeCapability</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasProperty" IsForward="false">i=11192</Reference>
</References>
</UAVariable>
<UAVariable NodeId="i=11281" BrowseName="InsertEventCapability" ParentNodeId="i=11192" DataType="Boolean">
<DisplayName>InsertEventCapability</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasProperty" IsForward="false">i=11192</Reference>
</References>
</UAVariable>
<UAVariable NodeId="i=11282" BrowseName="ReplaceEventCapability" ParentNodeId="i=11192" DataType="Boolean">
<DisplayName>ReplaceEventCapability</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasProperty" IsForward="false">i=11192</Reference>
</References>
</UAVariable>
<UAVariable NodeId="i=11283" BrowseName="UpdateEventCapability" ParentNodeId="i=11192" DataType="Boolean">
<DisplayName>UpdateEventCapability</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasProperty" IsForward="false">i=11192</Reference>
</References>
</UAVariable>
<UAVariable NodeId="i=11502" BrowseName="DeleteEventCapability" ParentNodeId="i=11192" DataType="Boolean">
<DisplayName>DeleteEventCapability</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasProperty" IsForward="false">i=11192</Reference>
</References>
</UAVariable>
<UAVariable NodeId="i=11275" BrowseName="InsertAnnotationCapability" ParentNodeId="i=11192" DataType="Boolean">
<DisplayName>InsertAnnotationCapability</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasProperty" IsForward="false">i=11192</Reference>
</References>
</UAVariable>
<UAObject NodeId="i=11201" BrowseName="AggregateFunctions" ParentNodeId="i=11192">
<DisplayName>AggregateFunctions</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=61</Reference>
<Reference ReferenceType="HasComponent" IsForward="false">i=11192</Reference>
</References>
</UAObject>
<UAObjectType NodeId="i=2330" BrowseName="HistoryServerCapabilitiesType">
<DisplayName>HistoryServerCapabilitiesType</DisplayName>
<References>
Expand Down Expand Up @@ -1966,5 +1864,5 @@
<Value>
<String xmlns="http://opcfoundation.org/UA/2008/02/Types.xsd">EnumValueType</String>
</Value>
</UAVariable>
</UAVariable>
</UANodeSet>
35 changes: 32 additions & 3 deletions tools/schema/Opc.Ua.NodeSet2.PubSubMinimal.xml
@@ -1,7 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<UANodeSet xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" LastModified="2016-12-31T00:00:00Z" xmlns="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd">
<?xml version="1.0" encoding="utf-8" ?>
<!--
* Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved.
*
* OPC Foundation MIT License 1.00
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* The complete license agreement can be found here:
* http://opcfoundation.org/License/MIT/1.00/
-->

<UANodeSet xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" LastModified="2019-01-31T00:00:00Z" xmlns="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd">
<Models>
<Model ModelUri="http://opcfoundation.org/UA/" Version="1.04" PublicationDate="2016-12-31T00:00:00Z" />
<Model ModelUri="http://opcfoundation.org/UA/" Version="1.04" PublicationDate="2019-01-31T00:00:00Z" />
</Models>
<UAObjectType NodeId="i=15906" BrowseName="PubSubKeyServiceType">
<DisplayName>PubSubKeyServiceType</DisplayName>
Expand Down