summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJannis Voelker <jannis.voelker@basyskom.com>2018-09-19 15:26:28 +0200
committerJannis Völker <jannis.voelker@basyskom.com>2018-09-21 05:36:13 +0000
commit1518d52ab49e599a4324f0c9da40a1ae75002945 (patch)
tree2be6c7d491251861d9d92eabd5683ab67f67c599
parent2ec17eb452cb7f5dbd987b175b55ea8909f7ffe6 (diff)
Remove the mask() getter from the QOpcUaNodeCreationAttributes API
Change-Id: Ie18b70286101e0974f89989c5226f661ca858c20 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
-rw-r--r--src/opcua/client/qopcuanodecreationattributes.cpp9
-rw-r--r--src/opcua/client/qopcuanodecreationattributes.h3
-rw-r--r--src/opcua/client/qopcuanodecreationattributes_p.h2
-rw-r--r--src/plugins/opcua/open62541/qopen62541backend.cpp109
4 files changed, 82 insertions, 41 deletions
diff --git a/src/opcua/client/qopcuanodecreationattributes.cpp b/src/opcua/client/qopcuanodecreationattributes.cpp
index b191611..e9f2127 100644
--- a/src/opcua/client/qopcuanodecreationattributes.cpp
+++ b/src/opcua/client/qopcuanodecreationattributes.cpp
@@ -281,15 +281,6 @@ QOpcUaNodeCreationAttributes::~QOpcUaNodeCreationAttributes()
{}
/*!
- Returns the bitmask containing information about set attributes.
- For a mapping of bit positions to attributes, see OPC-UA part 4, table 145.
-*/
-quint32 QOpcUaNodeCreationAttributes::mask() const
-{
- return data->mask;
-}
-
-/*!
Returns the value for the AccessLevel attribute.
*/
QOpcUa::AccessLevel QOpcUaNodeCreationAttributes::accessLevel() const
diff --git a/src/opcua/client/qopcuanodecreationattributes.h b/src/opcua/client/qopcuanodecreationattributes.h
index ad775ce..a0d4746 100644
--- a/src/opcua/client/qopcuanodecreationattributes.h
+++ b/src/opcua/client/qopcuanodecreationattributes.h
@@ -54,9 +54,6 @@ public:
~QOpcUaNodeCreationAttributes();
- // A bitmask containing all set values, see OPC-UA part 4, table 145
- quint32 mask() const;
-
QOpcUa::AccessLevel accessLevel() const;
void setAccessLevel(QOpcUa::AccessLevel accessLevel);
bool hasAccessLevel() const;
diff --git a/src/opcua/client/qopcuanodecreationattributes_p.h b/src/opcua/client/qopcuanodecreationattributes_p.h
index c33d3cf..8434175 100644
--- a/src/opcua/client/qopcuanodecreationattributes_p.h
+++ b/src/opcua/client/qopcuanodecreationattributes_p.h
@@ -61,7 +61,7 @@ public:
: mask(0)
{}
- // Bit positions from OPC-UA part 4, table 145
+ // Bit positions from OPC-UA part 4, 7.19.1
enum class BitMask : quint32 {
AccessLevel = 0,
ArrayDimensions = 1,
diff --git a/src/plugins/opcua/open62541/qopen62541backend.cpp b/src/plugins/opcua/open62541/qopen62541backend.cpp
index d201879..5c5de2c 100644
--- a/src/plugins/opcua/open62541/qopen62541backend.cpp
+++ b/src/plugins/opcua/open62541/qopen62541backend.cpp
@@ -968,8 +968,10 @@ UA_ExtensionObject Open62541AsyncBackend::assembleNodeAttributes(const QOpcUaNod
obj.content.decoded.data = attr;
obj.content.decoded.type = &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES];
- if (nodeAttributes.hasEventNotifier())
+ if (nodeAttributes.hasEventNotifier()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_EVENTNOTIFIER;
attr->eventNotifier = nodeAttributes.eventNotifier();
+ }
break;
}
case QOpcUa::NodeClass::Variable: {
@@ -978,23 +980,39 @@ UA_ExtensionObject Open62541AsyncBackend::assembleNodeAttributes(const QOpcUaNod
obj.content.decoded.data = attr;
obj.content.decoded.type = &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES];
- if (nodeAttributes.hasValue())
+ if (nodeAttributes.hasValue()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_VALUE;
attr->value = QOpen62541ValueConverter::toOpen62541Variant(nodeAttributes.value(),
nodeAttributes.valueType());
- if (nodeAttributes.hasDataTypeId())
+ }
+ if (nodeAttributes.hasDataTypeId()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_DATATYPE;
attr->dataType = Open62541Utils::nodeIdFromQString(nodeAttributes.dataTypeId());
- if (nodeAttributes.hasValueRank())
+ }
+ if (nodeAttributes.hasValueRank()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_VALUERANK;
attr->valueRank = nodeAttributes.valueRank();
- if (nodeAttributes.hasArrayDimensions())
+ }
+ if (nodeAttributes.hasArrayDimensions()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_ARRAYDIMENSIONS;
attr->arrayDimensions = copyArrayDimensions(nodeAttributes.arrayDimensions(), &attr->arrayDimensionsSize);
- if (nodeAttributes.hasAccessLevel())
+ }
+ if (nodeAttributes.hasAccessLevel()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_ACCESSLEVEL;
attr->accessLevel = nodeAttributes.accessLevel();
- if (nodeAttributes.hasUserAccessLevel())
+ }
+ if (nodeAttributes.hasUserAccessLevel()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_USERACCESSLEVEL;
attr->userAccessLevel = nodeAttributes.userAccessLevel();
- if (nodeAttributes.hasMinimumSamplingInterval())
+ }
+ if (nodeAttributes.hasMinimumSamplingInterval()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_MINIMUMSAMPLINGINTERVAL;
attr->minimumSamplingInterval = nodeAttributes.minimumSamplingInterval();
- if (nodeAttributes.hasHistorizing())
+ }
+ if (nodeAttributes.hasHistorizing()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_HISTORIZING;
attr->historizing = nodeAttributes.historizing();
+ }
break;
}
case QOpcUa::NodeClass::Method: {
@@ -1003,10 +1021,14 @@ UA_ExtensionObject Open62541AsyncBackend::assembleNodeAttributes(const QOpcUaNod
obj.content.decoded.data = attr;
obj.content.decoded.type = &UA_TYPES[UA_TYPES_METHODATTRIBUTES];
- if (nodeAttributes.hasExecutable())
+ if (nodeAttributes.hasExecutable()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_EXECUTABLE;
attr->executable = nodeAttributes.executable();
- if (nodeAttributes.hasUserExecutable())
+ }
+ if (nodeAttributes.hasUserExecutable()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_USEREXECUTABLE;
attr->userExecutable = nodeAttributes.userExecutable();
+ }
break;
}
case QOpcUa::NodeClass::ObjectType: {
@@ -1015,8 +1037,10 @@ UA_ExtensionObject Open62541AsyncBackend::assembleNodeAttributes(const QOpcUaNod
obj.content.decoded.data = attr;
obj.content.decoded.type = &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES];
- if (nodeAttributes.hasIsAbstract())
+ if (nodeAttributes.hasIsAbstract()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_ISABSTRACT;
attr->isAbstract = nodeAttributes.isAbstract();
+ }
break;
}
case QOpcUa::NodeClass::VariableType: {
@@ -1025,17 +1049,27 @@ UA_ExtensionObject Open62541AsyncBackend::assembleNodeAttributes(const QOpcUaNod
obj.content.decoded.data = attr;
obj.content.decoded.type = &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES];
- if (nodeAttributes.hasValue())
+ if (nodeAttributes.hasValue()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_VALUE;
attr->value = QOpen62541ValueConverter::toOpen62541Variant(nodeAttributes.value(),
nodeAttributes.valueType());
- if (nodeAttributes.hasDataTypeId())
+ }
+ if (nodeAttributes.hasDataTypeId()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_DATATYPE;
attr->dataType = Open62541Utils::nodeIdFromQString(nodeAttributes.dataTypeId());
- if (nodeAttributes.hasValueRank())
+ }
+ if (nodeAttributes.hasValueRank()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_VALUERANK;
attr->valueRank = nodeAttributes.valueRank();
- if (nodeAttributes.hasArrayDimensions())
+ }
+ if (nodeAttributes.hasArrayDimensions()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_ARRAYDIMENSIONS;
attr->arrayDimensions = copyArrayDimensions(nodeAttributes.arrayDimensions(), &attr->arrayDimensionsSize);
- if (nodeAttributes.hasIsAbstract())
+ }
+ if (nodeAttributes.hasIsAbstract()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_ISABSTRACT;
attr->isAbstract = nodeAttributes.isAbstract();
+ }
break;
}
case QOpcUa::NodeClass::ReferenceType: {
@@ -1044,13 +1078,19 @@ UA_ExtensionObject Open62541AsyncBackend::assembleNodeAttributes(const QOpcUaNod
obj.content.decoded.data = attr;
obj.content.decoded.type = &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES];
- if (nodeAttributes.hasIsAbstract())
+ if (nodeAttributes.hasIsAbstract()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_ISABSTRACT;
attr->isAbstract = nodeAttributes.isAbstract();
- if (nodeAttributes.hasSymmetric())
+ }
+ if (nodeAttributes.hasSymmetric()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_SYMMETRIC;
attr->symmetric = nodeAttributes.symmetric();
- if (nodeAttributes.hasInverseName())
+ }
+ if (nodeAttributes.hasInverseName()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_INVERSENAME;
QOpen62541ValueConverter::scalarFromQt<UA_LocalizedText, QOpcUa::QLocalizedText>(
nodeAttributes.inverseName(), &attr->inverseName);
+ }
break;
}
case QOpcUa::NodeClass::DataType: {
@@ -1059,8 +1099,10 @@ UA_ExtensionObject Open62541AsyncBackend::assembleNodeAttributes(const QOpcUaNod
obj.content.decoded.data = attr;
obj.content.decoded.type = &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES];
- if (nodeAttributes.hasIsAbstract())
+ if (nodeAttributes.hasIsAbstract()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_ISABSTRACT;
attr->isAbstract = nodeAttributes.isAbstract();
+ }
break;
}
case QOpcUa::NodeClass::View: {
@@ -1069,10 +1111,14 @@ UA_ExtensionObject Open62541AsyncBackend::assembleNodeAttributes(const QOpcUaNod
obj.content.decoded.data = attr;
obj.content.decoded.type = &UA_TYPES[UA_TYPES_VIEWATTRIBUTES];
- if (nodeAttributes.hasContainsNoLoops())
+ if (nodeAttributes.hasContainsNoLoops()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_CONTAINSNOLOOPS;
attr->containsNoLoops = nodeAttributes.containsNoLoops();
- if (nodeAttributes.hasEventNotifier())
+ }
+ if (nodeAttributes.hasEventNotifier()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_EVENTNOTIFIER;
attr->eventNotifier = nodeAttributes.eventNotifier();
+ }
break;
}
default:
@@ -1082,17 +1128,24 @@ UA_ExtensionObject Open62541AsyncBackend::assembleNodeAttributes(const QOpcUaNod
}
UA_ObjectAttributes *attr = reinterpret_cast<UA_ObjectAttributes *>(obj.content.decoded.data);
- attr->specifiedAttributes = nodeAttributes.mask();
- if (nodeAttributes.hasDisplayName())
+ if (nodeAttributes.hasDisplayName()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_DISPLAYNAME;
QOpen62541ValueConverter::scalarFromQt<UA_LocalizedText, QOpcUa::QLocalizedText>(
nodeAttributes.displayName(), &attr->displayName);
- if (nodeAttributes.hasDescription())
+ }
+ if (nodeAttributes.hasDescription()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_DESCRIPTION;
QOpen62541ValueConverter::scalarFromQt<UA_LocalizedText, QOpcUa::QLocalizedText>(
nodeAttributes.description(), &attr->description);
- if (nodeAttributes.hasWriteMask())
+ }
+ if (nodeAttributes.hasWriteMask()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_WRITEMASK;
attr->writeMask = nodeAttributes.writeMask();
- if (nodeAttributes.hasUserWriteMask())
+ }
+ if (nodeAttributes.hasUserWriteMask()) {
+ attr->specifiedAttributes |= UA_NODEATTRIBUTESMASK_USERWRITEMASK;
attr->userWriteMask = nodeAttributes.userWriteMask();
+ }
return obj;
}