diff options
author | Jannis Voelker <jannis.voelker@basyskom.com> | 2018-09-17 08:14:27 +0200 |
---|---|---|
committer | Rainer Keller <Rainer.Keller@qt.io> | 2018-09-17 13:46:28 +0000 |
commit | d1888ef6c83ea2d6bc582fff3f66364550d84f22 (patch) | |
tree | 089f8dc8ac2cb8716b441b389f763e28edc80573 /src | |
parent | cdf465babd7fbf406498d9963be28084d956e290 (diff) |
Rename QOpcUa::NodeIds::NS0 to QOpcUa::NodeIds::Namespace0
The abbreviation "ns0" is also removed from the converter
functions in qopcuatype.cpp.
Change-Id: Ic8e9aed4891f9e550f4e00105182744f1eb9b2e3
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/opcua/client/qopcuaclient.cpp | 6 | ||||
-rw-r--r-- | src/opcua/client/qopcuanodeids.cpp | 8 | ||||
-rw-r--r-- | src/opcua/client/qopcuanodeids.h | 4 | ||||
-rw-r--r-- | src/opcua/client/qopcuatype.cpp | 26 | ||||
-rw-r--r-- | src/opcua/client/qopcuatype.h | 6 | ||||
-rw-r--r-- | src/opcua/configure.json | 4 | ||||
-rw-r--r-- | src/plugins/opcua/open62541/qopen62541valueconverter.cpp | 26 | ||||
-rw-r--r-- | src/plugins/opcua/uacpp/quacppvalueconverter.cpp | 28 |
8 files changed, 54 insertions, 54 deletions
diff --git a/src/opcua/client/qopcuaclient.cpp b/src/opcua/client/qopcuaclient.cpp index f484df7..aec0667 100644 --- a/src/opcua/client/qopcuaclient.cpp +++ b/src/opcua/client/qopcuaclient.cpp @@ -488,7 +488,7 @@ QOpcUa::QQualifiedName QOpcUaClient::qualifiedNameFromNamespaceUri(const QString attributes.setDisplayName(QOpcUa::QLocalizedText("en", "My new Variable node")); attributes.setDescription(QOpcUa::QLocalizedText("en", "A node which has been added at runtime")); attributes.setValue(23.0, QOpcUa::Types::Double); - attributes.setDataTypeId(QOpcUa::ns0ID(QOpcUa::NodeIds::NS0::Double)); + attributes.setDataTypeId(QOpcUa::ns0ID(QOpcUa::NodeIds::Namespace0::Double)); attributes.setValueRank(-2); // Scalar or array attributes.setAccessLevel(QOpcUa::AccessLevelBit::CurrentRead); attributes.setUserAccessLevel(QOpcUa::AccessLevelBit::CurrentRead); @@ -552,7 +552,7 @@ bool QOpcUaClient::deleteNode(const QString &nodeId, bool deleteTargetReferences \code QOpcUaAddReferenceItem item; - item.setSourceNodeId(QOpcUa::ns0ID(QOpcUa::NodeIds::NS0::ObjectsFolder)); + item.setSourceNodeId(QOpcUa::namespace0Id(QOpcUa::NodeIds::Namespace0::ObjectsFolder)); item.setReferenceTypeId(QOpcUa::nodeIdFromInteger(0, static_cast<quint32>(QOpcUa::ReferenceTypeId::Organizes))); item.setIsForward(true); item.setTargetNodeId(QOpcUa::QExpandedNodeId("ns=3;s=MyNewVariableNode")); @@ -583,7 +583,7 @@ bool QOpcUaClient::addReference(const QOpcUaAddReferenceItem &referenceToAdd) \code QOpcUaDeleteReferenceItem item; - item.setSourceNodeId(QOpcUa::ns0ID(QOpcUa::NodeIds::NS0::ObjectsFolder)); + item.setSourceNodeId(QOpcUa::namespace0Id(QOpcUa::NodeIds::Namespace0::ObjectsFolder)); item.setReferenceTypeId(QOpcUa::nodeIdFromInteger(0, static_cast<quint32>(QOpcUa::ReferenceTypeId::Organizes))); item.setIsForward(true); item.setTargetNodeId(QOpcUa::QExpandedNodeId("ns=3;s=MyNewVariableNode")); diff --git a/src/opcua/client/qopcuanodeids.cpp b/src/opcua/client/qopcuanodeids.cpp index 14807d6..707e214 100644 --- a/src/opcua/client/qopcuanodeids.cpp +++ b/src/opcua/client/qopcuanodeids.cpp @@ -46,17 +46,17 @@ QT_BEGIN_NAMESPACE */ /*! - \enum QOpcUa::NodeIds::NS0 + \enum QOpcUa::NodeIds::Namespace0 Contains all numeric node identifiers from namespace 0 defined in the OPC Foundation's \l {https://opcfoundation.org/UA/schemas/1.03/NodeIds.csv} {NodeIds.csv} file. The values in this enum follow the naming from the CSV file and can be converted between - enum and node id string using \l QOpcUa::ns0ID() and \l QOpcUa::ns0IDFromNodeId(). - \l QOpcUa::ns0IDName() provides a conversion from enum value to the name string from the CSV file. + enum and node id string using \l QOpcUa::namespace0Id() and \l QOpcUa::namespace0IdFromNodeId(). + \l QOpcUa::namespace0IdName() provides a conversion from enum value to the name string from the CSV file. \code - QScopedPointer<QOpcUaNode> rootNode(client->node(QOpcUa::ns0ID(QOpcUa::NodeIds::RootFolder))); + QScopedPointer<QOpcUaNode> rootNode(client->node(QOpcUa::namespace0Id(QOpcUa::NodeIds::RootFolder))); \endcode \value Unknown diff --git a/src/opcua/client/qopcuanodeids.h b/src/opcua/client/qopcuanodeids.h index ee8bdda..6a4dfbb 100644 --- a/src/opcua/client/qopcuanodeids.h +++ b/src/opcua/client/qopcuanodeids.h @@ -49,7 +49,7 @@ namespace QOpcUa { Q_OPCUA_EXPORT Q_NAMESPACE #endif - enum class NS0 : quint32 { + enum class Namespace0 : quint32 { Unknown = 0, Boolean = 1, SByte = 2, @@ -5799,7 +5799,7 @@ namespace QOpcUa { Server_Namespaces_OPCUANamespaceUri_NamespaceFile_ExportNamespace = 15211, }; #ifndef QT_OPCUA_NO_NS0IDNAMES - Q_ENUM_NS(NS0) + Q_ENUM_NS(Namespace0) #endif } } diff --git a/src/opcua/client/qopcuatype.cpp b/src/opcua/client/qopcuatype.cpp index 4512b17..4d97802 100644 --- a/src/opcua/client/qopcuatype.cpp +++ b/src/opcua/client/qopcuatype.cpp @@ -947,28 +947,28 @@ bool QOpcUa::nodeIdEquals(const QString &first, const QString &second) /*! Returns a node id string for the namespace 0 identifier \a id. */ -QString QOpcUa::ns0ID(QOpcUa::NodeIds::NS0 id) +QString QOpcUa::namespace0Id(QOpcUa::NodeIds::Namespace0 id) { return QStringLiteral("ns=0;i=%1").arg(quint32(id)); } /*! - Returns the enum value from \l QOpcUa::NodeIds::NS0 for \a nodeId. + Returns the enum value from \l QOpcUa::NodeIds::Namespace0 for \a nodeId. If the node id is not in namespace 0 or doesn't have a numeric identifier which is part of the OPC Foundation's NodeIds.csv file, - \l {QOpcUa::NodeIds::NS0} {Unknown} is returned. + \l {QOpcUa::NodeIds::Namespace0} {Unknown} is returned. If Qt OPC UA has been configured with -no-feature-ns0idnames, the check if the numeric identifier is part of the NodeIds.csv file is omitted. If the node id is in namespace 0 and has a numeric identifier, the identifier is returned regardless if it - is part of the \l QOpcUa::NodeIds::NS0 enum. + is part of the \l QOpcUa::NodeIds::Namespace0 enum. */ -QOpcUa::NodeIds::NS0 QOpcUa::ns0IDFromNodeId(const QString &nodeId) +QOpcUa::NodeIds::Namespace0 QOpcUa::namespace0IdFromNodeId(const QString &nodeId) { if (!nodeId.startsWith(QLatin1String("ns=0;i="))) - return QOpcUa::NodeIds::NS0::Unknown; + return QOpcUa::NodeIds::Namespace0::Unknown; QStringRef sr = nodeId.midRef(7); @@ -976,14 +976,14 @@ QOpcUa::NodeIds::NS0 QOpcUa::ns0IDFromNodeId(const QString &nodeId) quint32 identifier = sr.toUInt(&ok); if (!ok) - return QOpcUa::NodeIds::NS0::Unknown; + return QOpcUa::NodeIds::Namespace0::Unknown; #ifndef QT_OPCUA_NO_NS0IDNAMES - if (!QMetaEnum::fromType<QOpcUa::NodeIds::NS0>().valueToKey(identifier)) - return QOpcUa::NodeIds::NS0::Unknown; + if (!QMetaEnum::fromType<QOpcUa::NodeIds::Namespace0>().valueToKey(identifier)) + return QOpcUa::NodeIds::Namespace0::Unknown; #endif - return QOpcUa::NodeIds::NS0(identifier); + return QOpcUa::NodeIds::Namespace0(identifier); } /*! @@ -992,15 +992,15 @@ QOpcUa::NodeIds::NS0 QOpcUa::ns0IDFromNodeId(const QString &nodeId) If \a id is unknown or Qt OPC UA has been configured with -no-feature-ns0idnames, an empty string is returned. */ -QString QOpcUa::ns0IDName(QOpcUa::NodeIds::NS0 id) +QString QOpcUa::namespace0IdName(QOpcUa::NodeIds::Namespace0 id) { #ifdef QT_OPCUA_NO_NS0IDNAMES Q_UNUSED(id); return QString(); #else - if (id == QOpcUa::NodeIds::NS0::Unknown) + if (id == QOpcUa::NodeIds::Namespace0::Unknown) return QString(); - return QString::fromUtf8(QMetaEnum::fromType<QOpcUa::NodeIds::NS0>().valueToKey(quint32(id))); + return QString::fromUtf8(QMetaEnum::fromType<QOpcUa::NodeIds::Namespace0>().valueToKey(quint32(id))); #endif } diff --git a/src/opcua/client/qopcuatype.h b/src/opcua/client/qopcuatype.h index 77905be..1aea724 100644 --- a/src/opcua/client/qopcuatype.h +++ b/src/opcua/client/qopcuatype.h @@ -482,9 +482,9 @@ Q_OPCUA_EXPORT QString nodeIdFromReferenceType(QOpcUa::ReferenceTypeId reference Q_OPCUA_EXPORT bool nodeIdStringSplit(const QString &nodeIdString, quint16 *nsIndex, QString *identifier, char *identifierType); Q_OPCUA_EXPORT bool nodeIdEquals(const QString &first, const QString &second); -Q_OPCUA_EXPORT QString ns0ID(QOpcUa::NodeIds::NS0 id); -Q_OPCUA_EXPORT QOpcUa::NodeIds::NS0 ns0IDFromNodeId(const QString &nodeId); -Q_OPCUA_EXPORT QString ns0IDName(QOpcUa::NodeIds::NS0 id); +Q_OPCUA_EXPORT QString namespace0Id(QOpcUa::NodeIds::Namespace0 id); +Q_OPCUA_EXPORT QOpcUa::NodeIds::Namespace0 namespace0IdFromNodeId(const QString &nodeId); +Q_OPCUA_EXPORT QString namespace0IdName(QOpcUa::NodeIds::Namespace0 id); typedef QPair<QVariant, QOpcUa::Types> TypedVariant; diff --git a/src/opcua/configure.json b/src/opcua/configure.json index 8a7dd97..5cdc63e 100644 --- a/src/opcua/configure.json +++ b/src/opcua/configure.json @@ -55,12 +55,12 @@ }, "ns0idnames": { "label": "Support for namespace 0 NodeId names", - "purpose": "Provides names for the QOpcUa::NodeIds::NS0 enum.", + "purpose": "Provides names for the QOpcUa::NodeIds::Namespace0 enum.", "output": [ "privateFeature" ] }, "ns0idgenerator": { "label": "Namespace 0 NodeIds generator", - "purpose": "Build a generator for updating the QOpcUa::NodeIds::NS0 enum from the NodeIds.csv file.", + "purpose": "Build a generator for updating the QOpcUa::NodeIds::Namespace0 enum from the NodeIds.csv file.", "autoDetect": "false", "output": [ "privateFeature" ] } diff --git a/src/plugins/opcua/open62541/qopen62541valueconverter.cpp b/src/plugins/opcua/open62541/qopen62541valueconverter.cpp index e78cc75..81091dd 100644 --- a/src/plugins/opcua/open62541/qopen62541valueconverter.cpp +++ b/src/plugins/opcua/open62541/qopen62541valueconverter.cpp @@ -413,24 +413,24 @@ QVariant scalarToQt<QVariant, UA_ExtensionObject>(const UA_ExtensionObject *data bool success = false; QVariant result; - NS0 objType = NS0(data->content.encoded.typeId.identifier.numeric); + Namespace0 objType = Namespace0(data->content.encoded.typeId.identifier.numeric); switch (objType) { - case NS0::EUInformation_Encoding_DefaultBinary: + case Namespace0::EUInformation_Encoding_DefaultBinary: result = decoder.decode<QOpcUa::QEUInformation>(success); break; - case NS0::Range_Encoding_DefaultBinary: + case Namespace0::Range_Encoding_DefaultBinary: result = decoder.decode<QOpcUa::QRange>(success); break; - case NS0::ComplexNumberType_Encoding_DefaultBinary: + case Namespace0::ComplexNumberType_Encoding_DefaultBinary: result = decoder.decode<QOpcUa::QComplexNumber>(success); break; - case NS0::DoubleComplexNumberType_Encoding_DefaultBinary: + case Namespace0::DoubleComplexNumberType_Encoding_DefaultBinary: result = decoder.decode<QOpcUa::QDoubleComplexNumber>(success); break; - case NS0::AxisInformation_Encoding_DefaultBinary: + case Namespace0::AxisInformation_Encoding_DefaultBinary: result = decoder.decode<QOpcUa::QAxisInformation>(success); break; - case NS0::XVType_Encoding_DefaultBinary: + case Namespace0::XVType_Encoding_DefaultBinary: result = decoder.decode<QOpcUa::QXValue>(success); break; default: @@ -566,7 +566,7 @@ void scalarFromQt<UA_ExtensionObject, QOpcUa::QRange>(const QOpcUa::QRange &valu QOpcUaBinaryDataEncoding encoder(&temp); encoder.encode<QOpcUa::QRange>(value); return createExtensionObject(temp, - UA_NODEID_NUMERIC(0,static_cast<UA_UInt32>(NS0::Range_Encoding_DefaultBinary)), ptr); + UA_NODEID_NUMERIC(0,static_cast<UA_UInt32>(Namespace0::Range_Encoding_DefaultBinary)), ptr); } template<> @@ -576,7 +576,7 @@ void scalarFromQt<UA_ExtensionObject, QOpcUa::QEUInformation>(const QOpcUa::QEUI QOpcUaBinaryDataEncoding encoder(&temp); encoder.encode<QOpcUa::QEUInformation>(value); return createExtensionObject(temp, - UA_NODEID_NUMERIC(0, static_cast<UA_UInt32>(NS0::EUInformation_Encoding_DefaultBinary)), ptr); + UA_NODEID_NUMERIC(0, static_cast<UA_UInt32>(Namespace0::EUInformation_Encoding_DefaultBinary)), ptr); } template<> @@ -586,7 +586,7 @@ void scalarFromQt<UA_ExtensionObject, QOpcUa::QComplexNumber>(const QOpcUa::QCom QOpcUaBinaryDataEncoding encoder(&temp); encoder.encode<QOpcUa::QComplexNumber>(value); return createExtensionObject(temp, - UA_NODEID_NUMERIC(0, static_cast<UA_UInt32>(NS0::ComplexNumberType_Encoding_DefaultBinary)), ptr); + UA_NODEID_NUMERIC(0, static_cast<UA_UInt32>(Namespace0::ComplexNumberType_Encoding_DefaultBinary)), ptr); } template<> @@ -596,7 +596,7 @@ void scalarFromQt<UA_ExtensionObject, QOpcUa::QDoubleComplexNumber>(const QOpcUa QOpcUaBinaryDataEncoding encoder(&temp); encoder.encode<QOpcUa::QDoubleComplexNumber>(value); return createExtensionObject(temp, - UA_NODEID_NUMERIC(0, static_cast<UA_UInt32>(NS0::DoubleComplexNumberType_Encoding_DefaultBinary)), ptr); + UA_NODEID_NUMERIC(0, static_cast<UA_UInt32>(Namespace0::DoubleComplexNumberType_Encoding_DefaultBinary)), ptr); } template<> @@ -606,7 +606,7 @@ void scalarFromQt<UA_ExtensionObject, QOpcUa::QAxisInformation>(const QOpcUa::QA QOpcUaBinaryDataEncoding encoder(&temp); encoder.encode<QOpcUa::QAxisInformation>(value); return createExtensionObject(temp, - UA_NODEID_NUMERIC(0, static_cast<UA_UInt32>(NS0::AxisInformation_Encoding_DefaultBinary)), ptr); + UA_NODEID_NUMERIC(0, static_cast<UA_UInt32>(Namespace0::AxisInformation_Encoding_DefaultBinary)), ptr); } template<> @@ -616,7 +616,7 @@ void scalarFromQt<UA_ExtensionObject, QOpcUa::QXValue>(const QOpcUa::QXValue &va QOpcUaBinaryDataEncoding encoder(&temp); encoder.encode<QOpcUa::QXValue>(value); return createExtensionObject(temp, - UA_NODEID_NUMERIC(0, static_cast<UA_UInt32>(NS0::XVType_Encoding_DefaultBinary)), ptr); + UA_NODEID_NUMERIC(0, static_cast<UA_UInt32>(Namespace0::XVType_Encoding_DefaultBinary)), ptr); } template<> diff --git a/src/plugins/opcua/uacpp/quacppvalueconverter.cpp b/src/plugins/opcua/uacpp/quacppvalueconverter.cpp index a09c706..58d0eb1 100644 --- a/src/plugins/opcua/uacpp/quacppvalueconverter.cpp +++ b/src/plugins/opcua/uacpp/quacppvalueconverter.cpp @@ -283,9 +283,9 @@ QVariant scalarToQVariant<QVariant, OpcUa_ExtensionObject>(OpcUa_ExtensionObject bool success = true; QVariant result; - NS0 objType = NS0(data->TypeId.NodeId.Identifier.Numeric); + Namespace0 objType = Namespace0(data->TypeId.NodeId.Identifier.Numeric); switch (objType) { - case NS0::EUInformation_Encoding_DefaultBinary: { + case Namespace0::EUInformation_Encoding_DefaultBinary: { // ### TODO: Check for non ns=0 cases. Apparently there is an auto-conversion happening in the // underlaying OpcUA SDK for ns=0 nodes, hence we do not receive a ByteStream, but rather an // already decoded object. For non ns=0, we might be able to use the generic decoder from the module. @@ -295,16 +295,16 @@ QVariant scalarToQVariant<QVariant, OpcUa_ExtensionObject>(OpcUa_ExtensionObject result = QVariant::fromValue(euinfo); break; } - case NS0::Range_Encoding_DefaultBinary: + case Namespace0::Range_Encoding_DefaultBinary: result = QVariant::fromValue(decoder.decode<QOpcUa::QRange>(success)); break; - case NS0::ComplexNumberType_Encoding_DefaultBinary: + case Namespace0::ComplexNumberType_Encoding_DefaultBinary: result = QVariant::fromValue(decoder.decode<QOpcUa::QComplexNumber>(success)); break; - case NS0::DoubleComplexNumberType_Encoding_DefaultBinary: + case Namespace0::DoubleComplexNumberType_Encoding_DefaultBinary: result = QVariant::fromValue(decoder.decode<QOpcUa::QDoubleComplexNumber>(success)); break; - case NS0::AxisInformation_Encoding_DefaultBinary: { + case Namespace0::AxisInformation_Encoding_DefaultBinary: { UaAxisInformation info(*data); const UaRange uaRange = info.getEURange(); const UaLocalizedText uaTitle = info.getTitle(); @@ -323,7 +323,7 @@ QVariant scalarToQVariant<QVariant, OpcUa_ExtensionObject>(OpcUa_ExtensionObject result = QVariant::fromValue(qAxisInfo); break; } - case NS0::XVType_Encoding_DefaultBinary: + case Namespace0::XVType_Encoding_DefaultBinary: result = QVariant::fromValue(decoder.decode<QOpcUa::QXValue>(success)); break; default: @@ -544,7 +544,7 @@ void scalarFromQVariant<OpcUa_Guid, QUuid>(const QVariant &var, OpcUa_Guid *ptr) memcpy(ptr->Data4, uuid.data4, sizeof(uuid.data4)); } -void createExtensionObject(QByteArray &data, NS0 id, OpcUa_ExtensionObject *ptr) +void createExtensionObject(QByteArray &data, Namespace0 id, OpcUa_ExtensionObject *ptr) { OpcUa_ExtensionObject_Initialize(ptr); UaByteArray arr(data.data(), data.length()); @@ -562,7 +562,7 @@ void scalarFromQVariant<OpcUa_ExtensionObject, QOpcUa::QRange>(const QVariant &v QByteArray temp; QOpcUaBinaryDataEncoding encoder(&temp); encoder.encode<QOpcUa::QRange>(range); - return createExtensionObject(temp, NS0::Range_Encoding_DefaultBinary, ptr); + return createExtensionObject(temp, Namespace0::Range_Encoding_DefaultBinary, ptr); } template<> @@ -572,7 +572,7 @@ void scalarFromQVariant<OpcUa_ExtensionObject, QOpcUa::QEUInformation>(const QVa QByteArray temp; QOpcUaBinaryDataEncoding encoder(&temp); encoder.encode<QOpcUa::QEUInformation>(info); - return createExtensionObject(temp, NS0::EUInformation_Encoding_DefaultBinary, ptr); + return createExtensionObject(temp, Namespace0::EUInformation_Encoding_DefaultBinary, ptr); } template<> @@ -582,7 +582,7 @@ void scalarFromQVariant<OpcUa_ExtensionObject, QOpcUa::QComplexNumber>(const QVa QByteArray temp; QOpcUaBinaryDataEncoding encoder(&temp); encoder.encode<QOpcUa::QComplexNumber>(num); - return createExtensionObject(temp, NS0::ComplexNumberType_Encoding_DefaultBinary, ptr); + return createExtensionObject(temp, Namespace0::ComplexNumberType_Encoding_DefaultBinary, ptr); } template<> @@ -592,7 +592,7 @@ void scalarFromQVariant<OpcUa_ExtensionObject, QOpcUa::QDoubleComplexNumber>(con QByteArray temp; QOpcUaBinaryDataEncoding encoder(&temp); encoder.encode<QOpcUa::QDoubleComplexNumber>(num); - return createExtensionObject(temp, NS0::DoubleComplexNumberType_Encoding_DefaultBinary, ptr); + return createExtensionObject(temp, Namespace0::DoubleComplexNumberType_Encoding_DefaultBinary, ptr); } template<> @@ -602,7 +602,7 @@ void scalarFromQVariant<OpcUa_ExtensionObject, QOpcUa::QAxisInformation>(const Q QByteArray temp; QOpcUaBinaryDataEncoding encoder(&temp); encoder.encode<QOpcUa::QAxisInformation>(num); - return createExtensionObject(temp, NS0::AxisInformation_Encoding_DefaultBinary, ptr); + return createExtensionObject(temp, Namespace0::AxisInformation_Encoding_DefaultBinary, ptr); } template<> @@ -612,7 +612,7 @@ void scalarFromQVariant<OpcUa_ExtensionObject, QOpcUa::QXValue>(const QVariant & QByteArray temp; QOpcUaBinaryDataEncoding encoder(&temp); encoder.encode<QOpcUa::QXValue>(num); - return createExtensionObject(temp, NS0::XVType_Encoding_DefaultBinary, ptr); + return createExtensionObject(temp, Namespace0::XVType_Encoding_DefaultBinary, ptr); } template<> |