├── .tag ├── tests ├── open62541-testserver │ ├── pki │ │ ├── trusted │ │ │ └── certs │ │ │ │ ├── .gitkeep │ │ │ │ ├── opcuaviewer.der │ │ │ │ └── tst_security.der │ │ └── own │ │ │ ├── certs │ │ │ └── open62541-testserver.der │ │ │ └── private │ │ │ └── open62541-testserver.der │ ├── TestModel │ │ ├── qtopcuatestmodel.ua │ │ └── qtopcuatestmodel.tt2pro │ ├── certs.qrc │ ├── generated │ │ └── namespace_qtopcuatestmodel_generated.h │ └── open62541-testserver.pro ├── auto │ ├── security │ │ ├── pki │ │ │ ├── own │ │ │ │ ├── certs │ │ │ │ │ ├── invalid_cert.der │ │ │ │ │ └── tst_security.der │ │ │ │ └── private │ │ │ │ │ └── privateKeyWithoutPassword.pem │ │ │ └── trusted │ │ │ │ ├── certs │ │ │ │ ├── ca.der │ │ │ │ └── open62541-testserver.der │ │ │ │ └── crl │ │ │ │ └── ca.crl.pem │ │ └── CMakeLists.txt │ ├── codegenerator │ │ ├── testids.csv │ │ └── CMakeLists.txt │ ├── declarative │ │ ├── BLACKLIST │ │ ├── tst_security.qml │ │ ├── tst_absolutenode.qml │ │ ├── tst_relativenode.qml │ │ ├── tst_authorization.qml │ │ ├── tst_batchReadWrite.qml │ │ ├── tst_subscriptions.qml │ │ ├── tst_dataChangeFilter.qml │ │ ├── tst_discovery.qml │ │ ├── tst_methodnode.qml │ │ ├── tst_monitoringFilterTest.qml │ │ ├── CompletionLoggingTestCase.qml │ │ ├── CMakeLists.txt │ │ ├── tst_generic.qml │ │ ├── BackendTestMultiplier.qml │ │ └── SecurityTest.qml │ ├── cmake │ │ └── CMakeLists.txt │ ├── x509 │ │ └── CMakeLists.txt │ ├── connection │ │ └── CMakeLists.txt │ ├── CMakeLists.txt │ ├── clientSetupInCpp │ │ └── CMakeLists.txt │ └── qopcuaclient │ │ └── CMakeLists.txt ├── manual │ ├── manual.pro │ ├── gds │ │ ├── gds.pro │ │ └── CMakeLists.txt │ └── CMakeLists.txt └── CMakeLists.txt ├── config.tests ├── mbedtls │ ├── mbedtls.pro │ └── main.cpp ├── open62541 │ ├── open62541.pro │ └── main.cpp └── uacpp │ ├── uacpp.pro │ └── main.cpp ├── examples ├── examples.pro ├── opcua │ ├── waterpump │ │ ├── waterpump.pro │ │ ├── waterpump-qml │ │ │ ├── doc │ │ │ │ └── images │ │ │ │ │ └── tankexample.png │ │ │ ├── waterpump-qml.pro │ │ │ ├── qml.qrc │ │ │ ├── TankDisplay.qml │ │ │ ├── machine │ │ │ │ └── Tank.qml │ │ │ ├── Pump.qml │ │ │ ├── Tank2Unit.qml │ │ │ ├── Tank1Unit.qml │ │ │ ├── ValueDisplay.qml │ │ │ ├── ServerControl.qml │ │ │ └── CMakeLists.txt │ │ ├── waterpump-qmlcpp │ │ │ ├── doc │ │ │ │ └── images │ │ │ │ │ └── tankexample.png │ │ │ ├── waterpump-qmlcpp.pro │ │ │ ├── qml.qrc │ │ │ ├── Tank.qml │ │ │ ├── main.qml │ │ │ ├── ServerControl.qml │ │ │ ├── Pump.qml │ │ │ ├── TankSimulation.qml │ │ │ ├── Tank2Unit.qml │ │ │ ├── Tank1Unit.qml │ │ │ ├── ValueDisplay.qml │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── simulationserver │ │ │ ├── main.cpp │ │ │ └── simulationserver.pro │ ├── opcuaviewer │ │ ├── pki │ │ │ ├── trusted │ │ │ │ ├── certs │ │ │ │ │ ├── ca.der │ │ │ │ │ ├── open62541-testserver.der │ │ │ │ │ └── 3d8ec65c47524d6ad67bed912c19a895.der │ │ │ │ └── crl │ │ │ │ │ └── ca.crl.pem │ │ │ └── own │ │ │ │ ├── certs │ │ │ │ └── opcuaviewer.der │ │ │ │ └── private │ │ │ │ └── opcuaviewer.pem │ │ ├── doc │ │ │ ├── images │ │ │ │ └── opcuaviewer.png │ │ │ └── opcuaviewer.qdoc │ │ ├── opcuaviewer.pro │ │ ├── certificatedialog.h │ │ ├── main.cpp │ │ ├── opcuamodel.h │ │ └── CMakeLists.txt │ ├── x509 │ │ ├── x509.pro │ │ ├── CMakeLists.txt │ │ └── doc │ │ │ └── x509.qdoc │ ├── opcua.pro │ ├── doc │ │ └── qtopcua-examples.qdoc │ └── CMakeLists.txt └── CMakeLists.txt ├── .gitreview ├── src ├── declarative_opcua │ ├── doc │ │ └── snippets │ │ │ ├── snippets.pro │ │ │ └── basic │ │ │ ├── basic.pro │ │ │ ├── qml.qrc │ │ │ └── main.cpp │ ├── opcuaoperandbase.cpp │ ├── opcuaoperandbase_p.h │ ├── opcuaattributevalue_p.h │ ├── opcuanodeid_p.h │ ├── opcuaelementoperand_p.h │ ├── opcuaattributecache_p.h │ ├── opcuamethodargument_p.h │ ├── opcuaattributevalue.cpp │ ├── opcuaforeign.cpp │ ├── opcualiteraloperand_p.h │ ├── opcuaforeign_p.h │ ├── opcuawriteresult_p.h │ └── opcuaattributecache.cpp ├── plugins │ ├── CMakeLists.txt │ └── opcua │ │ ├── open62541 │ │ ├── open62541-metadata.json │ │ ├── qopen62541plugin.h │ │ ├── qopen62541.h │ │ └── qopen62541plugin.cpp │ │ └── CMakeLists.txt ├── opcua │ ├── core │ │ ├── qopcuaplugin.cpp │ │ ├── qopcuaplugin.h │ │ └── qopcuaprovider.h │ ├── qopcuaglobal.h │ ├── doc │ │ └── src │ │ │ └── qtopcua-toc.qdoc │ ├── x509 │ │ ├── qopcuax509utils.cpp │ │ ├── qopcuax509extension_p.h │ │ ├── qopcuax509extension.h │ │ ├── qopcuax509extensionbasicconstraints.h │ │ ├── qopcuax509utils_p.h │ │ ├── qopcuax509extensionsubjectalternativename.h │ │ ├── qopcuax509distinguishedname.h │ │ ├── qopcuakeypair_p.h │ │ ├── qopcuax509extensionextendedkeyusage.h │ │ ├── qopcuax509extensionkeyusage.h │ │ ├── qopcuakeypair.h │ │ └── qopcuax509certificatesigningrequest.h │ ├── client │ │ ├── qopcuanodeimpl.cpp │ │ ├── qopcuarange.h │ │ ├── qopcuaxvalue.h │ │ ├── qopcuacomplexnumber.h │ │ ├── qopcuawriteresult.h │ │ ├── qopcuadoublecomplexnumber.h │ │ ├── qopcuabrowsepathtarget.h │ │ ├── qopcuacontentfilterelementresult.h │ │ ├── qopcuahistorydata.h │ │ ├── qopcuaqualifiedname.h │ │ ├── qopcuaexpandednodeid.h │ │ ├── qopcuaerrorstate.h │ │ ├── qopcuasecuritypolicyuris_p.h │ │ ├── qopcuaeventfilterresult.h │ │ ├── qopcuaapplicationidentity.h │ │ ├── qopcualocalizedtext.h │ │ ├── qopcuareadresult.h │ │ ├── qopcuadeletereferenceitem.h │ │ ├── qopcuareaditem.h │ │ ├── qopcuabrowserequest.h │ │ ├── qopcuaeuinformation.h │ │ ├── qopcuaelementoperand.h │ │ ├── qopcuaauthenticationinformation.h │ │ ├── qopcuaaddreferenceitem.h │ │ ├── qopcuaargument.h │ │ ├── qopcuausertokenpolicy.h │ │ ├── qopcualiteraloperand.h │ │ ├── qopcuahistoryreadresponse.h │ │ ├── qopcuainternaldatatypenode_p.h │ │ ├── qopcuaextensionobject.h │ │ ├── qopcuamultidimensionalarray.h │ │ ├── qopcuaaddnodeitem.h │ │ └── qopcuapkiconfiguration.h │ └── compat │ │ └── removed_api.cpp └── 3rdparty │ ├── open62541 │ ├── AUTHORS │ ├── qt_attribution.json │ ├── MIT │ ├── BSD-3-CLAUSE │ └── REUSE.toml │ └── open62541.pri ├── qt_cmdline.cmake ├── tools ├── tools.pro ├── internalgenerator │ ├── internalgenerator.pro │ └── CMakeLists.txt ├── CMakeLists.txt └── datatypecodegenerator │ ├── util.h │ ├── enumeratedvalue.h │ ├── xmlelement.h │ ├── xmlelement.cpp │ ├── import.h │ ├── enumeratedvalue.cpp │ ├── nodeidgenerator.h │ ├── visitor.h │ ├── util.cpp │ ├── enumeratedtype.h │ ├── import.cpp │ ├── CMakeLists.txt │ ├── dependencydatatypevalidator.h │ ├── typedictionary.h │ ├── enumeratedtype.cpp │ └── structuredtype.h ├── dependencies.yaml ├── dist ├── REUSE.toml ├── changes-5.15.0 ├── changes-5.14.1 ├── changes-5.14.2 ├── changes-5.11.2 ├── changes-5.14.0 ├── changes-5.12.10 └── changes-5.15.2 ├── .cmake.conf ├── LICENSES ├── LicenseRef-Qt-Commercial.txt ├── MIT.txt └── BSD-3-Clause.txt ├── configure.cmake ├── coin ├── module_config.yaml └── axivion │ └── ci_config_linux.json └── CMakeLists.txt /.tag: -------------------------------------------------------------------------------- 1 | 39b2203b2131f5961c52668aa44da197e6ffed44 2 | -------------------------------------------------------------------------------- /tests/open62541-testserver/pki/trusted/certs/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /config.tests/mbedtls/mbedtls.pro: -------------------------------------------------------------------------------- 1 | SOURCES += main.cpp 2 | -------------------------------------------------------------------------------- /config.tests/open62541/open62541.pro: -------------------------------------------------------------------------------- 1 | SOURCES += main.cpp 2 | -------------------------------------------------------------------------------- /examples/examples.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS = opcua 3 | 4 | -------------------------------------------------------------------------------- /tests/auto/security/pki/own/certs/invalid_cert.der: -------------------------------------------------------------------------------- 1 | This is not a valid certificate 2 | -------------------------------------------------------------------------------- /tests/auto/codegenerator/testids.csv: -------------------------------------------------------------------------------- 1 | TestId1,1,Variable 2 | TestId2,2, 3 | TestId3,3,Variable 4 | -------------------------------------------------------------------------------- /.gitreview: -------------------------------------------------------------------------------- 1 | [gerrit] 2 | host=codereview.qt-project.org 3 | project=qt/qtopcua 4 | defaultbranch=dev 5 | -------------------------------------------------------------------------------- /src/declarative_opcua/doc/snippets/snippets.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | linux { 4 | SUBDIRS += basic 5 | } 6 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += simulationserver waterpump-qmlcpp waterpump-qml 3 | -------------------------------------------------------------------------------- /tests/auto/security/pki/trusted/certs/ca.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtopcua/dev/tests/auto/security/pki/trusted/certs/ca.der -------------------------------------------------------------------------------- /src/declarative_opcua/doc/snippets/basic/basic.pro: -------------------------------------------------------------------------------- 1 | QT += quick 2 | CONFIG += c++11 3 | SOURCES += main.cpp 4 | RESOURCES += qml.qrc 5 | -------------------------------------------------------------------------------- /examples/opcua/opcuaviewer/pki/trusted/certs/ca.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtopcua/dev/examples/opcua/opcuaviewer/pki/trusted/certs/ca.der -------------------------------------------------------------------------------- /qt_cmdline.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2025 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | qt_commandline_subconfig(src/opcua) 4 | -------------------------------------------------------------------------------- /src/plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | add_subdirectory(opcua) 5 | -------------------------------------------------------------------------------- /tests/auto/security/pki/own/certs/tst_security.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtopcua/dev/tests/auto/security/pki/own/certs/tst_security.der -------------------------------------------------------------------------------- /tests/manual/manual.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | QT_FOR_CONFIG += opcua-private core-private 4 | qtConfig(ssl):!darwin:!winrt: SUBDIRS += gds 5 | -------------------------------------------------------------------------------- /examples/opcua/opcuaviewer/doc/images/opcuaviewer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtopcua/dev/examples/opcua/opcuaviewer/doc/images/opcuaviewer.png -------------------------------------------------------------------------------- /examples/opcua/opcuaviewer/pki/own/certs/opcuaviewer.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtopcua/dev/examples/opcua/opcuaviewer/pki/own/certs/opcuaviewer.der -------------------------------------------------------------------------------- /src/declarative_opcua/doc/snippets/basic/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | basic.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/open62541-testserver/TestModel/qtopcuatestmodel.ua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtopcua/dev/tests/open62541-testserver/TestModel/qtopcuatestmodel.ua -------------------------------------------------------------------------------- /tests/manual/gds/gds.pro: -------------------------------------------------------------------------------- 1 | TARGET = tst_gds 2 | 3 | QT += testlib opcua network 4 | QT -= gui 5 | CONFIG += testcase 6 | 7 | SOURCES += \ 8 | tst_gds.cpp 9 | -------------------------------------------------------------------------------- /tools/tools.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | QT_FOR_CONFIG += opcua-private 4 | 5 | qtConfig(internalgenerator): { 6 | SUBDIRS += internalgenerator 7 | } 8 | -------------------------------------------------------------------------------- /config.tests/uacpp/uacpp.pro: -------------------------------------------------------------------------------- 1 | SOURCES += main.cpp 2 | 3 | CONFIG(debug, debug|release): \ 4 | LIBS += $$LIBS_DEBUG 5 | else: \ 6 | LIBS += $$LIBS_RELEASE 7 | -------------------------------------------------------------------------------- /tests/open62541-testserver/pki/trusted/certs/opcuaviewer.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtopcua/dev/tests/open62541-testserver/pki/trusted/certs/opcuaviewer.der -------------------------------------------------------------------------------- /tests/open62541-testserver/pki/trusted/certs/tst_security.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtopcua/dev/tests/open62541-testserver/pki/trusted/certs/tst_security.der -------------------------------------------------------------------------------- /tests/auto/security/pki/trusted/certs/open62541-testserver.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtopcua/dev/tests/auto/security/pki/trusted/certs/open62541-testserver.der -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qml/doc/images/tankexample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtopcua/dev/examples/opcua/waterpump/waterpump-qml/doc/images/tankexample.png -------------------------------------------------------------------------------- /tests/open62541-testserver/pki/own/certs/open62541-testserver.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtopcua/dev/tests/open62541-testserver/pki/own/certs/open62541-testserver.der -------------------------------------------------------------------------------- /examples/opcua/opcuaviewer/pki/trusted/certs/open62541-testserver.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtopcua/dev/examples/opcua/opcuaviewer/pki/trusted/certs/open62541-testserver.der -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qmlcpp/doc/images/tankexample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtopcua/dev/examples/opcua/waterpump/waterpump-qmlcpp/doc/images/tankexample.png -------------------------------------------------------------------------------- /examples/opcua/opcuaviewer/pki/trusted/certs/3d8ec65c47524d6ad67bed912c19a895.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtopcua/dev/examples/opcua/opcuaviewer/pki/trusted/certs/3d8ec65c47524d6ad67bed912c19a895.der -------------------------------------------------------------------------------- /tools/internalgenerator/internalgenerator.pro: -------------------------------------------------------------------------------- 1 | QT -= gui 2 | 3 | CONFIG += c++11 4 | 5 | SOURCES += \ 6 | main.cpp 7 | 8 | TARGET = qtopcua-internalgenerator 9 | 10 | load(qt_tool) 11 | -------------------------------------------------------------------------------- /src/plugins/opcua/open62541/open62541-metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "Keys" : [ "open62541" ], 3 | "Provider" : "open62541", 4 | "Version" : "1.0", 5 | "Features" : [ "client" ], 6 | "stability" : 1 7 | } 8 | -------------------------------------------------------------------------------- /dependencies.yaml: -------------------------------------------------------------------------------- 1 | dependencies: 2 | ../qtbase: 3 | ref: df1292e2b96aab02ad6df778d8336e7958ad5d1c 4 | required: true 5 | ../qtdeclarative: 6 | ref: 7ef1d06ce70fa360613dca0b5ff03365ebbc9883 7 | required: true 8 | -------------------------------------------------------------------------------- /tests/manual/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | if(QT_FEATURE_ssl AND QT_FEATURE_gds AND NOT APPLE AND NOT WINRT) 5 | add_subdirectory(gds) 6 | endif() 7 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qml/waterpump-qml.pro: -------------------------------------------------------------------------------- 1 | QT += quick 2 | CONFIG += c++11 3 | SOURCES += main.cpp 4 | RESOURCES += qml.qrc 5 | target.path = $$[QT_INSTALL_EXAMPLES]/opcua/waterpump/waterpump-qml 6 | INSTALLS += target 7 | -------------------------------------------------------------------------------- /examples/opcua/x509/x509.pro: -------------------------------------------------------------------------------- 1 | QT += opcua 2 | QT -= gui 3 | CONFIG += c++11 4 | DEPENDPATH += INCLUDEPATH 5 | 6 | SOURCES += main.cpp 7 | 8 | #install 9 | target.path = $$[QT_INSTALL_EXAMPLES]/opcua/x509 10 | INSTALLS += target 11 | -------------------------------------------------------------------------------- /tests/auto/declarative/BLACKLIST: -------------------------------------------------------------------------------- 1 | # QTBUG-100007 2 | [SubscriptionsTest: open62541: Create String Node Id::test_nodeTest] 3 | macos 4 | # QTBUG-104418 5 | [AbsoluteNodeTest: open62541: Assign int value to double node::test_nodeTest] 6 | macos 7 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | qt_examples_build_begin(EXTERNAL_BUILD) 5 | 6 | add_subdirectory(opcua) 7 | 8 | qt_examples_build_end() 9 | -------------------------------------------------------------------------------- /tests/auto/declarative/tst_security.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only 3 | 4 | import QtQuick 5 | 6 | BackendTestMultiplier { 7 | testName: "SecurityTest" 8 | } 9 | -------------------------------------------------------------------------------- /tests/auto/declarative/tst_absolutenode.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only 3 | 4 | import QtQuick 5 | 6 | BackendTestMultiplier { 7 | testName: "AbsoluteNodeTest" 8 | } 9 | -------------------------------------------------------------------------------- /tests/auto/declarative/tst_relativenode.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only 3 | 4 | import QtQuick 5 | 6 | BackendTestMultiplier { 7 | testName: "RelativenodeTest" 8 | } 9 | -------------------------------------------------------------------------------- /tests/auto/declarative/tst_authorization.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only 3 | 4 | import QtQuick 5 | 6 | BackendTestMultiplier { 7 | testName: "AuthorizationTest" 8 | } 9 | -------------------------------------------------------------------------------- /tests/auto/declarative/tst_batchReadWrite.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only 3 | 4 | import QtQuick 5 | 6 | BackendTestMultiplier { 7 | testName: "BatchReadWriteTest" 8 | } 9 | -------------------------------------------------------------------------------- /tests/auto/declarative/tst_subscriptions.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only 3 | 4 | import QtQuick 5 | 6 | BackendTestMultiplier { 7 | testName: "SubscriptionsTest" 8 | } 9 | -------------------------------------------------------------------------------- /src/plugins/opcua/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | if(NOT INTEGRITY AND NOT VXWORKS AND (QT_FEATURE_open62541 OR QT_FEATURE_system_open62541)) 5 | add_subdirectory(open62541) 6 | endif() 7 | -------------------------------------------------------------------------------- /tests/auto/declarative/tst_dataChangeFilter.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only 3 | 4 | import QtQuick 5 | 6 | BackendTestMultiplier { 7 | testName: "DataChangeFilterTest" 8 | } 9 | -------------------------------------------------------------------------------- /tests/auto/declarative/tst_discovery.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only 3 | 4 | import QtQuick 5 | 6 | BackendTestMultiplier { 7 | testName: "DiscoveryTest" 8 | } 9 | 10 | -------------------------------------------------------------------------------- /tests/auto/declarative/tst_methodnode.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only 3 | 4 | import QtQuick 5 | 6 | BackendTestMultiplier { 7 | testName: "MethodnodeTest" 8 | } 9 | 10 | -------------------------------------------------------------------------------- /tests/auto/declarative/tst_monitoringFilterTest.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only 3 | 4 | import QtQuick 5 | 6 | BackendTestMultiplier { 7 | testName: "MonitoringFilterTest" 8 | } 9 | -------------------------------------------------------------------------------- /dist/REUSE.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[annotations]] 4 | path = ["*"] 5 | precedence = "override" 6 | comment = "Licensed as documentation." 7 | SPDX-FileCopyrightText = "Copyright (C) The Qt Company Ltd." 8 | SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only" 9 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | if(NOT ANDROID) 5 | qt_internal_add_example(simulationserver) 6 | qt_internal_add_example(waterpump-qmlcpp) 7 | qt_internal_add_example(waterpump-qml) 8 | endif() 9 | -------------------------------------------------------------------------------- /tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | if(QT_FEATURE_datatypecodegenerator) 5 | add_subdirectory(datatypecodegenerator) 6 | endif() 7 | 8 | if(QT_FEATURE_internalgenerator) 9 | add_subdirectory(internalgenerator) 10 | endif() 11 | -------------------------------------------------------------------------------- /examples/opcua/opcua.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | qtHaveModule(widgets): SUBDIRS += \ 3 | opcuaviewer \ 4 | 5 | QT_FOR_CONFIG += opcua-private core-private 6 | 7 | qtConfig(gds) { 8 | qtConfig(ssl):!darwin:!winrt: SUBDIRS += x509 9 | } 10 | 11 | qtConfig(open62541) { 12 | qtHaveModule(quick): SUBDIRS += waterpump 13 | } 14 | -------------------------------------------------------------------------------- /tests/open62541-testserver/certs.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | pki/own/private/open62541-testserver.der 4 | pki/own/certs/open62541-testserver.der 5 | pki/trusted/certs/opcuaviewer.der 6 | pki/trusted/certs/tst_security.der 7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qmlcpp/waterpump-qmlcpp.pro: -------------------------------------------------------------------------------- 1 | QT += quick opcua 2 | CONFIG += c++11 3 | 4 | SOURCES += main.cpp \ 5 | opcuamachinebackend.cpp 6 | 7 | RESOURCES += qml.qrc 8 | 9 | HEADERS += \ 10 | opcuamachinebackend.h 11 | 12 | #install 13 | target.path = $$[QT_INSTALL_EXAMPLES]/opcua/waterpump/waterpump-qmlcpp 14 | INSTALLS += target 15 | -------------------------------------------------------------------------------- /examples/opcua/doc/qtopcua-examples.qdoc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, info@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only 3 | 4 | /*! 5 | \title Qt OPC UA Examples 6 | \group qtopcua-examples 7 | \brief List of Qt OPC UA examples. 8 | 9 | The examples show how to use Qt OPC UA from C++ and QML. 10 | 11 | */ 12 | -------------------------------------------------------------------------------- /tests/auto/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | cmake_minimum_required(VERSION 3.16) 5 | 6 | project(qtopcua_cmake_tests) 7 | 8 | enable_testing() 9 | 10 | find_package(Qt6Core REQUIRED) 11 | 12 | include("${_Qt6CTestMacros}") 13 | 14 | _qt_internal_test_module_includes( 15 | OpcUa QOpcUaProvider 16 | ) 17 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | 5 | if(QT_BUILD_STANDALONE_TESTS) 6 | # Add qt_find_package calls for extra dependencies that need to be found when building 7 | # the standalone tests here. 8 | endif() 9 | qt_build_tests() 10 | 11 | if(QT_FEATURE_open62541) 12 | add_subdirectory(open62541-testserver) 13 | endif() 14 | -------------------------------------------------------------------------------- /.cmake.conf: -------------------------------------------------------------------------------- 1 | set(QT_REPO_MODULE_VERSION "6.12.0") 2 | set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1") 3 | 4 | set(QT_EXTRA_INTERNAL_TARGET_DEFINES 5 | "QT_LEAN_HEADERS=1" 6 | "QT_NO_CAST_FROM_ASCII=1" 7 | "QT_NO_CAST_FROM_BYTEARRAY=1" 8 | "QT_NO_CAST_TO_ASCII=1" 9 | "QT_NO_CONTEXTLESS_CONNECT=1" 10 | "QT_NO_FOREACH=1" 11 | "QT_NO_QASCONST=1" 12 | "QT_NO_URL_CAST_FROM_STRING=1" 13 | ) 14 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qmlcpp/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | Tank.qml 5 | Tank1Unit.qml 6 | Tank2Unit.qml 7 | ValueDisplay.qml 8 | ServerControl.qml 9 | Pump.qml 10 | TankSimulation.qml 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/opcua/core/qopcuaplugin.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include "qopcuaplugin.h" 5 | 6 | QT_BEGIN_NAMESPACE 7 | 8 | QOpcUaPlugin::QOpcUaPlugin(QObject *parent) 9 | : QObject(parent) 10 | { 11 | } 12 | 13 | QOpcUaPlugin::~QOpcUaPlugin() 14 | { 15 | } 16 | 17 | QT_END_NAMESPACE 18 | -------------------------------------------------------------------------------- /tests/auto/x509/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_x509 Test: 6 | ##################################################################### 7 | 8 | qt_internal_add_test(tst_x509 9 | SOURCES 10 | tst_x509.cpp 11 | LIBRARIES 12 | Qt::Network 13 | Qt::OpcUa 14 | ) 15 | -------------------------------------------------------------------------------- /tests/manual/gds/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | 5 | ##################################################################### 6 | ## tst_gds Test: 7 | ##################################################################### 8 | 9 | qt_internal_add_test(tst_gds 10 | SOURCES 11 | tst_gds.cpp 12 | LIBRARIES 13 | Qt::Network 14 | Qt::OpcUa 15 | ) 16 | -------------------------------------------------------------------------------- /examples/opcua/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | if(TARGET Qt6::Widgets) 5 | qt_internal_add_example(opcuaviewer) 6 | endif() 7 | if(QT_FEATURE_gds AND QT_FEATURE_ssl AND NOT APPLE AND NOT WINRT AND NOT ANDROID) 8 | qt_internal_add_example(x509) 9 | endif() 10 | if(QT_FEATURE_open62541 AND TARGET Qt6::Quick) 11 | add_subdirectory(waterpump) 12 | endif() 13 | -------------------------------------------------------------------------------- /tests/auto/declarative/CompletionLoggingTestCase.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only 3 | 4 | import QtTest 5 | 6 | TestCase { 7 | onCompletedChanged: parent.completedTestCases += (completed ? 1 : -1) 8 | objectName: "TestCase" 9 | 10 | function initTestCase() { 11 | if (SKIP_TESTS) 12 | skip("The tests fails on macOS 26 in CI: QTBUG-139354"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /config.tests/mbedtls/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include 5 | #include 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | mbedtls_pk_context pk; 10 | mbedtls_pk_init( &pk ); 11 | 12 | mbedtls_x509_crt remoteCertificate; 13 | mbedtls_x509_crt_init(&remoteCertificate); 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /tools/datatypecodegenerator/util.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace Util 9 | { 10 | QString indent(int level); 11 | QString lineBreak(int n = 1); 12 | 13 | QString removeNamespace(const QString &typeName); 14 | QString lowerFirstLetter(const QString &temp); 15 | } 16 | -------------------------------------------------------------------------------- /LICENSES/LicenseRef-Qt-Commercial.txt: -------------------------------------------------------------------------------- 1 | Licensees holding valid commercial Qt licenses may use this software in 2 | accordance with the the terms contained in a written agreement between 3 | you and The Qt Company. Alternatively, the terms and conditions that were 4 | accepted by the licensee when buying and/or downloading the 5 | software do apply. 6 | 7 | For the latest licensing terms and conditions, see https://www.qt.io/terms-conditions. 8 | For further information use the contact form at https://www.qt.io/contact-us. 9 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qml/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | TankDisplay.qml 5 | Tank1Unit.qml 6 | Tank2Unit.qml 7 | ValueDisplay.qml 8 | ServerControl.qml 9 | Pump.qml 10 | MachineDisplay.qml 11 | machine/Tank.qml 12 | machine/Machine.qml 13 | 14 | 15 | -------------------------------------------------------------------------------- /tools/internalgenerator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## qtopcua-defaultnodeidsgenerator Tool: 6 | ##################################################################### 7 | 8 | qt_get_tool_target_name(target_name qtopcua-internalgenerator) 9 | qt_internal_add_tool(${target_name} 10 | SOURCES 11 | main.cpp 12 | ) 13 | qt_internal_return_unless_building_tools() 14 | -------------------------------------------------------------------------------- /config.tests/uacpp/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace UaClientSdk; 11 | 12 | int main(int /*argc*/, char ** /*argv*/) 13 | { 14 | 15 | UaPlatformLayer::init(); 16 | UaSession *session = new UaSession; 17 | 18 | UaPlatformLayer::cleanup(); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /configure.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | 5 | 6 | #### Inputs 7 | 8 | 9 | 10 | #### Libraries 11 | 12 | 13 | 14 | #### Tests 15 | 16 | 17 | 18 | #### Features 19 | 20 | 21 | qt_extra_definition("QT_VERSION_STR" "\"${PROJECT_VERSION}\"" PUBLIC) 22 | qt_extra_definition("QT_VERSION_MAJOR" ${PROJECT_VERSION_MAJOR} PUBLIC) 23 | qt_extra_definition("QT_VERSION_MINOR" ${PROJECT_VERSION_MINOR} PUBLIC) 24 | qt_extra_definition("QT_VERSION_PATCH" ${PROJECT_VERSION_PATCH} PUBLIC) 25 | -------------------------------------------------------------------------------- /tests/auto/connection/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_connection Test: 6 | ##################################################################### 7 | 8 | qt_internal_add_test(tst_connection 9 | SOURCES 10 | tst_connection.cpp 11 | LIBRARIES 12 | Qt::OpcUa 13 | ) 14 | 15 | if (WIN32) 16 | target_compile_definitions(tst_connection PRIVATE TESTS_CMAKE_SPECIFIC_PATH) 17 | endif() 18 | -------------------------------------------------------------------------------- /src/opcua/qopcuaglobal.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QTOPCUAGLOBAL_H 5 | #define QTOPCUAGLOBAL_H 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | QT_BEGIN_NAMESPACE 12 | 13 | Q_DECLARE_LOGGING_CATEGORY(QT_OPCUA) 14 | Q_DECLARE_LOGGING_CATEGORY(QT_OPCUA_PLUGINS_QML) 15 | 16 | QT_END_NAMESPACE 17 | 18 | 19 | #endif // QTOPCUAGLOBAL_H 20 | 21 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qml/TankDisplay.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | import QtQuick 5 | 6 | Rectangle { 7 | property real percentFilled: 0 8 | color: "lightgrey" 9 | width: parent.width 10 | height: parent.height 11 | Rectangle { 12 | y: parent.height - percentFilled * (parent.height / 100) 13 | width: parent.width 14 | height: percentFilled * (parent.height / 100) 15 | color: "#00BFFF" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/opcua/opcuaviewer/doc/opcuaviewer.qdoc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only 3 | 4 | /*! 5 | \example opcuaviewer 6 | \ingroup qtopcua-examples 7 | \title Qt OPC UA Viewer 8 | \examplecategory {Data Processing & I/O} 9 | \brief Using the model/view approach to display all nodes of an 10 | OPC UA server in a tree view. 11 | 12 | \e {Qt OPC UA Viewer} uses the model/view approach to display all nodes of an 13 | OPC UA server in a \l QTreeView. 14 | 15 | \image opcuaviewer.png 16 | */ 17 | -------------------------------------------------------------------------------- /src/3rdparty/open62541/AUTHORS: -------------------------------------------------------------------------------- 1 | The authors of open62541 are (in alphabetical order) 2 | 3 | Bauer, Maximilian 4 | Ebrahimi, Reza 5 | Graube, Markus 6 | Gruener, Sten 7 | Iatrou, Chris Paul 8 | Jeromin, Holger 9 | Palm, Florian 10 | Pfrommer, Julius 11 | Profanter, Stefan 12 | Stalder, Thomas 13 | Urbas, Leon 14 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qmlcpp/Tank.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | import QtQuick 5 | 6 | Rectangle { 7 | id: root 8 | 9 | property real percentFilled: 0 10 | 11 | color: "lightgrey" 12 | width: parent.width 13 | height: parent.height 14 | 15 | Rectangle { 16 | y: parent.height - root.percentFilled * (parent.height / 100) 17 | width: parent.width 18 | height: root.percentFilled * (parent.height / 100) 19 | color: "#00BFFF" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/open62541-testserver/generated/namespace_qtopcuatestmodel_generated.h: -------------------------------------------------------------------------------- 1 | /* WARNING: This is a generated file. 2 | * Any manual changes will be overwritten. */ 3 | 4 | #ifndef NAMESPACE_QTOPCUATESTMODEL_GENERATED_H_ 5 | #define NAMESPACE_QTOPCUATESTMODEL_GENERATED_H_ 6 | 7 | 8 | #ifdef UA_ENABLE_AMALGAMATION 9 | # include "open62541.h" 10 | #else 11 | # include 12 | #endif 13 | #include "types_qtopcuatestmodel_generated.h" 14 | 15 | 16 | 17 | _UA_BEGIN_DECLS 18 | 19 | extern UA_StatusCode namespace_qtopcuatestmodel_generated(UA_Server *server); 20 | 21 | _UA_END_DECLS 22 | 23 | #endif /* NAMESPACE_QTOPCUATESTMODEL_GENERATED_H_ */ 24 | -------------------------------------------------------------------------------- /coin/module_config.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | accept_configuration: 3 | condition: property 4 | property: features 5 | not_contains_value: Disable 6 | 7 | instructions: 8 | Build: 9 | - type: EnvironmentVariable 10 | variableName: VERIFY_SOURCE_SBOM 11 | variableValue: "ON" 12 | - !include "{{qt/qtbase}}/coin_module_build_template_v2.yaml" 13 | 14 | Test: 15 | - type: Group 16 | instructions: 17 | - !include "{{qt/qtbase}}/coin_module_test_template_v3.yaml" 18 | - !include "{{qt/qtbase}}/coin_module_test_docs.yaml" 19 | enable_if: 20 | condition: property 21 | property: target.os 22 | not_equals_value: QNX 23 | -------------------------------------------------------------------------------- /tests/open62541-testserver/TestModel/qtopcuatestmodel.tt2pro: -------------------------------------------------------------------------------- 1 | ########################### 2 | # UaModeler Project File # 3 | # Generated at 09.08.2024 # 4 | ########################### 5 | 6 | PROJECTNAME = QtOpcUaTestModel 7 | 8 | TEMPLATESET = ($TEMPLATES)/modeling/v1_0/t0/modeling.tt2set 9 | 10 | MODELS += ($MODELS)/Opc.Ua.NodeSet2.ua \ 11 | qtopcuatestmodel.ua 12 | 13 | COLORS = ($MODELS)/Opc.Ua.NodeSet2.ua: #0000ff\ 14 | qtopcuatestmodel.ua: #008000 15 | 16 | OUTPUTPATH = GridCon 17 | 18 | GENERATE += qtopcuatestmodel.ua 19 | 20 | NODEACCESSINFOROLES += Administrator \ 21 | SecurityAdmin \ 22 | ConfigurationAdmin \ 23 | Operator \ 24 | Observer 25 | 26 | -------------------------------------------------------------------------------- /tests/auto/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | 5 | if(NOT ANDROID) 6 | add_subdirectory(cmake) 7 | add_subdirectory(qopcuaclient) 8 | add_subdirectory(connection) 9 | add_subdirectory(security) 10 | if (QT_FEATURE_datatypecodegenerator) 11 | add_subdirectory(codegenerator) 12 | endif() 13 | if(TARGET Qt::QuickTest AND QT_FEATURE_open62541) 14 | add_subdirectory(declarative) 15 | add_subdirectory(clientSetupInCpp) 16 | endif() 17 | if(QT_FEATURE_gds AND QT_FEATURE_ssl AND NOT APPLE AND NOT WINRT) 18 | add_subdirectory(x509) 19 | endif() 20 | endif() 21 | -------------------------------------------------------------------------------- /tools/datatypecodegenerator/enumeratedvalue.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #pragma once 5 | 6 | #include "xmlelement.h" 7 | 8 | class Visitor; 9 | 10 | class EnumeratedValue : public XmlElement 11 | { 12 | public: 13 | EnumeratedValue(const QString &name, qint32 value); 14 | ~EnumeratedValue() override = default; 15 | 16 | void print() const override; 17 | virtual void accept(Visitor *visitor) override; 18 | 19 | qint32 value() const; 20 | void setValue(qint32 value); 21 | 22 | private: 23 | qint32 m_value; 24 | }; 25 | -------------------------------------------------------------------------------- /src/opcua/doc/src/qtopcua-toc.qdoc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2024 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only 3 | 4 | /*! 5 | \page qtopcua-toc.html 6 | \title Qt OPC UA module topics 7 | 8 | The following list has links to all the individual topics (HTML files) 9 | in the Qt OPC UA module. 10 | 11 | \list 12 | \li \l {Qt OPC UA Overview}{Overview} 13 | \li \l {Using the OpenSSL Dependency for Security Support and GDS} 14 | \li \l {Building Qt OPC UA Open62541 Plugin} 15 | \li \l {The Qt OPC UA data type generator} 16 | \li \l {Creating OPC UA Clients with security support} 17 | \endlist 18 | 19 | */ 20 | -------------------------------------------------------------------------------- /tools/datatypecodegenerator/xmlelement.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | class Visitor; 9 | 10 | class XmlElement 11 | { 12 | public: 13 | XmlElement() = default; 14 | XmlElement(const QString &name); 15 | virtual ~XmlElement() = default; 16 | 17 | void setName(const QString &name); 18 | QString name() const; 19 | QString lowerFirstName() const; 20 | 21 | virtual void print() const; 22 | virtual void accept(Visitor *visitor) = 0; 23 | 24 | private: 25 | QString m_name; 26 | }; 27 | -------------------------------------------------------------------------------- /tests/auto/security/pki/trusted/crl/ca.crl.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN X509 CRL----- 2 | MIIBtDCBnQIBATANBgkqhkiG9w0BAQsFADA5MQswCQYDVQQGEwJERTESMBAGA1UE 3 | CgwJb3BlbjYyNTQxMRYwFAYDVQQDDA1vcGVuNjI1NDEub3JnFw0xOTAyMDUwOTIx 4 | MjZaFw0xOTAzMDcwOTIxMjZaoDAwLjAfBgNVHSMEGDAWgBT2JxGCWDhuet+WnrDX 5 | 1SXW4O8HNTALBgNVHRQEBAICEAAwDQYJKoZIhvcNAQELBQADggEBAF31DhT8Im+Z 6 | QkpkFtUzmM9FfjqD4vrkrCAAA6U382mwn5KDcm4LA+FjFePHgSyk+ytLD03z7hSp 7 | wgyxbldg4yC4GynUp7XcbB4zus6Lym/ayDgGVQEw81c/c7YAelc8u055TBJUcmuX 8 | /XV/JXfSO2ZWM5MZZCev79w8Oj4hmUPp9ZpAJkxt/GYictGSkDpBTMTAWRRenPUe 9 | F4qvkvYMkKMrURLFMfYcqa2ePszxnyjdfi6KXHllsHl0iHduSq1acAdx1G/itoDq 10 | ML7QLS/M/VBYYxSGghLPetanQ+6f+OYztgTuzw2nG4DXxfMhfijoi6LbfFDvy0K+ 11 | mHqhbQW1Go8= 12 | -----END X509 CRL----- 13 | -------------------------------------------------------------------------------- /examples/opcua/opcuaviewer/pki/trusted/crl/ca.crl.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN X509 CRL----- 2 | MIIBtDCBnQIBATANBgkqhkiG9w0BAQsFADA5MQswCQYDVQQGEwJERTESMBAGA1UE 3 | CgwJb3BlbjYyNTQxMRYwFAYDVQQDDA1vcGVuNjI1NDEub3JnFw0xOTAyMDUwOTIx 4 | MjZaFw0xOTAzMDcwOTIxMjZaoDAwLjAfBgNVHSMEGDAWgBT2JxGCWDhuet+WnrDX 5 | 1SXW4O8HNTALBgNVHRQEBAICEAAwDQYJKoZIhvcNAQELBQADggEBAF31DhT8Im+Z 6 | QkpkFtUzmM9FfjqD4vrkrCAAA6U382mwn5KDcm4LA+FjFePHgSyk+ytLD03z7hSp 7 | wgyxbldg4yC4GynUp7XcbB4zus6Lym/ayDgGVQEw81c/c7YAelc8u055TBJUcmuX 8 | /XV/JXfSO2ZWM5MZZCev79w8Oj4hmUPp9ZpAJkxt/GYictGSkDpBTMTAWRRenPUe 9 | F4qvkvYMkKMrURLFMfYcqa2ePszxnyjdfi6KXHllsHl0iHduSq1acAdx1G/itoDq 10 | ML7QLS/M/VBYYxSGghLPetanQ+6f+OYztgTuzw2nG4DXxfMhfijoi6LbfFDvy0K+ 11 | mHqhbQW1Go8= 12 | -----END X509 CRL----- 13 | -------------------------------------------------------------------------------- /tools/datatypecodegenerator/xmlelement.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include "xmlelement.h" 5 | 6 | #include "util.h" 7 | 8 | #include 9 | 10 | XmlElement::XmlElement(const QString &name) 11 | : m_name(name) 12 | {} 13 | 14 | void XmlElement::setName(const QString &name) 15 | { 16 | m_name = name; 17 | } 18 | 19 | QString XmlElement::name() const 20 | { 21 | return m_name; 22 | } 23 | 24 | QString XmlElement::lowerFirstName() const 25 | { 26 | return Util::lowerFirstLetter(m_name); 27 | } 28 | 29 | void XmlElement::print() const 30 | { 31 | qDebug() << "name: " << m_name; 32 | } 33 | -------------------------------------------------------------------------------- /src/declarative_opcua/opcuaoperandbase.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include 5 | #include 6 | 7 | QT_BEGIN_NAMESPACE 8 | 9 | Q_DECLARE_LOGGING_CATEGORY(QT_OPCUA_PLUGINS_QML) 10 | 11 | OpcUaOperandBase::OpcUaOperandBase(QObject *parent) 12 | : QObject(parent) 13 | { 14 | } 15 | 16 | OpcUaOperandBase::~OpcUaOperandBase() = default; 17 | 18 | QVariant OpcUaOperandBase::toCppVariant(QOpcUaClient *client) const 19 | { 20 | Q_UNUSED(client); 21 | qCWarning(QT_OPCUA_PLUGINS_QML) << "Calling invalid base function of OpcUaOperandBase"; 22 | return QVariant(); 23 | } 24 | 25 | QT_END_NAMESPACE 26 | -------------------------------------------------------------------------------- /dist/changes-5.15.0: -------------------------------------------------------------------------------- 1 | Qt 5.15 introduces many new features and improvements as well as bugfixes 2 | over the 5.14.x series. For more details, refer to the online documentation 3 | included in this distribution. The documentation is also available online: 4 | 5 | https://doc.qt.io/qt-5/index.html 6 | 7 | The Qt version 5.15 series is binary compatible with the 5.14.x series. 8 | Applications compiled for 5.14 will continue to run with 5.15. 9 | 10 | Some of the changes listed in this file include issue tracking numbers 11 | corresponding to tasks in the Qt Bug Tracker: 12 | 13 | https://bugreports.qt.io/ 14 | 15 | Each of these identifiers can be entered in the bug tracker to obtain more 16 | information about a particular change. 17 | 18 | - This release contains only minor code improvements. 19 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qml/machine/Tank.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | import QtQuick 5 | import QtOpcUa as QtOpcUa 6 | 7 | Item { 8 | property QtOpcUa.Node tankNode 9 | readonly property alias percentFilled: filledState.value 10 | 11 | QtOpcUa.ValueNode { 12 | nodeId: QtOpcUa.RelativeNodeId { 13 | startNode: tankNode.nodeId 14 | path: [ 15 | QtOpcUa.RelativeNodePath { 16 | ns: "Demo Namespace" 17 | browseName: "PercentFilled" 18 | } 19 | ] 20 | } 21 | id: filledState 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tools/datatypecodegenerator/import.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #pragma once 5 | 6 | #include "xmlelement.h" 7 | 8 | class Visitor; 9 | 10 | class Import : public XmlElement 11 | { 12 | public: 13 | Import(const QString &nameSpace, const QString &location); 14 | ~Import() override = default; 15 | 16 | virtual void print() const override; 17 | virtual void accept(Visitor *visitor) override; 18 | 19 | QString nameSpace() const; 20 | void setNameSpace(const QString &nameSpace); 21 | 22 | QString location() const; 23 | void setLocation(const QString &location); 24 | 25 | private: 26 | QString m_location; 27 | QString m_nameSpace; 28 | }; 29 | -------------------------------------------------------------------------------- /dist/changes-5.14.1: -------------------------------------------------------------------------------- 1 | Qt 5.14.1 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.14.0. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | https://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.14 series is binary compatible with the 5.13.x series. 10 | Applications compiled for 5.13 will continue to run with 5.14. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | - This release contains only minor code improvements. 21 | -------------------------------------------------------------------------------- /src/opcua/x509/qopcuax509utils.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | // 5 | // W A R N I N G 6 | // ------------- 7 | // 8 | // This file is not part of the Qt API. It exists purely as an 9 | // implementation detail. This header file may change from version to 10 | // version without notice, or even be removed. 11 | // 12 | // We mean it. 13 | // 14 | 15 | #include "qopcuax509utils_p.h" 16 | #include "openssl_symbols_p.h" 17 | 18 | QT_BEGIN_NAMESPACE 19 | 20 | QString getOpenSslError() 21 | { 22 | char errorBuf[1024]; 23 | errorBuf[0] = 0; 24 | q_ERR_error_string_n(q_ERR_get_error(), errorBuf, sizeof(errorBuf)); 25 | return QString::fromLatin1(errorBuf); 26 | } 27 | 28 | QT_END_NAMESPACE 29 | 30 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/simulationserver/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #include "simulationserver.h" 5 | 6 | #include 7 | #include 8 | 9 | int main(int argc, char **argv) 10 | { 11 | #ifdef Q_OS_MACOS 12 | // If SIGPIPE is not handled, the server exits from time to time 13 | // on some versions of macOS shortly after a client disconnects 14 | signal(SIGPIPE, SIG_IGN); 15 | #endif 16 | 17 | QCoreApplication app(argc, argv); 18 | 19 | DemoServer server; 20 | if (!server.init()) { 21 | qCritical() << "Could not initialize server."; 22 | return EXIT_FAILURE; 23 | } 24 | 25 | server.launch(); 26 | 27 | return app.exec(); 28 | } 29 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qmlcpp/main.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | import QtQuick 5 | import QtQuick.Window 6 | import QtQuick.Layouts 7 | 8 | Window { 9 | visible: true 10 | width: 800 11 | height: 600 12 | minimumWidth: 800 13 | minimumHeight: 600 14 | title: "OPC UA Tank Example" 15 | 16 | ColumnLayout { 17 | anchors.margins: 10 18 | anchors.fill: parent 19 | spacing: 45 20 | 21 | ServerControl {} 22 | 23 | TankSimulation { 24 | Layout.fillHeight: true 25 | } 26 | 27 | Text { 28 | id: messageText 29 | font.pointSize: 10 30 | text: uaBackend.message 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/plugins/opcua/open62541/qopen62541plugin.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPEN62541PLUGIN_H 5 | #define QOPEN62541PLUGIN_H 6 | 7 | #include 8 | 9 | QT_BEGIN_NAMESPACE 10 | 11 | class QOpen62541Plugin : public QOpcUaPlugin 12 | { 13 | Q_OBJECT 14 | 15 | Q_PLUGIN_METADATA(IID "org.qt-project.qt.opcua.providerfactory/1.0" FILE "open62541-metadata.json") 16 | Q_INTERFACES(QOpcUaPlugin) 17 | 18 | public: 19 | explicit QOpen62541Plugin(QObject *parent = nullptr); 20 | ~QOpen62541Plugin() override; 21 | 22 | QOpcUaClient *createClient(const QVariantMap &backendProperties) override; 23 | }; 24 | 25 | QT_END_NAMESPACE 26 | 27 | #endif // QOPEN62541PLUGIN_H 28 | -------------------------------------------------------------------------------- /dist/changes-5.14.2: -------------------------------------------------------------------------------- 1 | Qt 5.14.2 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.14.0 through 5.14.1. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | https://doc.qt.io/qt-5/index.html 8 | 9 | The Qt version 5.14 series is binary compatible with the 5.13.x series. 10 | Applications compiled for 5.13 will continue to run with 5.14. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | - This release contains only minor code improvements. 21 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuanodeimpl.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2016 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include 5 | 6 | QT_BEGIN_NAMESPACE 7 | 8 | QOpcUaNodeImpl::QOpcUaNodeImpl() 9 | : m_handle{0} 10 | , m_registered{false} 11 | { 12 | } 13 | 14 | QOpcUaNodeImpl::~QOpcUaNodeImpl() 15 | { 16 | } 17 | 18 | quint64 QOpcUaNodeImpl::handle() const 19 | { 20 | return m_handle; 21 | } 22 | 23 | void QOpcUaNodeImpl::setHandle(quint64 handle) 24 | { 25 | m_handle = handle; 26 | } 27 | 28 | bool QOpcUaNodeImpl::registered() const 29 | { 30 | return m_registered; 31 | } 32 | 33 | void QOpcUaNodeImpl::setRegistered(bool registered) 34 | { 35 | m_registered = registered; 36 | } 37 | 38 | QT_END_NAMESPACE 39 | -------------------------------------------------------------------------------- /tools/datatypecodegenerator/enumeratedvalue.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include "enumeratedvalue.h" 5 | #include "visitor.h" 6 | 7 | #include 8 | 9 | EnumeratedValue::EnumeratedValue(const QString &name, qint32 value) 10 | : XmlElement(name) 11 | , m_value(value) 12 | {} 13 | 14 | void EnumeratedValue::print() const 15 | { 16 | XmlElement::print(); 17 | qDebug() << "Value: " << m_value; 18 | } 19 | 20 | void EnumeratedValue::accept(Visitor *visitor) 21 | { 22 | visitor->visit(this); 23 | } 24 | 25 | qint32 EnumeratedValue::value() const 26 | { 27 | return m_value; 28 | } 29 | 30 | void EnumeratedValue::setValue(qint32 value) 31 | { 32 | m_value = value; 33 | } 34 | -------------------------------------------------------------------------------- /tools/datatypecodegenerator/nodeidgenerator.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2024 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef NODEIDGENERATOR_H 5 | #define NODEIDGENERATOR_H 6 | 7 | #include 8 | #include 9 | 10 | class NodeIdGenerator 11 | { 12 | public: 13 | NodeIdGenerator() = default; 14 | 15 | bool parseNodeIds(const QString &name, const QString &path); 16 | 17 | bool hasNodeIds() const; 18 | 19 | bool generateNodeIdsHeader(const QString &prefix, const QString &path, const QString &header); 20 | 21 | private: 22 | class NodeId { 23 | public: 24 | QString name; 25 | QString value; 26 | QString type; 27 | }; 28 | 29 | QHash> m_nodeIds; 30 | }; 31 | 32 | #endif // NODEIDGENERATOR_H 33 | -------------------------------------------------------------------------------- /examples/opcua/opcuaviewer/opcuaviewer.pro: -------------------------------------------------------------------------------- 1 | QT += opcua widgets 2 | CONFIG += c++11 3 | DEPENDPATH += INCLUDEPATH 4 | 5 | SOURCES += main.cpp \ 6 | mainwindow.cpp \ 7 | opcuamodel.cpp \ 8 | treeitem.cpp \ 9 | certificatedialog.cpp 10 | 11 | #install 12 | target.path = $$[QT_INSTALL_EXAMPLES]/opcua/opcuaviewer 13 | INSTALLS += target 14 | 15 | HEADERS += \ 16 | mainwindow.h \ 17 | opcuamodel.h \ 18 | treeitem.h \ 19 | certificatedialog.h 20 | 21 | FORMS += \ 22 | certificatedialog.ui \ 23 | mainwindow.ui \ 24 | 25 | pki.files = \ 26 | pki/own/certs/opcuaviewer.der \ 27 | pki/own/private/opcuaviewer.pem \ 28 | pki/trusted/certs/3d8ec65c47524d6ad67bed912c19a895.der \ 29 | pki/trusted/certs/ca.der \ 30 | pki/trusted/certs/open62541-testserver.der \ 31 | pki/trusted/crl/ca.crl.pem 32 | 33 | pki.prefix = / 34 | 35 | RESOURCES += pki 36 | -------------------------------------------------------------------------------- /src/opcua/core/qopcuaplugin.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAPLUGIN_H 5 | #define QOPCUAPLUGIN_H 6 | 7 | #include 8 | 9 | #include 10 | 11 | QT_BEGIN_NAMESPACE 12 | 13 | class QOpcUaClient; 14 | 15 | #define QOpcUaProviderFactory_iid "org.qt-project.qt.opcua.providerfactory/1.0" 16 | 17 | class Q_OPCUA_EXPORT QOpcUaPlugin : public QObject 18 | { 19 | Q_OBJECT 20 | public: 21 | explicit QOpcUaPlugin(QObject *parent = nullptr); 22 | ~QOpcUaPlugin() override; 23 | 24 | virtual QOpcUaClient *createClient(const QVariantMap &backendProperties) = 0; 25 | }; 26 | Q_DECLARE_INTERFACE(QOpcUaPlugin, QOpcUaProviderFactory_iid) 27 | 28 | QT_END_NAMESPACE 29 | 30 | #endif // QOPCUAPLUGIN_H 31 | -------------------------------------------------------------------------------- /tools/datatypecodegenerator/visitor.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #pragma once 5 | 6 | #include "xmlelement.h" 7 | 8 | class EnumeratedType; 9 | class EnumeratedValue; 10 | class Import; 11 | class Field; 12 | class StructuredType; 13 | class TypeDictionary; 14 | 15 | class Visitor 16 | { 17 | public: 18 | virtual ~Visitor() = default; 19 | virtual void visit(XmlElement *xmlElement) = 0; 20 | virtual void visit(EnumeratedType *enumteratedType) = 0; 21 | virtual void visit(EnumeratedValue *enumeratedValue) = 0; 22 | virtual void visit(Import *import) = 0; 23 | virtual void visit(Field *field) = 0; 24 | virtual void visit(StructuredType *structuredType) = 0; 25 | virtual void visit(TypeDictionary *typeDictionary) = 0; 26 | }; 27 | -------------------------------------------------------------------------------- /src/opcua/x509/qopcuax509extension_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAX509EXTENSION_P_H 5 | #define QOPCUAX509EXTENSION_P_H 6 | 7 | #include 8 | #include 9 | 10 | // 11 | // W A R N I N G 12 | // ------------- 13 | // 14 | // This file is not part of the Qt API. It exists purely as an 15 | // implementation detail. This header file may change from version to 16 | // version without notice, or even be removed. 17 | // 18 | // We mean it. 19 | // 20 | 21 | QT_BEGIN_NAMESPACE 22 | 23 | class QOpcUaX509ExtensionData : public QSharedData 24 | { 25 | public: 26 | virtual ~QOpcUaX509ExtensionData() = default; 27 | bool critical = false; 28 | }; 29 | 30 | QT_END_NAMESPACE 31 | 32 | #endif // QOPCUAX509EXTENSION_P_H 33 | -------------------------------------------------------------------------------- /tools/datatypecodegenerator/util.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include "util.h" 5 | 6 | #include 7 | 8 | using namespace Qt::Literals::StringLiterals; 9 | 10 | QString Util::indent(int level) 11 | { 12 | return u"%1"_s.arg(' '_L1, level * 4, ' '_L1); 13 | } 14 | 15 | QString Util::lineBreak(int n) 16 | { 17 | return u"%1"_s.arg('\n'_L1, n, '\n'_L1); 18 | } 19 | 20 | QString Util::removeNamespace(const QString &typeName) 21 | { 22 | return typeName.split(':'_L1).value(1, QString()); 23 | } 24 | 25 | QString Util::lowerFirstLetter(const QString &temp) 26 | { 27 | if (temp.isEmpty()) 28 | return temp; 29 | 30 | auto result = temp; 31 | result.front() = result.at(0).toLower(); 32 | return result; 33 | } 34 | -------------------------------------------------------------------------------- /dist/changes-5.11.2: -------------------------------------------------------------------------------- 1 | Qt 5.11.2 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.11.0 through 5.11.1. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | http://doc.qt.io/qt-5/index.html 8 | 9 | **************************************************************************** 10 | * Qt 5.11.2 Changes * 11 | **************************************************************************** 12 | 13 | - Fixes subscription sharing for publishing interval 0 14 | - Removes running monitorings when the QOpcUaNode is deleted 15 | - Adds username/password auth to the QOpcUaClient docs 16 | - Fixes a possible crash in the uacpp value converter 17 | - Fixes a possible crash if a QOpcUaNode outlives the backend 18 | - Adds CMake support 19 | -------------------------------------------------------------------------------- /examples/opcua/opcuaviewer/certificatedialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 Unified Automation GmbH 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #ifndef CERTIFICATEDIALOG_H 5 | #define CERTIFICATEDIALOG_H 6 | 7 | #include 8 | #include 9 | 10 | QT_BEGIN_NAMESPACE 11 | namespace Ui { 12 | class CertificateDialog; 13 | } 14 | QT_END_NAMESPACE 15 | 16 | class CertificateDialog : public QDialog 17 | { 18 | Q_OBJECT 19 | 20 | public: 21 | explicit CertificateDialog(QWidget *parent = nullptr); 22 | ~CertificateDialog(); 23 | 24 | int showCertificate(const QString &message, const QByteArray &der, const QString &trustListDirectory); 25 | 26 | private slots: 27 | void saveCertificate(); 28 | 29 | private: 30 | Ui::CertificateDialog *ui; 31 | QSslCertificate m_cert; 32 | QString m_trustListDirectory; 33 | }; 34 | 35 | #endif // CERTIFICATEDIALOG_H 36 | -------------------------------------------------------------------------------- /tests/auto/declarative/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_opcua Test: 6 | ##################################################################### 7 | 8 | qt_internal_add_test(tst_opcua 9 | GUI 10 | QMLTEST 11 | QML_IMPORTPATH 12 | "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/plugins/declarative" 13 | SOURCES 14 | tst_opcua.cpp 15 | LIBRARIES 16 | Qt::Gui 17 | Qt::OpcUaPrivate 18 | Qt::Qml 19 | ) 20 | 21 | ## Scopes: 22 | ##################################################################### 23 | 24 | qt_internal_extend_target(tst_opcua CONDITION QT_FEATURE_open62541_security 25 | DEFINES 26 | SERVER_SUPPORTS_SECURITY 27 | ) 28 | 29 | if (WIN32) 30 | target_compile_definitions(tst_opcua PRIVATE TESTS_CMAKE_SPECIFIC_PATH) 31 | endif() 32 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qml/Pump.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // Copyright (C) 2018 The Qt Company Ltd. 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 4 | 5 | import QtQuick 6 | 7 | Rectangle { 8 | property bool machineIsPumping; 9 | 10 | function rotatePump() { 11 | if (machineIsPumping) 12 | rotation += 15 13 | } 14 | 15 | id: pump 16 | width: 40 17 | height: 40 18 | radius: width / 2 19 | color: machineIsPumping ? "#00BFFF" : "lightgrey" 20 | Rectangle { 21 | antialiasing: true 22 | width: height / 4 23 | height: pump.width * 0.75 24 | anchors.centerIn: parent 25 | color: "grey" 26 | } 27 | Rectangle { 28 | antialiasing: true 29 | width: pump.width * 0.75 30 | height: width / 4 31 | anchors.centerIn: parent 32 | color: "grey" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /tools/datatypecodegenerator/enumeratedtype.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #pragma once 5 | 6 | #include "xmlelement.h" 7 | 8 | #include 9 | 10 | class EnumeratedValue; 11 | class Visitor; 12 | 13 | class EnumeratedType : public XmlElement 14 | 15 | { 16 | public: 17 | EnumeratedType(const QString &name, quint32 lengthInBits); 18 | ~EnumeratedType(); 19 | 20 | void addValue(EnumeratedValue *enumeratedValue); 21 | void print() const override; 22 | 23 | quint32 lengthInBits() const; 24 | void setLengthInBits(quint32 lengthInBits); 25 | 26 | QList values() const; 27 | void setValues(const QList &values); 28 | 29 | virtual void accept(Visitor *visitor) override; 30 | 31 | private: 32 | quint32 m_lengthInBits; 33 | QList m_values; 34 | }; 35 | -------------------------------------------------------------------------------- /tests/auto/clientSetupInCpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_clientSetupInCpp Test: 6 | ##################################################################### 7 | 8 | qt_internal_add_test(tst_clientSetupInCpp 9 | GUI 10 | QMLTEST 11 | QML_IMPORTPATH 12 | "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/plugins/declarative" 13 | SOURCES 14 | tst_clientSetupInCpp.cpp 15 | LIBRARIES 16 | Qt::Gui 17 | Qt::OpcUaPrivate 18 | Qt::Qml 19 | ) 20 | 21 | ## Scopes: 22 | ##################################################################### 23 | 24 | qt_internal_extend_target(tst_clientSetupInCpp CONDITION QT_FEATURE_open62541_security 25 | DEFINES 26 | SERVER_SUPPORTS_SECURITY 27 | ) 28 | 29 | if (WIN32) 30 | target_compile_definitions(tst_clientSetupInCpp PRIVATE TESTS_CMAKE_SPECIFIC_PATH) 31 | endif() 32 | -------------------------------------------------------------------------------- /src/declarative_opcua/opcuaoperandbase_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef OPCUAOPERANDBASE_P_H 5 | #define OPCUAOPERANDBASE_P_H 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | // 12 | // W A R N I N G 13 | // ------------- 14 | // 15 | // This file is not part of the Qt API. It exists purely as an 16 | // implementation detail. This header file may change from version to 17 | // version without notice, or even be removed. 18 | // 19 | // We mean it. 20 | // 21 | 22 | QT_BEGIN_NAMESPACE 23 | 24 | class QOpcUaClient; 25 | 26 | class OpcUaOperandBase : public QObject { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit OpcUaOperandBase(QObject *parent = nullptr); 31 | ~OpcUaOperandBase(); 32 | 33 | virtual QVariant toCppVariant(QOpcUaClient *client) const; 34 | }; 35 | 36 | QT_END_NAMESPACE 37 | 38 | #endif // OPCUAOPERANDBASE_P_H 39 | -------------------------------------------------------------------------------- /src/plugins/opcua/open62541/qopen62541.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPEN62541_H 5 | #define QOPEN62541_H 6 | #include 7 | 8 | #if defined(_MSC_VER) 9 | #pragma warning(push) 10 | #pragma warning(disable: 4100) // unused variable 11 | #elif defined(__GNUC__) //includes mingw 12 | #pragma GCC diagnostic push 13 | #pragma GCC diagnostic ignored "-Wunused-parameter" 14 | #pragma GCC diagnostic ignored "-Wmissing-field-initializers" 15 | #pragma GCC diagnostic ignored "-Wmissing-braces" 16 | #elif defined(__clang__) 17 | #pragma clang diagnostic push 18 | #pragma clang diagnostic ignored "-Wunused-parameter" 19 | #endif 20 | 21 | #include 22 | 23 | #if defined(_MSC_VER) 24 | #pragma warning(pop) 25 | #elif defined(__GNUC__) 26 | #pragma GCC diagnostic pop 27 | #elif defined(__clang__) 28 | #pragma clang diagnostic pop 29 | #endif 30 | 31 | #endif // QOPEN62541_H 32 | -------------------------------------------------------------------------------- /tools/datatypecodegenerator/import.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include "import.h" 5 | #include "visitor.h" 6 | 7 | #include 8 | 9 | Import::Import(const QString &nameSpace, const QString &location) 10 | : m_location(location) 11 | , m_nameSpace(nameSpace) 12 | {} 13 | 14 | QString Import::nameSpace() const 15 | { 16 | return m_nameSpace; 17 | } 18 | 19 | void Import::setNameSpace(const QString &nameSpace) 20 | { 21 | m_nameSpace = nameSpace; 22 | } 23 | 24 | QString Import::location() const 25 | { 26 | return m_location; 27 | } 28 | 29 | void Import::setLocation(const QString &location) 30 | { 31 | m_location = location; 32 | } 33 | 34 | void Import::print() const 35 | { 36 | qDebug() << "Namespace:" << m_nameSpace << "\tLocation:" << m_location; 37 | } 38 | 39 | void Import::accept(Visitor *visitor) 40 | { 41 | visitor->visit(this); 42 | } 43 | -------------------------------------------------------------------------------- /examples/opcua/x509/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | cmake_minimum_required(VERSION 3.16) 5 | project(x509 LANGUAGES CXX) 6 | 7 | if (ANDROID) 8 | message(FATAL_ERROR "This project cannot be built on Android.") 9 | endif() 10 | 11 | if(NOT DEFINED INSTALL_EXAMPLESDIR) 12 | set(INSTALL_EXAMPLESDIR "examples") 13 | endif() 14 | 15 | set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opcua/x509") 16 | 17 | find_package(Qt6 REQUIRED COMPONENTS Core OpcUa) 18 | 19 | qt_standard_project_setup() 20 | 21 | qt_add_executable(x509 22 | main.cpp 23 | ) 24 | 25 | set_target_properties(x509 PROPERTIES 26 | WIN32_EXECUTABLE TRUE 27 | MACOSX_BUNDLE TRUE 28 | ) 29 | 30 | target_link_libraries(x509 PRIVATE 31 | Qt6::Core 32 | Qt6::OpcUa 33 | ) 34 | 35 | install(TARGETS x509 36 | RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" 37 | BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" 38 | LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" 39 | ) 40 | -------------------------------------------------------------------------------- /src/opcua/core/qopcuaprovider.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAPROVIDER_H 5 | #define QOPCUAPROVIDER_H 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | #include // for QVariantMap 13 | 14 | QT_BEGIN_NAMESPACE 15 | 16 | class QOpcUaPlugin; 17 | class QOpcUaClient; 18 | 19 | class Q_OPCUA_EXPORT QOpcUaProvider : public QObject 20 | { 21 | Q_OBJECT 22 | 23 | public: 24 | static QStringList availableBackends(); 25 | 26 | explicit QOpcUaProvider(QObject *parent = nullptr); 27 | ~QOpcUaProvider() override; 28 | 29 | Q_INVOKABLE QOpcUaClient *createClient(const QString &backend, const QVariantMap &backendProperties = QVariantMap()); 30 | 31 | private: 32 | QMultiHash m_plugins; 33 | }; 34 | 35 | QT_END_NAMESPACE 36 | 37 | #endif // QOPCUAPROVIDER_H 38 | -------------------------------------------------------------------------------- /src/opcua/x509/qopcuax509extension.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAX509EXTENSION_H 5 | #define QOPCUAX509EXTENSION_H 6 | 7 | #include 8 | #include 9 | 10 | QT_BEGIN_NAMESPACE 11 | 12 | class QOpcUaX509ExtensionData; 13 | class Q_OPCUA_EXPORT QOpcUaX509Extension 14 | { 15 | public: 16 | QOpcUaX509Extension(); 17 | QOpcUaX509Extension(const QOpcUaX509Extension &); 18 | QOpcUaX509Extension &operator=(const QOpcUaX509Extension &); 19 | bool operator==(const QOpcUaX509Extension &rhs) const; 20 | virtual ~QOpcUaX509Extension(); 21 | void setCritical(bool critical); 22 | bool critical() const; 23 | 24 | protected: 25 | QOpcUaX509Extension(QOpcUaX509ExtensionData*); 26 | QOpcUaX509Extension(QSharedDataPointer); 27 | QSharedDataPointer data; 28 | }; 29 | 30 | QT_END_NAMESPACE 31 | 32 | #endif // QOPCUAX509EXTENSION_H 33 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuarange.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUARANGE_H 5 | #define QOPCUARANGE_H 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | QT_BEGIN_NAMESPACE 13 | 14 | class QOpcUaRangeData; 15 | class Q_OPCUA_EXPORT QOpcUaRange 16 | { 17 | public: 18 | QOpcUaRange(); 19 | QOpcUaRange(const QOpcUaRange &); 20 | QOpcUaRange(double low, double high); 21 | QOpcUaRange &operator=(const QOpcUaRange &); 22 | bool operator==(const QOpcUaRange &rhs) const; 23 | operator QVariant() const; 24 | ~QOpcUaRange(); 25 | 26 | double low() const; 27 | void setLow(double low); 28 | 29 | double high() const; 30 | void setHigh(double high); 31 | 32 | private: 33 | QSharedDataPointer data; 34 | }; 35 | 36 | QT_END_NAMESPACE 37 | 38 | Q_DECLARE_METATYPE(QOpcUaRange) 39 | 40 | #endif // QOPCUARANGE_H 41 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuaxvalue.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAXVALUE_H 5 | #define QOPCUAXVALUE_H 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | QT_BEGIN_NAMESPACE 13 | 14 | class QOpcUaXValueData; 15 | class Q_OPCUA_EXPORT QOpcUaXValue 16 | { 17 | public: 18 | QOpcUaXValue(); 19 | QOpcUaXValue(const QOpcUaXValue &); 20 | QOpcUaXValue(double x, float value); 21 | QOpcUaXValue &operator=(const QOpcUaXValue &); 22 | bool operator==(const QOpcUaXValue &rhs) const; 23 | operator QVariant() const; 24 | ~QOpcUaXValue(); 25 | 26 | double x() const; 27 | void setX(double x); 28 | 29 | float value() const; 30 | void setValue(float value); 31 | 32 | private: 33 | QSharedDataPointer data; 34 | }; 35 | 36 | QT_END_NAMESPACE 37 | 38 | Q_DECLARE_METATYPE(QOpcUaXValue) 39 | 40 | #endif // QOPCUAXVALUE_H 41 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qmlcpp/ServerControl.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | import QtQuick 5 | import QtQuick.Controls 6 | import QtQuick.Layouts 7 | 8 | RowLayout { 9 | TextField { 10 | id: uaUrl 11 | Layout.fillWidth: true 12 | text: "opc.tcp://127.0.0.1:43344" 13 | } 14 | 15 | ComboBox { 16 | id: backendSelector 17 | model: uaBackend.backends 18 | } 19 | 20 | Button { 21 | text: uaBackend.connected ? "Disconnect" : "Connect" 22 | enabled: uaBackend.backends.length > 0 23 | onClicked: { 24 | if (uaBackend.connected) 25 | uaBackend.disconnectFromEndpoint() 26 | else 27 | uaBackend.connectToEndpoint(uaUrl.text, backendSelector.currentIndex) 28 | } 29 | } 30 | 31 | Button { 32 | text: "Reset simulation" 33 | enabled: uaBackend.connected 34 | onClicked: uaBackend.resetSimulation(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/open62541-testserver/open62541-testserver.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | TARGET = open62541-testserver 3 | 4 | INCLUDEPATH += \ 5 | $$PWD/../../src/plugins/opcua/open62541 6 | 7 | DEPENDPATH += INCLUDEPATH 8 | 9 | CONFIG += c++11 console 10 | 11 | QT += opcua-private 12 | 13 | qtConfig(open62541):!qtConfig(system-open62541) { 14 | qtConfig(mbedtls):{ 15 | QMAKE_USE_PRIVATE += mbedtls 16 | DEFINES += UA_ENABLE_ENCRYPTION UA_ENABLE_ENCRYPTION_MBEDTLS 17 | } 18 | include($$PWD/../../src/3rdparty/open62541.pri) 19 | } else { 20 | QMAKE_USE_PRIVATE += open62541 21 | } 22 | 23 | win32: DESTDIR = ./ 24 | 25 | # Workaround for QTBUG-75020 26 | QMAKE_CFLAGS_RELEASE -= -O2 27 | QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -= -O2 28 | 29 | SOURCES += \ 30 | main.cpp \ 31 | testserver.cpp \ 32 | $$PWD/../../src/plugins/opcua/open62541/qopen62541utils.cpp \ 33 | $$PWD/../../src/plugins/opcua/open62541/qopen62541valueconverter.cpp 34 | 35 | 36 | HEADERS += \ 37 | testserver.h 38 | 39 | RESOURCES += certs.qrc 40 | 41 | -------------------------------------------------------------------------------- /tests/auto/security/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_security Test: 6 | ##################################################################### 7 | 8 | qt_internal_add_test(tst_security 9 | SOURCES 10 | tst_security.cpp 11 | LIBRARIES 12 | Qt::Network 13 | Qt::OpcUa 14 | ) 15 | 16 | # Resources: 17 | set(certs_resource_files 18 | "pki/own/certs/tst_security.der" 19 | "pki/own/certs/invalid_cert.der" 20 | "pki/own/private/privateKeyWithPassword_secret.pem" 21 | "pki/own/private/privateKeyWithoutPassword.pem" 22 | "pki/trusted/certs/ca.der" 23 | "pki/trusted/certs/open62541-testserver.der" 24 | "pki/trusted/crl/ca.crl.pem" 25 | ) 26 | 27 | qt_internal_add_resource(tst_security "certs" 28 | PREFIX 29 | "/" 30 | FILES 31 | ${certs_resource_files} 32 | ) 33 | 34 | if (WIN32) 35 | target_compile_definitions(tst_security PRIVATE TESTS_CMAKE_SPECIFIC_PATH) 36 | endif() 37 | -------------------------------------------------------------------------------- /src/3rdparty/open62541/qt_attribution.json: -------------------------------------------------------------------------------- 1 | { 2 | "Id": "open62541", 3 | "Name": "Open62541", 4 | "QDocModule": "qtopcua", 5 | "QtUsage": "Used in the Qt OPC UA module to build the backend. Pass -no-open62541 or -system-open62541 to avoid.", 6 | "Description": "Open62541 is an open source implementation of the OPC UA protocol.", 7 | "Homepage": "https://open62541.org/", 8 | "PURL": [ 9 | "pkg:github/open62541/open62541@v$" 10 | ], 11 | "CPE": [ 12 | "cpe:2.3:a:open62541:open62541:$:*:*:*:*:*:*:*" 13 | ], 14 | "Version": "1.4.13", 15 | "License": "Mozilla Public License 2.0 and Creative Commons Zero v1.0 Universal and Creative Commons Attribution Share Alike 4.0 International and BSD 3-Clause \"New\" or \"Revised\" License and Apache License 2.0 and MIT License", 16 | "LicenseId": "MPL-2.0 AND CC0-1.0 AND CC-BY-SA-4.0 AND BSD-3-Clause AND Apache-2.0 AND MIT", 17 | "LicenseFiles": [ "mpl-2.0.815ca599c9df.txt", "LICENSE-CC0", "CC-BY-SA-4.0", "BSD-3-CLAUSE", "LICENSE-2.0.txt", "MIT" ], 18 | "CopyrightFile": "AUTHORS" 19 | } 20 | -------------------------------------------------------------------------------- /examples/opcua/opcuaviewer/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #include "mainwindow.h" 5 | #include 6 | #include 7 | #include 8 | 9 | using namespace Qt::Literals::StringLiterals; 10 | 11 | int main(int argc, char **argv) 12 | { 13 | QApplication app(argc, argv); 14 | QCoreApplication::setApplicationVersion(QLatin1StringView(QT_VERSION_STR)); 15 | QCoreApplication::setApplicationName("Qt OpcUa Viewer"_L1); 16 | 17 | QCommandLineParser parser; 18 | parser.addHelpOption(); 19 | parser.addVersionOption(); 20 | parser.addPositionalArgument("url"_L1, "The url to open."_L1); 21 | parser.process(app); 22 | 23 | const auto positionalArguments = parser.positionalArguments(); 24 | const auto initialUrl = positionalArguments.value(0, "opc.tcp://localhost:48010"_L1); 25 | MainWindow mainWindow(initialUrl.trimmed()); 26 | mainWindow.setWindowTitle("Qt OPC UA viewer"_L1); 27 | mainWindow.show(); 28 | return QCoreApplication::exec(); 29 | } 30 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qmlcpp/Pump.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | import QtQuick 5 | import OpcUaMachineBackend 6 | 7 | Rectangle { 8 | id: pump 9 | 10 | width: 40 11 | height: 40 12 | radius: width / 2 13 | color: uaBackend.machineState === OpcUaMachineBackend.MachineState.Pumping ? "#00BFFF" : "lightgrey" 14 | 15 | Rectangle { 16 | antialiasing: true 17 | width: height / 4 18 | height: pump.width * 0.75 19 | anchors.centerIn: parent 20 | color: "grey" 21 | } 22 | 23 | Rectangle { 24 | antialiasing: true 25 | width: pump.width * 0.75 26 | height: width / 4 27 | anchors.centerIn: parent 28 | color: "grey" 29 | } 30 | 31 | Connections { 32 | target: uaBackend 33 | 34 | function onPercentFilledTank2Changed(value) { 35 | if (uaBackend.machineState === OpcUaMachineBackend.MachineState.Pumping) 36 | rotation += 15 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/opcua/compat/removed_api.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #define QT_OPCUA_BUILD_REMOVED_API 5 | 6 | #include "qopcuaglobal.h" 7 | 8 | QT_USE_NAMESPACE 9 | 10 | #if QT_OPCUA_REMOVED_SINCE(6, 7) 11 | 12 | #include "qopcuacontentfilterelement.h" 13 | 14 | bool QOpcUaContentFilterElement::operator==(const QOpcUaContentFilterElement &rhs) const 15 | { return comparesEqual(*this, rhs); } 16 | 17 | #include "qopcuarelativepathelement.h" 18 | 19 | bool QOpcUaRelativePathElement::operator==(const QOpcUaRelativePathElement &rhs) const 20 | { return comparesEqual(*this, rhs); } 21 | 22 | #include "qopcuasimpleattributeoperand.h" 23 | 24 | bool QOpcUaSimpleAttributeOperand::operator==(const QOpcUaSimpleAttributeOperand &rhs) const 25 | { return comparesEqual(*this, rhs); } 26 | 27 | // #include "qotherheader.h" 28 | // // implement removed functions from qotherheader.h 29 | // order sections alphabetically to reduce chances of merge conflicts 30 | 31 | #endif // QT_OPCUA_REMOVED_SINCE(6, 7) 32 | -------------------------------------------------------------------------------- /dist/changes-5.14.0: -------------------------------------------------------------------------------- 1 | Qt 5.14 introduces many new features and improvements as well as bugfixes 2 | over the 5.13.x series. For more details, refer to the online documentation 3 | included in this distribution. The documentation is also available online: 4 | 5 | https://doc.qt.io/qt-5/index.html 6 | 7 | The Qt version 5.14 series is binary compatible with the 5.13.x series. 8 | Applications compiled for 5.13 will continue to run with 5.14. 9 | 10 | 11 | - Note about API stability: 12 | * All classes related to secure connections are out of technology preview state. 13 | 14 | - Qt OPC UA API 15 | * GDS client support (Tech-Preview, uacpp-only) 16 | * Support for generating X509 Certificate Signing Requests (Tech-Preview) 17 | 18 | - open62541-backend 19 | * Update of open62541 to 1.0. This enables the open62541-backend to handle 20 | secure connections. This includes the security policies Basic128Rsa15, 21 | Basic256 and Basic256Sha256. 22 | Still unsupported by the open62541-backend are "Private keys with password", 23 | "Manual override in case of certificate verification errors" & 24 | "X509 identity tokens". 25 | -------------------------------------------------------------------------------- /LICENSES/MIT.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | MIT License 4 | 5 | Copyright (c) 6 | 7 | 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: 8 | 9 | The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. 10 | 11 | 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. 12 | -------------------------------------------------------------------------------- /src/3rdparty/open62541/MIT: -------------------------------------------------------------------------------- 1 | Copyright © 2005-2020 Rich Felker, et al. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /src/opcua/x509/qopcuax509extensionbasicconstraints.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAX509EXTENSIONBASICCONSTRAINTS_H 5 | #define QOPCUAX509EXTENSIONBASICCONSTRAINTS_H 6 | 7 | #include "QtOpcUa/qopcuax509extension.h" 8 | #include 9 | 10 | QT_BEGIN_NAMESPACE 11 | 12 | class QOpcUaX509ExtensionBasicConstraintsData; 13 | 14 | class Q_OPCUA_EXPORT QOpcUaX509ExtensionBasicConstraints : public QOpcUaX509Extension 15 | { 16 | public: 17 | QOpcUaX509ExtensionBasicConstraints(); 18 | QOpcUaX509ExtensionBasicConstraints(const QOpcUaX509ExtensionBasicConstraints &); 19 | QOpcUaX509ExtensionBasicConstraints &operator=(const QOpcUaX509ExtensionBasicConstraints &); 20 | bool operator==(const QOpcUaX509ExtensionBasicConstraints &rhs) const; 21 | ~QOpcUaX509ExtensionBasicConstraints(); 22 | 23 | void setCa(bool value); 24 | bool ca() const; 25 | 26 | void setPathLength(int length); 27 | int pathLength() const; 28 | }; 29 | 30 | QT_END_NAMESPACE 31 | 32 | #endif // QOPCUAX509EXTENSIONBASICCONSTRAINTS_H 33 | -------------------------------------------------------------------------------- /tests/auto/declarative/tst_generic.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only 3 | 4 | import QtQuick 5 | import QtTest 6 | import QtOpcUa as QtOpcUa 7 | 8 | Item { 9 | TestCase { 10 | name: "Enum exports to QML" 11 | 12 | function test_enumExports() { 13 | compare(QtOpcUa.Constants.NodeClass.Method, 4); 14 | compare(QtOpcUa.Constants.NodeAttribute.DisplayName, 8); 15 | compare(QtOpcUa.Node.Status.Valid, 0); 16 | compare(QtOpcUa.Status.Good, 0); 17 | compare(QtOpcUa.Status.BadUnexpectedError, 0x8001); 18 | compare(QtOpcUa.Constants.Double, 3); 19 | compare(QtOpcUa.Constants.Certificate, 2); 20 | compare(QtOpcUa.DataChangeFilter.DeadbandType.Absolute, 1); 21 | compare(QtOpcUa.DataChangeFilter.DataChangeTrigger.StatusOrValueOrTimestamp, 2); 22 | 23 | // Test return value of undefined node 24 | compare(node1.nodeClass, QtOpcUa.Constants.NodeClass.Undefined); 25 | } 26 | 27 | QtOpcUa.Node { 28 | id: node1 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | cmake_minimum_required(VERSION 3.16) 5 | 6 | include(.cmake.conf) 7 | project(QtOpcUa 8 | VERSION "${QT_REPO_MODULE_VERSION}" 9 | DESCRIPTION "Qt OpcUa Libraries" 10 | HOMEPAGE_URL "https://qt.io/" 11 | LANGUAGES CXX C 12 | ) 13 | 14 | find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals) 15 | 16 | # This should be called as early as possible, just after find_package(BuildInternals) where it is 17 | # defined. 18 | qt_internal_project_setup() 19 | 20 | find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Core Network) 21 | find_package(Qt6 ${PROJECT_VERSION} CONFIG OPTIONAL_COMPONENTS Gui Quick QuickTest Widgets) 22 | 23 | if(QNX) 24 | message(NOTICE "Skipping the build as the condition \"NOT QNX\" is not met.") 25 | return() 26 | endif() 27 | if(WASM) 28 | message(NOTICE "Skipping the build as the condition \"NOT WASM\" is not met.") 29 | return() 30 | endif() 31 | 32 | # Ensure macros are available when configuring tests in-tree with the Qt build 33 | include(src/opcua/Qt6OpcUaMacros.cmake) 34 | 35 | qt_build_repo() 36 | -------------------------------------------------------------------------------- /src/3rdparty/open62541.pri: -------------------------------------------------------------------------------- 1 | OPEN62541_SOURCES += $$PWD/open62541/open62541.c 2 | HEADERS += $$PWD/open62541/open62541.h 3 | INCLUDEPATH += $$PWD/open62541 4 | 5 | win32-msvc: LIBS += ws2_32.lib iphlpapi.lib 6 | win32-g++: LIBS += -lws2_32 -liphlpapi 7 | 8 | macos|ios: DEFINES += _DARWIN_C_SOURCE 9 | 10 | win32-msvc|winrt: { 11 | SOURCES += $$OPEN62541_SOURCES 12 | } else { 13 | OPEN62541_CFLAGS += -Wno-unused-parameter -Wno-incompatible-pointer-types -Wno-maybe-uninitialized -Wno-format-overflow -std=c99 14 | 15 | # The open62541 source code produces lots of warnings. 16 | # This custom compiler will disable these warnings just for open62541.c 17 | open62541_compiler.commands = $$QMAKE_CC -c $(CFLAGS) $$OPEN62541_CFLAGS $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} 18 | open62541_compiler.dependency_type = TYPE_C 19 | open62541_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} 20 | open62541_compiler.input += OPEN62541_SOURCES 21 | open62541_compiler.name = compiling ${QMAKE_FILE_IN} 22 | silent: open62541_compiler.commands = @echo compiling ${QMAKE_FILE_IN} && $$open62541_compiler.commands 23 | QMAKE_EXTRA_COMPILERS += open62541_compiler 24 | } 25 | -------------------------------------------------------------------------------- /src/declarative_opcua/opcuaattributevalue_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUA_OPCUAATTRIBUTEVALUE_P_H 5 | #define QOPCUA_OPCUAATTRIBUTEVALUE_P_H 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | // 12 | // W A R N I N G 13 | // ------------- 14 | // 15 | // This file is not part of the Qt API. It exists purely as an 16 | // implementation detail. This header file may change from version to 17 | // version without notice, or even be removed. 18 | // 19 | // We mean it. 20 | // 21 | 22 | QT_BEGIN_NAMESPACE 23 | 24 | class OpcUaAttributeValue : public QObject 25 | { 26 | Q_OBJECT 27 | public: 28 | explicit OpcUaAttributeValue(QObject *parent); 29 | bool operator ==(const OpcUaAttributeValue &rhs); 30 | void setValue(const QVariant &value); 31 | void invalidate(); 32 | const QVariant &value() const; 33 | operator QVariant() const; 34 | 35 | signals: 36 | void changed(QVariant value); 37 | 38 | private: 39 | QVariant m_value; 40 | }; 41 | 42 | QT_END_NAMESPACE 43 | 44 | #endif // QOPCUA_OPCUAATTRIBUTEVALUE_P_H 45 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuacomplexnumber.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUACOMPLEXNUMBER_H 5 | #define QOPCUACOMPLEXNUMBER_H 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | QT_BEGIN_NAMESPACE 13 | 14 | class QOpcUaComplexNumberData; 15 | class Q_OPCUA_EXPORT QOpcUaComplexNumber 16 | { 17 | public: 18 | QOpcUaComplexNumber(); 19 | QOpcUaComplexNumber(const QOpcUaComplexNumber &); 20 | QOpcUaComplexNumber(float real, float imaginary); 21 | QOpcUaComplexNumber &operator=(const QOpcUaComplexNumber &); 22 | bool operator==(const QOpcUaComplexNumber &rhs) const; 23 | operator QVariant() const; 24 | ~QOpcUaComplexNumber(); 25 | 26 | float real() const; 27 | void setReal(float real); 28 | 29 | float imaginary() const; 30 | void setImaginary(float imaginary); 31 | 32 | private: 33 | QSharedDataPointer data; 34 | }; 35 | 36 | QT_END_NAMESPACE 37 | 38 | Q_DECLARE_METATYPE(QOpcUaComplexNumber) 39 | 40 | #endif // QOPCUACOMPLEXNUMBER_H 41 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qml/Tank2Unit.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // Copyright (C) 2018 The Qt Company Ltd. 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 4 | 5 | import QtQuick 6 | import QtQuick.Controls 7 | import QtQuick.Layouts 8 | 9 | Item { 10 | property alias flushButtonEnabled: flushButton.enabled 11 | property alias percentFilled: tank2.percentFilled 12 | property alias flushButtonText: flushButton.text 13 | property bool valveState 14 | signal flushTank() 15 | 16 | ColumnLayout { 17 | anchors.fill: parent 18 | Button { 19 | id: flushButton 20 | text: "Flush" 21 | onClicked: flushTank() 22 | } 23 | Layout.fillHeight: true 24 | TankDisplay { 25 | id: tank2 26 | Layout.fillHeight: true 27 | Layout.fillWidth: true 28 | Rectangle { 29 | color: valveState ? "#00BFFF" : "lightgrey" 30 | anchors.top: parent.bottom 31 | anchors.right: parent.right 32 | width: tank2.width / 10 33 | height: 40 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tools/datatypecodegenerator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2023 basysKom GmbH 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## qopcuaxmldatatypes2cpp Tool: 6 | ##################################################################### 7 | 8 | qt_get_tool_target_name(target_name qopcuaxmldatatypes2cpp) 9 | qt_internal_add_tool(${target_name} 10 | TOOLS_TARGET 11 | OpcUa 12 | SOURCES 13 | main.cpp 14 | util.cpp util.h 15 | datatypefilewriter.cpp datatypefilewriter.h 16 | dependencydatatypevalidator.cpp dependencydatatypevalidator.h 17 | enumeratedtype.cpp enumeratedtype.h 18 | enumeratedvalue.cpp enumeratedvalue.h 19 | field.cpp field.h 20 | import.cpp import.h 21 | mappingfilegenerator.cpp mappingfilegenerator.h 22 | nodeidgenerator.cpp nodeidgenerator.h 23 | recursivedescentparser.cpp recursivedescentparser.h 24 | stringidentifier.cpp stringidentifier.h 25 | structuredtype.cpp structuredtype.h 26 | typedictionary.cpp typedictionary.h 27 | visitor.h 28 | xmlelement.cpp xmlelement.h 29 | ) 30 | 31 | qt_internal_return_unless_building_tools() 32 | -------------------------------------------------------------------------------- /dist/changes-5.12.10: -------------------------------------------------------------------------------- 1 | Qt 5.12.10 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.12.9. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | https://doc.qt.io/qt-5.12/index.html 8 | 9 | The Qt version 5.12 series is binary compatible with the 5.11.x series. 10 | Applications compiled for 5.11 will continue to run with 5.12. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | **************************************************************************** 21 | * Important Behavior Changes * 22 | **************************************************************************** 23 | 24 | **************************************************************************** 25 | * Library * 26 | **************************************************************************** 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuawriteresult.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAWRITERESULT_H 5 | #define QOPCUAWRITERESULT_H 6 | 7 | #include 8 | 9 | #include 10 | 11 | QT_BEGIN_NAMESPACE 12 | 13 | class QOpcUaWriteResultData; 14 | class Q_OPCUA_EXPORT QOpcUaWriteResult 15 | { 16 | public: 17 | QOpcUaWriteResult(); 18 | QOpcUaWriteResult(const QOpcUaWriteResult &other); 19 | QOpcUaWriteResult &operator=(const QOpcUaWriteResult &rhs); 20 | ~QOpcUaWriteResult(); 21 | 22 | QString nodeId() const; 23 | void setNodeId(const QString &nodeId); 24 | 25 | QOpcUa::NodeAttribute attribute() const; 26 | void setAttribute(QOpcUa::NodeAttribute attribute); 27 | 28 | QString indexRange() const; 29 | void setIndexRange(const QString &indexRange); 30 | 31 | QOpcUa::UaStatusCode statusCode() const; 32 | void setStatusCode(QOpcUa::UaStatusCode statusCode); 33 | 34 | private: 35 | QSharedDataPointer data; 36 | }; 37 | 38 | QT_END_NAMESPACE 39 | 40 | Q_DECLARE_METATYPE(QOpcUaWriteResult) 41 | 42 | #endif // QOPCUAWRITERESULT_H 43 | -------------------------------------------------------------------------------- /src/opcua/x509/qopcuax509utils_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | // 5 | // W A R N I N G 6 | // ------------- 7 | // 8 | // This file is not part of the Qt API. It exists purely as an 9 | // implementation detail. This header file may change from version to 10 | // version without notice, or even be removed. 11 | // 12 | // We mean it. 13 | // 14 | 15 | #ifndef QOPCUAX509UTILS_H 16 | #define QOPCUAX509UTILS_H 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | QT_BEGIN_NAMESPACE 23 | 24 | template 25 | class Deleter 26 | { 27 | public: 28 | Deleter(T *data, std::function f) 29 | : m_data(data) 30 | , m_function(f) 31 | { 32 | } 33 | ~Deleter() 34 | { 35 | if (m_data) 36 | m_function(m_data); 37 | } 38 | void release() 39 | { 40 | m_data = nullptr; 41 | m_function = nullptr; 42 | } 43 | private: 44 | T *m_data {nullptr}; 45 | std::function m_function; 46 | }; 47 | 48 | QString getOpenSslError(); 49 | 50 | QT_END_NAMESPACE 51 | 52 | #endif // QOPCUAX509UTILS_H 53 | -------------------------------------------------------------------------------- /tests/auto/codegenerator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2024 basysKom GmbH, opensource@basyskom.com 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_qopcuaclient Test: 6 | ##################################################################### 7 | 8 | qt_internal_add_test(tst_codegen 9 | SOURCES 10 | tst_codegen.cpp 11 | INCLUDE_DIRECTORIES 12 | ${CMAKE_CURRENT_BINARY_DIR} 13 | LIBRARIES 14 | Qt::OpcUa 15 | Qt::OpcUaPrivate 16 | ) 17 | 18 | qt_opcua_generate_datatypes( 19 | tst_codegen 20 | OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated" 21 | INPUT_BSD "${CMAKE_CURRENT_SOURCE_DIR}/../../open62541-testserver/TestModel/qtopcuatestmodel.bsd" 22 | INPUT_CSV_MAP "TestModel:${CMAKE_CURRENT_SOURCE_DIR}/../../open62541-testserver/TestModel/qtopcuatestmodel.csv" 23 | PREFIX "CodegenTest" 24 | ) 25 | 26 | qt_opcua_generate_datatypes( 27 | tst_codegen 28 | OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated2" 29 | INPUT_CSV_MAP "CsvOnlyTest:${CMAKE_CURRENT_SOURCE_DIR}/testids.csv" 30 | PREFIX "CsvOnlyTest" 31 | ) 32 | 33 | if (WIN32) 34 | target_compile_definitions(tst_codegen PRIVATE TESTS_CMAKE_SPECIFIC_PATH) 35 | endif() 36 | -------------------------------------------------------------------------------- /tests/auto/qopcuaclient/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: BSD-3-Clause 3 | 4 | ##################################################################### 5 | ## tst_qopcuaclient Test: 6 | ##################################################################### 7 | 8 | qt_internal_add_test(tst_qopcuaclient 9 | SOURCES 10 | tst_client.cpp 11 | LIBRARIES 12 | Qt::OpcUa 13 | Qt::OpcUaPrivate 14 | ) 15 | 16 | # Resources: 17 | set(data_resource_files 18 | "../../open62541-testserver/pki/own/certs/open62541-testserver.der" 19 | ) 20 | 21 | qt_internal_add_resource(tst_qopcuaclient "data" 22 | PREFIX 23 | "/" 24 | FILES 25 | ${data_resource_files} 26 | ) 27 | 28 | ## Scopes: 29 | ##################################################################### 30 | 31 | qt_internal_extend_target(tst_qopcuaclient CONDITION QT_FEATURE_open62541_security AND QT_FEATURE_open62541 32 | DEFINES 33 | SERVER_SUPPORTS_SECURITY 34 | ) 35 | 36 | qt_internal_extend_target(tst_qopcuaclient CONDITION NOT QT_FEATURE_ns0idnames 37 | DEFINES 38 | QT_OPCUA_NO_NS0IDNAMES 39 | ) 40 | 41 | if (WIN32) 42 | target_compile_definitions(tst_qopcuaclient PRIVATE TESTS_CMAKE_SPECIFIC_PATH) 43 | endif() 44 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qml/Tank1Unit.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // Copyright (C) 2018 The Qt Company Ltd. 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 4 | 5 | import QtQuick 6 | import QtQuick.Controls 7 | import QtQuick.Layouts 8 | 9 | Item { 10 | property alias tankHeight: tank1.height 11 | property alias startButtonEnabled: startButton.enabled 12 | property alias stopButtonEnabled: stopButton.enabled 13 | property alias percentFilled: tank1.percentFilled 14 | property alias startButtonText: startButton.text 15 | property alias stopButtonText: stopButton.text 16 | signal startPump() 17 | signal stopPump() 18 | 19 | ColumnLayout { 20 | anchors.fill: parent 21 | RowLayout { 22 | Button { 23 | id: startButton 24 | text: "Start" 25 | onClicked: startPump() 26 | } 27 | Button { 28 | id: stopButton 29 | text: "Stop" 30 | onClicked: stopPump() 31 | } 32 | } 33 | TankDisplay { 34 | id: tank1 35 | Layout.fillHeight: true 36 | Layout.fillWidth: true 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qmlcpp/TankSimulation.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | import QtQuick 5 | import QtQuick.Layouts 6 | import QtQuick.Controls 7 | import OpcUaMachineBackend 8 | 9 | RowLayout { 10 | opacity: uaBackend.connected ? 1.0 : 0.25 11 | 12 | Tank1Unit { 13 | id: tank1unit 14 | Layout.fillHeight: true 15 | Layout.fillWidth: true 16 | } 17 | 18 | Pump {} 19 | 20 | Tank2Unit { 21 | Layout.fillHeight: true 22 | Layout.fillWidth: true 23 | } 24 | 25 | Slider { 26 | id: setpointSlider 27 | Layout.fillHeight: false 28 | Layout.preferredHeight: tank1unit.tankHeight 29 | Layout.alignment: Qt.AlignBottom 30 | enabled: uaBackend.connected 31 | && uaBackend.machineState === OpcUaMachineBackend.MachineState.Idle 32 | from: 0 33 | to: 100 34 | value: uaBackend.tank2TargetPercent 35 | live: false 36 | stepSize: 1.0 37 | orientation: Qt.Vertical 38 | onValueChanged: { 39 | uaBackend.machineWriteTank2TargetPercent(value); 40 | } 41 | } 42 | 43 | ValueDisplay {} 44 | } 45 | -------------------------------------------------------------------------------- /src/declarative_opcua/opcuanodeid_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUA_OPCUANODEID_P_H 5 | #define QOPCUA_OPCUANODEID_P_H 6 | 7 | #include 8 | 9 | #include 10 | 11 | // 12 | // W A R N I N G 13 | // ------------- 14 | // 15 | // This file is not part of the Qt API. It exists purely as an 16 | // implementation detail. This header file may change from version to 17 | // version without notice, or even be removed. 18 | // 19 | // We mean it. 20 | // 21 | 22 | QT_BEGIN_NAMESPACE 23 | 24 | class OpcUaNodeId : public OpcUaNodeIdType 25 | { 26 | Q_OBJECT 27 | Q_PROPERTY(QString ns READ nodeNamespace WRITE setNodeNamespace NOTIFY nodeNamespaceChanged) 28 | Q_PROPERTY(QString identifier READ identifier WRITE setIdentifier NOTIFY identifierChanged) 29 | 30 | QML_NAMED_ELEMENT(NodeId) 31 | QML_ADDED_IN_VERSION(5, 12) 32 | 33 | public: 34 | OpcUaNodeId(QObject *parent = nullptr); 35 | 36 | signals: 37 | void nodeNamespaceChanged(const QString &); 38 | void identifierChanged(const QString &); 39 | void nodeChanged(); 40 | }; 41 | 42 | QT_END_NAMESPACE 43 | 44 | #endif // QOPCUA_OPCUANODEID_P_H 45 | -------------------------------------------------------------------------------- /src/opcua/x509/qopcuax509extensionsubjectalternativename.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAX509EXTENSIONSUBJECTALTERNATIVENAME_H 5 | #define QOPCUAX509EXTENSIONSUBJECTALTERNATIVENAME_H 6 | 7 | #include "QtOpcUa/qopcuax509extension.h" 8 | #include 9 | 10 | QT_BEGIN_NAMESPACE 11 | 12 | // OID 2.5.29.17 13 | class Q_OPCUA_EXPORT QOpcUaX509ExtensionSubjectAlternativeName : public QOpcUaX509Extension 14 | { 15 | public: 16 | enum class Type { 17 | Email, 18 | URI, 19 | DNS, 20 | IP, 21 | }; 22 | 23 | QOpcUaX509ExtensionSubjectAlternativeName(); 24 | QOpcUaX509ExtensionSubjectAlternativeName(const QOpcUaX509ExtensionSubjectAlternativeName &); 25 | QOpcUaX509ExtensionSubjectAlternativeName &operator=(const QOpcUaX509ExtensionSubjectAlternativeName &); 26 | bool operator==(const QOpcUaX509ExtensionSubjectAlternativeName &rhs) const; 27 | ~QOpcUaX509ExtensionSubjectAlternativeName(); 28 | 29 | void addEntry(Type type, const QString &value); 30 | const QList> &entries() const; 31 | }; 32 | 33 | QT_END_NAMESPACE 34 | #endif // QOPCUAX509EXTENSIONSUBJECTALTERNATIVENAME_H 35 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuadoublecomplexnumber.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUADOUBLECOMPLEXNUMBER_H 5 | #define QOPCUADOUBLECOMPLEXNUMBER_H 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | QT_BEGIN_NAMESPACE 13 | 14 | class QOpcUaDoubleComplexNumberData; 15 | class Q_OPCUA_EXPORT QOpcUaDoubleComplexNumber 16 | { 17 | public: 18 | QOpcUaDoubleComplexNumber(); 19 | QOpcUaDoubleComplexNumber(const QOpcUaDoubleComplexNumber &); 20 | QOpcUaDoubleComplexNumber(double real, double imaginary); 21 | QOpcUaDoubleComplexNumber &operator=(const QOpcUaDoubleComplexNumber &); 22 | bool operator==(const QOpcUaDoubleComplexNumber &rhs) const; 23 | operator QVariant() const; 24 | ~QOpcUaDoubleComplexNumber(); 25 | 26 | double real() const; 27 | void setReal(double real); 28 | 29 | double imaginary() const; 30 | void setImaginary(double imaginary); 31 | 32 | private: 33 | QSharedDataPointer data; 34 | }; 35 | 36 | QT_END_NAMESPACE 37 | 38 | Q_DECLARE_METATYPE(QOpcUaDoubleComplexNumber) 39 | 40 | #endif // QOPCUADOUBLECOMPLEXNUMBER_H 41 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qmlcpp/Tank2Unit.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | import QtQuick 5 | import QtQuick.Controls 6 | import QtQuick.Layouts 7 | import OpcUaMachineBackend 8 | 9 | Item { 10 | ColumnLayout { 11 | anchors.fill: parent 12 | Layout.fillHeight: true 13 | 14 | Button { 15 | id: flushButton 16 | text: "Flush" 17 | enabled: uaBackend.connected 18 | && uaBackend.machineState === OpcUaMachineBackend.MachineState.Idle 19 | && uaBackend.percentFilledTank2 > uaBackend.tank2TargetPercent 20 | onClicked: { 21 | uaBackend.flushTank2() 22 | } 23 | } 24 | 25 | Tank { 26 | id: tank2 27 | Layout.fillHeight: true 28 | Layout.fillWidth: true 29 | percentFilled: uaBackend.percentFilledTank2 30 | Rectangle { 31 | color: uaBackend.tank2ValveState ? "#00BFFF" : "lightgrey" 32 | anchors.top: parent.bottom 33 | anchors.right: parent.right 34 | width: tank2.width / 10 35 | height: 40 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/opcua/x509/qopcuax509distinguishedname.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUADISTINGUISHEDNAME_H 5 | #define QOPCUADISTINGUISHEDNAME_H 6 | 7 | #include 8 | #include 9 | 10 | QT_BEGIN_NAMESPACE 11 | 12 | class QOpcUaX509DistinguishedNameData; 13 | class Q_OPCUA_EXPORT QOpcUaX509DistinguishedName 14 | { 15 | public: 16 | enum class Type { 17 | CommonName, // 2.5.4.3 18 | CountryName, // 2.5.4.6 19 | LocalityName, // 2.5.4.7 20 | StateOrProvinceName, // 2.5.4.8 21 | OrganizationName, // 2.5.4.10 22 | }; 23 | 24 | QOpcUaX509DistinguishedName(); 25 | QOpcUaX509DistinguishedName(const QOpcUaX509DistinguishedName &); 26 | QOpcUaX509DistinguishedName &operator=(const QOpcUaX509DistinguishedName &); 27 | bool operator==(const QOpcUaX509DistinguishedName &rhs) const; 28 | ~QOpcUaX509DistinguishedName(); 29 | void setEntry(Type type, const QString &value); 30 | QString entry(Type type) const; 31 | static QString typeToOid(Type type); 32 | 33 | private: 34 | QSharedDataPointer data; 35 | }; 36 | 37 | QT_END_NAMESPACE 38 | 39 | #endif // QOPCUADISTINGUISHEDNAME_H 40 | -------------------------------------------------------------------------------- /coin/axivion/ci_config_linux.json: -------------------------------------------------------------------------------- 1 | { 2 | "Project": { 3 | "BuildSystemIntegration": { 4 | "child_order": [ 5 | "GCCSetup", 6 | "CMake", 7 | "LinkLibraries" 8 | ] 9 | }, 10 | "CMake": { 11 | "_active": true, 12 | "_copy_from": "CMakeIntegration", 13 | "build_environment": {}, 14 | "build_options": "-j4", 15 | "generate_options": "--fresh", 16 | "generator": "Ninja" 17 | }, 18 | "GCCSetup": { 19 | "_active": true, 20 | "_copy_from": "Command", 21 | "build_command": "gccsetup --cc gcc --cxx g++ --config ../../../axivion/" 22 | }, 23 | "LinkLibraries": { 24 | "_active": true, 25 | "_copy_from": "AxivionLinker", 26 | "input_files": [ 27 | "build/lib/lib*.so*.ir", 28 | "build/qml/*/lib*.so*.ir" 29 | ], 30 | "ir": "build/$(env:TESTED_MODULE_COIN).ir", 31 | "plugin_files": [ 32 | "build/plugins/*/lib*.so*.ir" 33 | ] 34 | } 35 | }, 36 | "_Format": "1.0", 37 | "_Version": "7.6.2", 38 | "_VersionNum": [ 39 | 7, 40 | 6, 41 | 2, 42 | 12725 43 | ] 44 | } 45 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuabrowsepathtarget.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUABROWSEPATHTARGET_H 5 | #define QOPCUABROWSEPATHTARGET_H 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | QT_BEGIN_NAMESPACE 13 | 14 | class QOpcUaBrowsePathTargetData; 15 | class Q_OPCUA_EXPORT QOpcUaBrowsePathTarget 16 | { 17 | public: 18 | QOpcUaBrowsePathTarget(); 19 | QOpcUaBrowsePathTarget(const QOpcUaBrowsePathTarget &); 20 | QOpcUaBrowsePathTarget &operator=(const QOpcUaBrowsePathTarget &); 21 | bool operator==(const QOpcUaBrowsePathTarget &rhs) const; 22 | ~QOpcUaBrowsePathTarget(); 23 | 24 | QOpcUaExpandedNodeId targetId() const; 25 | QOpcUaExpandedNodeId &targetIdRef(); 26 | void setTargetId(const QOpcUaExpandedNodeId &targetId); 27 | 28 | quint32 remainingPathIndex() const; 29 | void setRemainingPathIndex(quint32 remainingPathIndex); 30 | 31 | bool isFullyResolved() const; 32 | 33 | private: 34 | QSharedDataPointer data; 35 | }; 36 | 37 | QT_END_NAMESPACE 38 | 39 | Q_DECLARE_METATYPE(QOpcUaBrowsePathTarget) 40 | 41 | #endif // QOPCUABROWSEPATHTARGET_H 42 | -------------------------------------------------------------------------------- /src/declarative_opcua/opcuaelementoperand_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef OPCUAELEMENTOPERAND_P_H 5 | #define OPCUAELEMENTOPERAND_P_H 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | // 12 | // W A R N I N G 13 | // ------------- 14 | // 15 | // This file is not part of the Qt API. It exists purely as an 16 | // implementation detail. This header file may change from version to 17 | // version without notice, or even be removed. 18 | // 19 | // We mean it. 20 | // 21 | 22 | QT_BEGIN_NAMESPACE 23 | 24 | class QOpcUaClient; 25 | 26 | class OpcUaElementOperand : public OpcUaOperandBase, private QOpcUaElementOperand { 27 | Q_OBJECT 28 | Q_PROPERTY(quint32 index READ index WRITE setIndex) 29 | QML_NAMED_ELEMENT(ElementOperand) 30 | QML_ADDED_IN_VERSION(5, 13) 31 | 32 | public: 33 | explicit OpcUaElementOperand(QObject *parent = nullptr); 34 | ~OpcUaElementOperand(); 35 | virtual QVariant toCppVariant(QOpcUaClient *client) const override; 36 | 37 | quint32 index() const; 38 | void setIndex(quint32 index); 39 | 40 | signals: 41 | void dataChanged(); 42 | }; 43 | 44 | QT_END_NAMESPACE 45 | 46 | #endif // OPCUAELEMENTOPERAND_P_H 47 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qml/ValueDisplay.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // Copyright (C) 2018 The Qt Company Ltd. 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 4 | 5 | import QtQuick 6 | import QtQuick.Controls 7 | import QtQuick.Layouts 8 | 9 | ColumnLayout { 10 | property string designation 11 | property int percentFilledTank1 12 | property int percentFilledTank2 13 | property int targetPercentTank2 14 | property string machineState 15 | property bool valveState 16 | 17 | Text { 18 | font.pointSize: 12 19 | text: "Machine Status" 20 | } 21 | Text { 22 | font.pointSize: 10 23 | text: "Designation: " + designation 24 | } 25 | Text { 26 | font.pointSize: 10 27 | text: "State: " + machineState 28 | } 29 | Text { 30 | font.pointSize: 10 31 | text: "Tank 1: " + percentFilledTank1 + "%" 32 | } 33 | Text { 34 | font.pointSize: 10 35 | text: "Tank 2: " + percentFilledTank2 + "%" 36 | } 37 | Text { 38 | font.pointSize: 10 39 | text: "Setpoint: " + targetPercentTank2 + "%" 40 | } 41 | Text { 42 | font.pointSize: 10 43 | text: "Valve: " + (valveState ? "Open" : "Closed") 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/declarative_opcua/opcuaattributecache_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUA_OPCUAATTRIBUTECACHE_P_H 5 | #define QOPCUA_OPCUAATTRIBUTECACHE_P_H 6 | 7 | #include "qopcuatype.h" 8 | #include 9 | #include 10 | #include 11 | 12 | // 13 | // W A R N I N G 14 | // ------------- 15 | // 16 | // This file is not part of the Qt API. It exists purely as an 17 | // implementation detail. This header file may change from version to 18 | // version without notice, or even be removed. 19 | // 20 | // We mean it. 21 | // 22 | 23 | 24 | QT_BEGIN_NAMESPACE 25 | 26 | class OpcUaAttributeValue; 27 | 28 | class OpcUaAttributeCache : public QObject 29 | { 30 | Q_OBJECT 31 | public: 32 | explicit OpcUaAttributeCache(QObject *parent = nullptr); 33 | OpcUaAttributeValue *attribute(QOpcUa::NodeAttribute attribute); 34 | const QVariant &attributeValue(QOpcUa::NodeAttribute); 35 | 36 | public slots: 37 | void setAttributeValue(QOpcUa::NodeAttribute attribute, const QVariant &value); 38 | void invalidate(); 39 | 40 | private: 41 | QHash m_attributeCache; 42 | }; 43 | 44 | QT_END_NAMESPACE 45 | 46 | #endif // QOPCUA_OPCUAATTRIBUTECACHE_P_H 47 | -------------------------------------------------------------------------------- /config.tests/open62541/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include 5 | #include "open62541.h" 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | /* Create a client and connect */ 10 | UA_Client *client = UA_Client_new(); 11 | UA_ClientConfig_setDefault(UA_Client_getConfig(client)); 12 | UA_StatusCode status = UA_Client_connect(client, "opc.tcp://localhost:4840"); 13 | if (status != UA_STATUSCODE_GOOD) { 14 | UA_Client_delete(client); 15 | return status; 16 | } 17 | 18 | /* Read the value attribute of the node. UA_Client_readValueAttribute is a 19 | * wrapper for the raw read service available as UA_Client_Service_read. */ 20 | UA_Variant value; /* Variants can hold scalar values and arrays of any type */ 21 | UA_Variant_init(&value); 22 | status = UA_Client_readValueAttribute(client, UA_NODEID_STRING(1, (char*)("the.answer")), &value); 23 | if (status == UA_STATUSCODE_GOOD && 24 | UA_Variant_hasScalarType(&value, &UA_TYPES[UA_TYPES_INT32])) { 25 | printf("the value is: %i\n", *(UA_Int32*)value.data); 26 | } 27 | 28 | /* Clean up */ 29 | UA_Variant_clear(&value); 30 | UA_Client_delete(client); /* Disconnects the client internally */ 31 | return status; 32 | } 33 | -------------------------------------------------------------------------------- /examples/opcua/x509/doc/x509.qdoc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only 3 | 4 | /*! 5 | \example x509 6 | \ingroup qtopcua-examples 7 | \title Qt OPC UA X509 Support 8 | \examplecategory {Data Processing & I/O} 9 | \brief Shows how to generate keys and certificate signing requests. 10 | 11 | This example shows how client applications can generate their own self-signed certificate 12 | or generate a certificate signing request. 13 | 14 | \section1 Generating RSA key 15 | At first, an RSA key is generated: 16 | \snippet x509/main.cpp 0 17 | 18 | The private key can be saved to a file for further usage: 19 | \snippet x509/main.cpp 1 20 | 21 | \section1 Generating certificate signing requests 22 | 23 | Next, a certificate signing request is created. It is also necessary to set the subject 24 | of the certificate and add all the extensions needed for OPC UA. 25 | \snippet x509/main.cpp 2 26 | 27 | Now there are two options: \br 28 | 29 | 1. When you need to get your certificate signing request signed by a certificate authority, 30 | you have to use the request data. 31 | \snippet x509/main.cpp 3 32 | 33 | 2. When there is no certificate authority, you have to self-sign the request. 34 | \snippet x509/main.cpp 4 35 | */ 36 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuacontentfilterelementresult.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUACONTENTFILTERELEMENTRESULT_H 5 | #define QOPCUACONTENTFILTERELEMENTRESULT_H 6 | 7 | #include 8 | 9 | #include 10 | 11 | QT_BEGIN_NAMESPACE 12 | 13 | class QOpcUaContentFilterElementResultData; 14 | class Q_OPCUA_EXPORT QOpcUaContentFilterElementResult 15 | { 16 | public: 17 | QOpcUaContentFilterElementResult(); 18 | QOpcUaContentFilterElementResult(const QOpcUaContentFilterElementResult &); 19 | QOpcUaContentFilterElementResult &operator=(const QOpcUaContentFilterElementResult &); 20 | ~QOpcUaContentFilterElementResult(); 21 | 22 | QOpcUa::UaStatusCode statusCode() const; 23 | void setStatusCode(QOpcUa::UaStatusCode statusCode); 24 | 25 | QList operandStatusCodes() const; 26 | QList &operandStatusCodesRef(); 27 | void setOperandStatusCodes(const QList &operandStatusCodes); 28 | 29 | private: 30 | QSharedDataPointer data; 31 | }; 32 | 33 | QT_END_NAMESPACE 34 | 35 | Q_DECLARE_METATYPE(QOpcUaContentFilterElementResult) 36 | 37 | #endif // QOPCUACONTENTFILTERELEMENTRESULT_H 38 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuahistorydata.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAHISTORYDATA_H 5 | #define QOPCUAHISTORYDATA_H 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | QT_BEGIN_NAMESPACE 14 | 15 | class QOpcUaHistoryDataData; 16 | class Q_OPCUA_EXPORT QOpcUaHistoryData 17 | { 18 | public: 19 | QOpcUaHistoryData(); 20 | explicit QOpcUaHistoryData(const QString &nodeId); 21 | QOpcUaHistoryData(const QOpcUaHistoryData &other); 22 | ~QOpcUaHistoryData(); 23 | 24 | void swap(QOpcUaHistoryData &other) noexcept 25 | { data.swap(other.data); } 26 | 27 | QOpcUa::UaStatusCode statusCode() const; 28 | void setStatusCode(QOpcUa::UaStatusCode statusCode); 29 | QList result() const; 30 | int count() const; 31 | void addValue(const QOpcUaDataValue &value); 32 | QString nodeId() const; 33 | void setNodeId(const QString &nodeId); 34 | 35 | QOpcUaHistoryData &operator=(const QOpcUaHistoryData &other); 36 | private: 37 | QExplicitlySharedDataPointer data; 38 | }; 39 | 40 | Q_DECLARE_SHARED(QOpcUaHistoryData) 41 | 42 | QT_END_NAMESPACE 43 | 44 | #endif // QOPCUAHISTORYDATA_H 45 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuaqualifiedname.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAQUALIFIEDNAMEDATA_H 5 | #define QOPCUAQUALIFIEDNAMEDATA_H 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | QT_BEGIN_NAMESPACE 13 | 14 | class QOpcUaQualifiedNameData; 15 | class Q_OPCUA_EXPORT QOpcUaQualifiedName 16 | { 17 | public: 18 | QOpcUaQualifiedName(); 19 | QOpcUaQualifiedName(const QOpcUaQualifiedName &); 20 | QOpcUaQualifiedName(quint16 namespaceIndex, const QString &name); 21 | QOpcUaQualifiedName &operator=(const QOpcUaQualifiedName &); 22 | bool operator==(const QOpcUaQualifiedName &rhs) const; 23 | operator QVariant() const; 24 | ~QOpcUaQualifiedName(); 25 | 26 | QString name() const; 27 | void setName(const QString &name); 28 | 29 | quint16 namespaceIndex() const; 30 | void setNamespaceIndex(quint16 namespaceIndex); 31 | 32 | private: 33 | QSharedDataPointer data; 34 | 35 | #ifndef QT_NO_DEBUG_STREAM 36 | friend Q_OPCUA_EXPORT QDebug operator<<(QDebug debug, const QOpcUaQualifiedName &qn); 37 | #endif 38 | }; 39 | 40 | QT_END_NAMESPACE 41 | 42 | Q_DECLARE_METATYPE(QOpcUaQualifiedName) 43 | 44 | #endif // QOPCUAQUALIFIEDNAMEDATA_H 45 | -------------------------------------------------------------------------------- /tools/datatypecodegenerator/dependencydatatypevalidator.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #pragma once 5 | 6 | #include "visitor.h" 7 | 8 | #include 9 | 10 | class XmlElement; 11 | 12 | class DependencyDataTypeValidator : public Visitor 13 | { 14 | public: 15 | enum ReadResolveDependencies { ReadDependencies, ResolveDependencies }; 16 | 17 | DependencyDataTypeValidator(); 18 | ~DependencyDataTypeValidator() override = default; 19 | 20 | void visit(EnumeratedType *enumeratedType) override; 21 | void visit(EnumeratedValue *enumeratedValue) override; 22 | void visit(Field *field) override; 23 | void visit(Import *import) override; 24 | void visit(StructuredType *structuredType) override; 25 | void visit(TypeDictionary *typeDictionary) override; 26 | void visit(XmlElement *xmlElement) override; 27 | 28 | QStringList unresolvedDependencyStringList() const; 29 | 30 | QList resolvedDependencyElementList() const; 31 | 32 | void setReadResolveDependencies(const ReadResolveDependencies &readResolveDependencies); 33 | 34 | private: 35 | ReadResolveDependencies m_readResolveDependencies; 36 | QList m_resolvedDependencyElementList; 37 | QStringList m_unresolvedDependencyStringList; 38 | }; 39 | -------------------------------------------------------------------------------- /src/declarative_opcua/opcuamethodargument_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUA_OPCUAMETHODARGUMENT_P_H 5 | #define QOPCUA_OPCUAMETHODARGUMENT_P_H 6 | 7 | #include "qopcuatype.h" 8 | #include 9 | #include 10 | #include 11 | 12 | // 13 | // W A R N I N G 14 | // ------------- 15 | // 16 | // This file is not part of the Qt API. It exists purely as an 17 | // implementation detail. This header file may change from version to 18 | // version without notice, or even be removed. 19 | // 20 | // We mean it. 21 | // 22 | 23 | QT_BEGIN_NAMESPACE 24 | 25 | class OpcUaMethodArgument : public QObject 26 | { 27 | Q_OBJECT 28 | Q_PROPERTY(QVariant value READ value WRITE setValue) 29 | Q_PROPERTY(QOpcUa::Types type READ type WRITE setType) 30 | 31 | QML_NAMED_ELEMENT(MethodArgument) 32 | QML_ADDED_IN_VERSION(5, 13) 33 | 34 | public: 35 | explicit OpcUaMethodArgument(QObject *parent = nullptr); 36 | QVariant value() const; 37 | QOpcUa::Types type() const; 38 | 39 | public slots: 40 | void setValue(QVariant value); 41 | void setType(QOpcUa::Types type); 42 | 43 | private: 44 | QVariant m_value; 45 | QOpcUa::Types m_type; 46 | }; 47 | 48 | QT_END_NAMESPACE 49 | 50 | #endif // QOPCUA_OPCUAMETHODARGUMENT_P_H 51 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qml/ServerControl.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // Copyright (C) 2018 The Qt Company Ltd. 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 4 | 5 | import QtQuick 6 | import QtQuick.Controls 7 | import QtQuick.Layouts 8 | import QtOpcUa as QtOpcUa 9 | 10 | RowLayout { 11 | readonly property alias backend: backendSelector.currentText 12 | property QtOpcUa.Connection connection 13 | property QtOpcUa.ServerDiscovery serverDiscovery 14 | signal resetSimulation() 15 | property alias resetButtonText: resetButton.text 16 | 17 | TextField { 18 | id: uaUrl 19 | Layout.fillWidth: true 20 | text: "opc.tcp://127.0.0.1:43344" 21 | } 22 | ComboBox { 23 | id: backendSelector 24 | model: connection.availableBackends 25 | } 26 | 27 | Button { 28 | text: connection.connected ? "Disconnect" : "Connect" 29 | enabled: connection.availableBackends.length > 0 30 | onClicked: { 31 | if (connection.connected) 32 | connection.disconnectFromEndpoint() 33 | else 34 | serverDiscovery.discoveryUrl = uaUrl.text; 35 | } 36 | } 37 | Button { 38 | id: resetButton 39 | text: "Reset simulation" 40 | enabled: connection.connected 41 | onClicked: resetSimulation() 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuaexpandednodeid.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAEXPANDEDNODEID_H 5 | #define QOPCUAEXPANDEDNODEID_H 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | QT_BEGIN_NAMESPACE 13 | 14 | class QOpcUaExpandedNodeIdData; 15 | class Q_OPCUA_EXPORT QOpcUaExpandedNodeId 16 | { 17 | public: 18 | QOpcUaExpandedNodeId(); 19 | QOpcUaExpandedNodeId(const QOpcUaExpandedNodeId &); 20 | QOpcUaExpandedNodeId(const QString &nodeId); 21 | QOpcUaExpandedNodeId(const QString &namespaceUri, const QString &nodeId, quint32 serverIndex = 0); 22 | QOpcUaExpandedNodeId &operator=(const QOpcUaExpandedNodeId &); 23 | bool operator==(const QOpcUaExpandedNodeId &) const; 24 | operator QVariant() const; 25 | ~QOpcUaExpandedNodeId(); 26 | 27 | quint32 serverIndex() const; 28 | void setServerIndex(quint32 serverIndex); 29 | 30 | QString namespaceUri() const; 31 | void setNamespaceUri(const QString &namespaceUri); 32 | 33 | QString nodeId() const; 34 | void setNodeId(const QString &nodeId); 35 | 36 | private: 37 | QSharedDataPointer data; 38 | }; 39 | 40 | QT_END_NAMESPACE 41 | 42 | Q_DECLARE_METATYPE(QOpcUaExpandedNodeId) 43 | 44 | #endif // QOPCUAEXPANDEDNODEID_H 45 | -------------------------------------------------------------------------------- /tools/datatypecodegenerator/typedictionary.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | class Import; 9 | class Visitor; 10 | class XmlElement; 11 | 12 | class TypeDictionary 13 | { 14 | public: 15 | TypeDictionary(bool dependencyTypeDictionary, 16 | const QString &defaultByOrder, 17 | const QString &targetNamespace, 18 | const QMap &namespaces); 19 | ~TypeDictionary(); 20 | 21 | void addType(XmlElement *type); 22 | void print() const; 23 | void accept(Visitor *visitor); 24 | 25 | QMap namespaces() const; 26 | void setNamespaces(const QMap &namespaces); 27 | 28 | QString defaultByOrder() const; 29 | void setDefaultByOrder(const QString &defaultByOrder); 30 | 31 | QString targetNamespace() const; 32 | void setTargetNamespace(const QString &targetNamespace); 33 | 34 | QList imports() const; 35 | 36 | bool dependencyTypeDictionary() const; 37 | 38 | QList types() const; 39 | 40 | private: 41 | bool m_dependencyTypeDictionary; 42 | QString m_defaultByOrder; 43 | QString m_targetNamespace; 44 | QMap m_namespaces; 45 | QList m_types; 46 | }; 47 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qmlcpp/Tank1Unit.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | import QtQuick 5 | import QtQuick.Controls 6 | import QtQuick.Layouts 7 | import OpcUaMachineBackend 8 | 9 | Item { 10 | property alias tankHeight: tank1.height 11 | 12 | ColumnLayout { 13 | anchors.fill: parent 14 | 15 | RowLayout { 16 | Button { 17 | id: startButton 18 | text: "Start" 19 | enabled: uaBackend.connected 20 | && uaBackend.machineState === OpcUaMachineBackend.MachineState.Idle 21 | && uaBackend.percentFilledTank1 > 0 22 | && uaBackend.percentFilledTank2 < uaBackend.tank2TargetPercent 23 | onClicked: uaBackend.startPump() 24 | } 25 | 26 | Button { 27 | id: stopButton 28 | text: "Stop" 29 | enabled: uaBackend.connected 30 | && uaBackend.machineState === OpcUaMachineBackend.MachineState.Pumping 31 | onClicked: uaBackend.stopPump() 32 | } 33 | } 34 | 35 | Tank { 36 | id: tank1 37 | Layout.fillHeight: true 38 | Layout.fillWidth: true 39 | percentFilled: uaBackend.percentFilledTank1 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuaerrorstate.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAERRORSTATE_H 5 | #define QOPCUAERRORSTATE_H 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | QT_BEGIN_NAMESPACE 12 | 13 | class QOpcUaErrorStateData; 14 | 15 | class Q_OPCUA_EXPORT QOpcUaErrorState 16 | { 17 | public: 18 | enum class ConnectionStep { 19 | Unknown = 0x00, 20 | CertificateValidation, 21 | OpenSecureChannel, 22 | CreateSession, 23 | ActivateSession, 24 | }; 25 | 26 | QOpcUaErrorState(); 27 | QOpcUaErrorState(const QOpcUaErrorState &other); 28 | QOpcUaErrorState &operator =(const QOpcUaErrorState &rhs); 29 | ~QOpcUaErrorState(); 30 | 31 | ConnectionStep connectionStep() const; 32 | void setConnectionStep(ConnectionStep step); 33 | 34 | QOpcUa::UaStatusCode errorCode() const; 35 | void setErrorCode(QOpcUa::UaStatusCode error); 36 | 37 | bool isClientSideError() const; 38 | void setClientSideError(bool clientSideError); 39 | 40 | void setIgnoreError(bool ignore = true); 41 | bool ignoreError() const; 42 | 43 | private: 44 | QSharedDataPointer data; 45 | }; 46 | 47 | QT_END_NAMESPACE 48 | 49 | Q_DECLARE_METATYPE(QOpcUaErrorState) 50 | 51 | #endif // QOPCUAERRORSTATE_H 52 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qmlcpp/ValueDisplay.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | import QtQuick 5 | import QtQuick.Layouts 6 | import OpcUaMachineBackend 7 | 8 | ColumnLayout { 9 | Text { 10 | font.pointSize: 12 11 | text: "Machine Status" 12 | } 13 | Text { 14 | font.pointSize: 10 15 | text: "Designation: " + uaBackend.machineDesignation 16 | } 17 | Text { 18 | font.pointSize: 10 19 | text: "State: " 20 | + (uaBackend.machineState === OpcUaMachineBackend.MachineState.Idle 21 | ? "Idle" 22 | : (uaBackend.machineState === OpcUaMachineBackend.MachineState.Pumping ? "Pumping" 23 | : "Flushing")) 24 | } 25 | Text { 26 | font.pointSize: 10 27 | text: "Tank 1: " + uaBackend.percentFilledTank1 + "%" 28 | } 29 | Text { 30 | font.pointSize: 10 31 | text: "Tank 2: " + uaBackend.percentFilledTank2 + "%" 32 | } 33 | Text { 34 | font.pointSize: 10 35 | text: "Setpoint: " + uaBackend.tank2TargetPercent + "%" 36 | } 37 | Text { 38 | font.pointSize: 10 39 | text: "Valve: " + (uaBackend.tank2ValveState === false ? "Closed" : "Open"); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuasecuritypolicyuris_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2025 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | // 5 | // W A R N I N G 6 | // ------------- 7 | // 8 | // This file is not part of the Qt API. It exists purely as an 9 | // implementation detail. This header file may change from version to 10 | // version without notice, or even be removed. 11 | // 12 | // We mean it. 13 | // 14 | 15 | #ifndef QOPCUASECURITYPOLICYURIS_P_H 16 | #define QOPCUASECURITYPOLICYURIS_P_H 17 | 18 | #include 19 | 20 | QT_BEGIN_NAMESPACE 21 | 22 | namespace QOpcUa { 23 | static constexpr QLatin1StringView NonePolicy("http://opcfoundation.org/UA/SecurityPolicy#None"); 24 | static constexpr QLatin1StringView Basic128Rsa15Policy("http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15"); 25 | static constexpr QLatin1StringView Basic256Policy("http://opcfoundation.org/UA/SecurityPolicy#Basic256"); 26 | static constexpr QLatin1StringView Aes256Sha256RsaPssPolicy("http://opcfoundation.org/UA/SecurityPolicy#Aes256_Sha256_RsaPss"); 27 | static constexpr QLatin1StringView Basic256Sha256Policy("http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256"); 28 | static constexpr QLatin1StringView Aes128Sha256RsaOaepPolicy("http://opcfoundation.org/UA/SecurityPolicy#Aes128_Sha256_RsaOaep"); 29 | } 30 | 31 | QT_END_NAMESPACE 32 | 33 | #endif // QOPCUASECURITYPOLICYURIS_P_H 34 | -------------------------------------------------------------------------------- /src/declarative_opcua/opcuaattributevalue.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include 5 | 6 | QT_BEGIN_NAMESPACE 7 | 8 | /*! 9 | \class OpcUaAttributeValue 10 | \inqmlmodule QtOpcUa 11 | \brief Stores an attribute value and provides a changed signal. 12 | \internal 13 | \deprecated [6.9] 14 | 15 | This class is just for internal use in the declarative backend and not exposed to users. 16 | 17 | When setting the value it will emit a changed signal if the value has changed. 18 | 19 | \sa OpcUaAttributeCache 20 | */ 21 | 22 | OpcUaAttributeValue::OpcUaAttributeValue(QObject *parent) 23 | : QObject(parent) 24 | { 25 | 26 | } 27 | 28 | bool OpcUaAttributeValue::operator ==(const OpcUaAttributeValue &rhs) 29 | { 30 | return m_value == rhs.m_value; 31 | } 32 | 33 | void OpcUaAttributeValue::setValue(const QVariant &value) 34 | { 35 | if (value.metaType() != m_value.metaType() || value != m_value) { 36 | m_value = value; 37 | emit changed(m_value); 38 | } 39 | } 40 | 41 | void OpcUaAttributeValue::invalidate() 42 | { 43 | setValue(QVariant()); 44 | } 45 | 46 | const QVariant &OpcUaAttributeValue::value() const 47 | { 48 | return m_value; 49 | } 50 | 51 | OpcUaAttributeValue::operator QVariant() const 52 | { 53 | return value(); 54 | } 55 | 56 | QT_END_NAMESPACE 57 | -------------------------------------------------------------------------------- /src/plugins/opcua/open62541/qopen62541plugin.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include "qopen62541client.h" 5 | #include "qopen62541node.h" 6 | #include "qopen62541plugin.h" 7 | #include "qopen62541valueconverter.h" 8 | #include 9 | 10 | #include 11 | 12 | QT_BEGIN_NAMESPACE 13 | 14 | static void compileTimeEnforceEnumMappings(void) 15 | { 16 | static_assert(static_cast(UA_NODECLASS_UNSPECIFIED) == QOpcUa::NodeClass::Undefined, 17 | "open62541 and QOpcUa values for NodeClasses must be the same"); 18 | static_assert(static_cast(UA_NODECLASS_VARIABLE) == QOpcUa::NodeClass::Variable, 19 | "open62541 and QOpcUa values for NodeClasses must be the same"); 20 | } 21 | 22 | QOpen62541Plugin::QOpen62541Plugin(QObject *parent) 23 | : QOpcUaPlugin(parent) 24 | { 25 | compileTimeEnforceEnumMappings(); 26 | qRegisterMetaType(); 27 | } 28 | 29 | QOpen62541Plugin::~QOpen62541Plugin() 30 | { 31 | } 32 | 33 | QOpcUaClient *QOpen62541Plugin::createClient(const QVariantMap &backendProperties) 34 | { 35 | Q_UNUSED(backendProperties) 36 | return new QOpcUaClient(new QOpen62541Client(backendProperties)); 37 | } 38 | 39 | Q_LOGGING_CATEGORY(QT_OPCUA_PLUGINS_OPEN62541, "qt.opcua.plugins.open62541") 40 | 41 | QT_END_NAMESPACE 42 | -------------------------------------------------------------------------------- /tests/auto/declarative/BackendTestMultiplier.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only 3 | 4 | import QtQuick 5 | import QtOpcUa as QtOpcUa 6 | 7 | Item { 8 | property int currentTest: 0 9 | property string testName 10 | 11 | QtOpcUa.Connection { 12 | id: connection 13 | } 14 | 15 | Component.onCompleted: { 16 | var component = Qt.createComponent(testName + ".qml") 17 | if (component.status != Component.Ready) { 18 | console.log("Failed to load component " + testName, component.errorString()); 19 | return; 20 | } 21 | 22 | for (var backendIndex in connection.availableBackends) { 23 | var backend = connection.availableBackends[backendIndex]; 24 | console.log("Setting up", testName, "for", backend); 25 | var child = component.createObject(this, { "backendName": backend }); 26 | if (child == null) { 27 | console.log("Error creating object", testName); 28 | return; 29 | } 30 | child.completedChanged.connect(incrementTest); 31 | children.push(child); 32 | } 33 | children[currentTest].shouldRun = true; 34 | } 35 | 36 | function incrementTest() { 37 | currentTest += 1; 38 | if (currentTest < children.length) 39 | children[currentTest].shouldRun = true; 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /LICENSES/BSD-3-Clause.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) . 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 7 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 8 | 9 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 10 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuaeventfilterresult.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAEVENTFILTERRESULT_H 5 | #define QOPCUAEVENTFILTERRESULT_H 6 | 7 | #include 8 | 9 | #include 10 | 11 | QT_BEGIN_NAMESPACE 12 | 13 | class QOpcUaContentFilterElementResult; 14 | 15 | class QOpcUaEventFilterResultData; 16 | class Q_OPCUA_EXPORT QOpcUaEventFilterResult 17 | { 18 | public: 19 | QOpcUaEventFilterResult(); 20 | QOpcUaEventFilterResult(const QOpcUaEventFilterResult &); 21 | QOpcUaEventFilterResult &operator=(const QOpcUaEventFilterResult &); 22 | ~QOpcUaEventFilterResult(); 23 | 24 | bool isGood() const; 25 | 26 | QList selectClauseResults() const; 27 | QList &selectClauseResultsRef(); 28 | void setSelectClauseResults(const QList &selectClausesResult); 29 | 30 | QList whereClauseResults() const; 31 | QList &whereClauseResultsRef(); 32 | void setWhereClauseResults(const QList &whereClauseResult); 33 | 34 | private: 35 | QSharedDataPointer data; 36 | }; 37 | 38 | QT_END_NAMESPACE 39 | 40 | Q_DECLARE_METATYPE(QOpcUaEventFilterResult) 41 | 42 | #endif // QOPCUAEVENTFILTERRESULT_H 43 | -------------------------------------------------------------------------------- /dist/changes-5.15.2: -------------------------------------------------------------------------------- 1 | Qt 5.15.2 is a bug-fix release. It maintains both forward and backward 2 | compatibility (source and binary) with Qt 5.15.1. 3 | 4 | For more details, refer to the online documentation included in this 5 | distribution. The documentation is also available online: 6 | 7 | https://doc.qt.io/qt-5.15/index.html 8 | 9 | The Qt version 5.15 series is binary compatible with the 5.14.x series. 10 | Applications compiled for 5.14 will continue to run with 5.15. 11 | 12 | Some of the changes listed in this file include issue tracking numbers 13 | corresponding to tasks in the Qt Bug Tracker: 14 | 15 | https://bugreports.qt.io/ 16 | 17 | Each of these identifiers can be entered in the bug tracker to obtain more 18 | information about a particular change. 19 | 20 | **************************************************************************** 21 | * Important Behavior Changes * 22 | **************************************************************************** 23 | 24 | **************************************************************************** 25 | * Library * 26 | **************************************************************************** 27 | 28 | Open62541 Plugin 29 | ------- 30 | 31 | - Fix loading of PEM encoded certificates and private keys 32 | - Fix config test for system-open62541 33 | 34 | QML API 35 | ------- 36 | 37 | - Monitoring for value nodes is now reestablished on reconnect 38 | 39 | -------------------------------------------------------------------------------- /src/declarative_opcua/opcuaforeign.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | 5 | #include "opcuaforeign_p.h" 6 | 7 | QT_BEGIN_NAMESPACE 8 | 9 | /*! 10 | \qmlproperty enumeration Constants::NodeAttribute 11 | \deprecated [6.9] 12 | 13 | Attributes of a node 14 | 15 | \value Constants.NodeAttribute.NodeId 16 | \value Constants.NodeAttribute.NodeClass 17 | \value Constants.NodeAttribute.BrowseName 18 | \value Constants.NodeAttribute.DisplayName 19 | \value Constants.NodeAttribute.Description 20 | \value Constants.NodeAttribute.WriteMask 21 | \value Constants.NodeAttribute.UserWriteMask 22 | \value Constants.NodeAttribute.IsAbstract 23 | \value Constants.NodeAttribute.Symmetric 24 | \value Constants.NodeAttribute.InverseName 25 | \value Constants.NodeAttribute.ContainsNoLoops 26 | \value Constants.NodeAttribute.EventNotifier 27 | \value Constants.NodeAttribute.Value 28 | \value Constants.NodeAttribute.DataType 29 | \value Constants.NodeAttribute.ValueRank 30 | \value Constants.NodeAttribute.ArrayDimensions 31 | \value Constants.NodeAttribute.AccessLevel 32 | \value Constants.NodeAttribute.UserAccessLevel 33 | \value Constants.NodeAttribute.MinimumSamplingInterval 34 | \value Constants.NodeAttribute.Historizing 35 | \value Constants.NodeAttribute.Executable 36 | \value Constants.NodeAttribute.UserExecutable 37 | */ 38 | 39 | QT_END_NAMESPACE 40 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuaapplicationidentity.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 Unified Automation GmbH 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAAPPLICATIONIDENTITY_H 5 | #define QOPCUAAPPLICATIONIDENTITY_H 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | QT_BEGIN_NAMESPACE 14 | 15 | class QOpcUaApplicationIdentityData; 16 | 17 | class Q_OPCUA_EXPORT QOpcUaApplicationIdentity 18 | { 19 | public: 20 | QOpcUaApplicationIdentity(); 21 | ~QOpcUaApplicationIdentity(); 22 | QOpcUaApplicationIdentity(const QOpcUaApplicationIdentity &other); 23 | QOpcUaApplicationIdentity &operator=(const QOpcUaApplicationIdentity &rhs); 24 | 25 | QString applicationUri() const; 26 | void setApplicationUri(const QString &value); 27 | 28 | QString applicationName() const; 29 | void setApplicationName(const QString &value); 30 | 31 | QString productUri() const; 32 | void setProductUri(const QString &value); 33 | 34 | QOpcUaApplicationDescription::ApplicationType applicationType() const; 35 | void setApplicationType(QOpcUaApplicationDescription::ApplicationType value); 36 | 37 | bool isValid() const; 38 | 39 | private: 40 | QSharedDataPointer data; 41 | }; 42 | 43 | QT_END_NAMESPACE 44 | 45 | Q_DECLARE_METATYPE(QOpcUaApplicationIdentity) 46 | 47 | #endif // QOPCUAAPPLICATIONIDENTITY_H 48 | -------------------------------------------------------------------------------- /src/opcua/client/qopcualocalizedtext.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUALOCALIZEDTEXT_H 5 | #define QOPCUALOCALIZEDTEXT_H 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | QT_BEGIN_NAMESPACE 13 | 14 | class QOpcUaLocalizedTextData; 15 | class Q_OPCUA_EXPORT QOpcUaLocalizedText 16 | { 17 | Q_GADGET 18 | Q_PROPERTY(QString locale READ locale WRITE setLocale) 19 | Q_PROPERTY(QString text READ text WRITE setText) 20 | 21 | public: 22 | QOpcUaLocalizedText(); 23 | QOpcUaLocalizedText(const QOpcUaLocalizedText &); 24 | QOpcUaLocalizedText(const QString &locale, const QString &text); 25 | QOpcUaLocalizedText &operator=(const QOpcUaLocalizedText &); 26 | bool operator==(const QOpcUaLocalizedText &rhs) const; 27 | operator QVariant() const; 28 | ~QOpcUaLocalizedText(); 29 | 30 | QString locale() const; 31 | void setLocale(const QString &locale); 32 | 33 | QString text() const; 34 | void setText(const QString &text); 35 | 36 | private: 37 | QSharedDataPointer data; 38 | 39 | #ifndef QT_NO_DEBUG_STREAM 40 | friend Q_OPCUA_EXPORT QDebug operator<<(QDebug debug, const QOpcUaLocalizedText <); 41 | #endif 42 | }; 43 | 44 | QT_END_NAMESPACE 45 | 46 | Q_DECLARE_METATYPE(QOpcUaLocalizedText) 47 | 48 | #endif // QOPCUALOCALIZEDTEXT_H 49 | -------------------------------------------------------------------------------- /src/opcua/x509/qopcuakeypair_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | // 5 | // W A R N I N G 6 | // ------------- 7 | // 8 | // This file is not part of the Qt API. It exists purely as an 9 | // implementation detail. This header file may change from version to 10 | // version without notice, or even be removed. 11 | // 12 | // We mean it. 13 | // 14 | 15 | #ifndef QOPCUAPUBLICKEYPRIVATE_H 16 | #define QOPCUAPUBLICKEYPRIVATE_H 17 | 18 | #include 19 | #include "qopcuakeypair.h" 20 | #include 21 | #include 22 | 23 | QT_BEGIN_NAMESPACE 24 | 25 | Q_DECLARE_LOGGING_CATEGORY(lcSsl) 26 | 27 | class QOpcUaKeyPairPrivate : public QObjectPrivate 28 | { 29 | public: 30 | QOpcUaKeyPairPrivate(); 31 | ~QOpcUaKeyPairPrivate(); 32 | 33 | bool generateRsaKey(QOpcUaKeyPair::RsaKeyStrength strength); 34 | bool loadFromPemData(const QByteArray &data); 35 | QByteArray publicKeyToByteArray() const; 36 | QByteArray privateKeyToByteArray(QOpcUaKeyPair::Cipher cipher, const QString &password) const; 37 | QOpcUaKeyPair::KeyType keyType() const; 38 | bool hasPrivateKey() const; 39 | 40 | protected: 41 | EVP_PKEY *m_keyData = nullptr; 42 | bool m_hasPrivateKey = false; 43 | 44 | private: 45 | Q_DECLARE_PUBLIC(QOpcUaKeyPair) 46 | 47 | friend class QOpcUaX509CertificateSigningRequestPrivate; 48 | }; 49 | QT_END_NAMESPACE 50 | 51 | #endif // QOPCUAPUBLICKEYPRIVATE_H 52 | -------------------------------------------------------------------------------- /src/declarative_opcua/opcualiteraloperand_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef OPCUALITERALOPERAND_P_H 5 | #define OPCUALITERALOPERAND_P_H 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | // 14 | // W A R N I N G 15 | // ------------- 16 | // 17 | // This file is not part of the Qt API. It exists purely as an 18 | // implementation detail. This header file may change from version to 19 | // version without notice, or even be removed. 20 | // 21 | // We mean it. 22 | // 23 | 24 | QT_BEGIN_NAMESPACE 25 | 26 | class OpcUaLiteralOperand : public OpcUaOperandBase { 27 | Q_OBJECT 28 | Q_PROPERTY(QVariant value READ value WRITE setValue) 29 | Q_PROPERTY(QOpcUa::Types type READ type WRITE setType) 30 | QML_NAMED_ELEMENT(LiteralOperand) 31 | QML_ADDED_IN_VERSION(5, 13) 32 | 33 | public: 34 | explicit OpcUaLiteralOperand(QObject *parent = nullptr); 35 | ~OpcUaLiteralOperand(); 36 | QVariant toCppVariant(QOpcUaClient *client) const override; 37 | 38 | QVariant value() const; 39 | void setValue(const QVariant &value); 40 | 41 | QOpcUa::Types type() const; 42 | void setType(QOpcUa::Types type); 43 | 44 | signals: 45 | void dataChanged(); 46 | 47 | private: 48 | QVariant m_value; 49 | QOpcUa::Types m_type; 50 | }; 51 | 52 | QT_END_NAMESPACE 53 | 54 | #endif // OPCUALITERALOPERAND_P_H 55 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuareadresult.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAREADRESULT_H 5 | #define QOPCUAREADRESULT_H 6 | 7 | #include 8 | 9 | #include 10 | 11 | QT_BEGIN_NAMESPACE 12 | 13 | class QOpcUaReadResultData; 14 | class Q_OPCUA_EXPORT QOpcUaReadResult 15 | { 16 | public: 17 | QOpcUaReadResult(); 18 | QOpcUaReadResult(const QOpcUaReadResult &other); 19 | QOpcUaReadResult &operator=(const QOpcUaReadResult &rhs); 20 | ~QOpcUaReadResult(); 21 | 22 | QDateTime serverTimestamp() const; 23 | void setServerTimestamp(const QDateTime &serverTimestamp); 24 | 25 | QDateTime sourceTimestamp() const; 26 | void setSourceTimestamp(const QDateTime &sourceTimestamp); 27 | 28 | QOpcUa::UaStatusCode statusCode() const; 29 | void setStatusCode(QOpcUa::UaStatusCode statusCode); 30 | 31 | QString nodeId() const; 32 | void setNodeId(const QString &nodeId); 33 | 34 | QOpcUa::NodeAttribute attribute() const; 35 | void setAttribute(QOpcUa::NodeAttribute attribute); 36 | 37 | QString indexRange() const; 38 | void setIndexRange(const QString &indexRange); 39 | 40 | QVariant value() const; 41 | void setValue(const QVariant &value); 42 | 43 | private: 44 | QSharedDataPointer data; 45 | }; 46 | 47 | QT_END_NAMESPACE 48 | 49 | Q_DECLARE_METATYPE(QOpcUaReadResult) 50 | 51 | #endif // QOPCUAREADRESULT_H 52 | -------------------------------------------------------------------------------- /src/opcua/x509/qopcuax509extensionextendedkeyusage.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAX509EXTENSIONEXTENDEDKEYUSAGE_H 5 | #define QOPCUAX509EXTENSIONEXTENDEDKEYUSAGE_H 6 | 7 | #include "QtOpcUa/qopcuax509extension.h" 8 | #include 9 | 10 | QT_BEGIN_NAMESPACE 11 | 12 | class Q_OPCUA_EXPORT QOpcUaX509ExtensionExtendedKeyUsage : public QOpcUaX509Extension 13 | { 14 | public: 15 | enum class KeyUsage : uint { 16 | TlsWebServerAuthentication, 17 | TlsWebClientAuthentication, 18 | SignExecutableCode, 19 | EmailProtection, 20 | }; 21 | 22 | QOpcUaX509ExtensionExtendedKeyUsage(); 23 | QOpcUaX509ExtensionExtendedKeyUsage(const QOpcUaX509ExtensionExtendedKeyUsage &); 24 | QOpcUaX509ExtensionExtendedKeyUsage &operator=(const QOpcUaX509ExtensionExtendedKeyUsage &); 25 | bool operator==(const QOpcUaX509ExtensionExtendedKeyUsage &rhs) const; 26 | ~QOpcUaX509ExtensionExtendedKeyUsage(); 27 | 28 | void setKeyUsage(KeyUsage keyUsage, bool enable = true); 29 | bool keyUsage(KeyUsage) const; 30 | }; 31 | 32 | #if QT_VERSION >= 0x060000 33 | inline size_t qHash(const QOpcUaX509ExtensionExtendedKeyUsage::KeyUsage &key) 34 | #else 35 | inline uint qHash(const QOpcUaX509ExtensionExtendedKeyUsage::KeyUsage &key) 36 | #endif 37 | { 38 | return ::qHash(static_cast(key)); 39 | } 40 | 41 | QT_END_NAMESPACE 42 | 43 | #endif // QOPCUAX509EXTENSIONEXTENDEDKEYUSAGE_H 44 | -------------------------------------------------------------------------------- /src/opcua/x509/qopcuax509extensionkeyusage.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAX509EXTENSIONKEYUSAGE_H 5 | #define QOPCUAX509EXTENSIONKEYUSAGE_H 6 | 7 | #include "QtOpcUa/qopcuax509extension.h" 8 | #include 9 | 10 | QT_BEGIN_NAMESPACE 11 | 12 | class Q_OPCUA_EXPORT QOpcUaX509ExtensionKeyUsage : public QOpcUaX509Extension 13 | { 14 | public: 15 | enum class KeyUsage : uint { 16 | DigitalSignature, 17 | NonRepudiation, 18 | KeyEncipherment, 19 | DataEncipherment, 20 | KeyAgreement, 21 | CertificateSigning, 22 | CrlSigning, 23 | EnciptherOnly, 24 | DecipherOnly, 25 | }; 26 | 27 | QOpcUaX509ExtensionKeyUsage(); 28 | QOpcUaX509ExtensionKeyUsage(const QOpcUaX509ExtensionKeyUsage &); 29 | QOpcUaX509ExtensionKeyUsage &operator=(const QOpcUaX509ExtensionKeyUsage &); 30 | bool operator==(const QOpcUaX509ExtensionKeyUsage &rhs) const; 31 | ~QOpcUaX509ExtensionKeyUsage(); 32 | 33 | void setKeyUsage(KeyUsage keyUsage, bool enable = true); 34 | bool keyUsage(KeyUsage) const; 35 | }; 36 | 37 | #if QT_VERSION >= 0x060000 38 | inline size_t qHash(const QOpcUaX509ExtensionKeyUsage::KeyUsage &key) 39 | #else 40 | inline uint qHash(const QOpcUaX509ExtensionKeyUsage::KeyUsage &key) 41 | #endif 42 | { 43 | return ::qHash(static_cast(key)); 44 | } 45 | 46 | QT_END_NAMESPACE 47 | 48 | #endif // QOPCUAX509EXTENSIONKEYUSAGE_H 49 | -------------------------------------------------------------------------------- /examples/opcua/opcuaviewer/opcuamodel.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #ifndef OPCUAMODEL_H 5 | #define OPCUAMODEL_H 6 | 7 | #include 8 | 9 | #include 10 | 11 | class TreeItem; 12 | 13 | QT_BEGIN_NAMESPACE 14 | class QOpcUaClient; 15 | class QOpcUaGenericStructHandler; 16 | QT_END_NAMESPACE 17 | 18 | class OpcUaModel : public QAbstractItemModel 19 | { 20 | Q_OBJECT 21 | public: 22 | explicit OpcUaModel(QObject *parent = nullptr); 23 | ~OpcUaModel(); 24 | 25 | void setOpcUaClient(QOpcUaClient *); 26 | void setGenericStructHandler(QOpcUaGenericStructHandler *handler); 27 | QOpcUaClient* opcUaClient() const; 28 | QOpcUaGenericStructHandler *genericStructHandler() const; 29 | 30 | QVariant data(const QModelIndex &index, int role) const override; 31 | QVariant headerData(int section, Qt::Orientation orientation, int role) const override; 32 | QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; 33 | QModelIndex parent(const QModelIndex &index) const override; 34 | int rowCount(const QModelIndex &parent = QModelIndex()) const override; 35 | int columnCount(const QModelIndex &parent = QModelIndex()) const override; 36 | 37 | private: 38 | QOpcUaClient *mOpcUaClient = nullptr; 39 | QOpcUaGenericStructHandler *mGenericStructHandler = nullptr; 40 | std::unique_ptr mRootItem; 41 | 42 | friend class TreeItem; 43 | }; 44 | 45 | #endif // OPCUAMODEL_H 46 | -------------------------------------------------------------------------------- /src/declarative_opcua/opcuaforeign_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef OPCUAFOREIGN_P_H 5 | #define OPCUAFOREIGN_P_H 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | // 16 | // W A R N I N G 17 | // ------------- 18 | // 19 | // This file is not part of the Qt API. It exists purely as an 20 | // implementation detail. This header file may change from version to 21 | // version without notice, or even be removed. 22 | // 23 | // We mean it. 24 | // 25 | 26 | QT_BEGIN_NAMESPACE 27 | 28 | namespace Constants 29 | { 30 | Q_NAMESPACE 31 | QML_FOREIGN_NAMESPACE(QOpcUa) 32 | QML_NAMESPACE_EXTENDED(QOpcUaUserTokenPolicy) 33 | QML_ELEMENT 34 | QML_ADDED_IN_VERSION(5, 12) 35 | }; 36 | 37 | namespace QOpcUaApplicationDescriptionForeign 38 | { 39 | Q_NAMESPACE 40 | QML_FOREIGN_NAMESPACE(QOpcUaApplicationDescription) 41 | QML_NAMED_ELEMENT(ApplicationDescription) 42 | QML_ADDED_IN_VERSION(5, 13) 43 | }; 44 | 45 | namespace QOpcUaUserTokenPolicyForeign 46 | { 47 | Q_NAMESPACE 48 | QML_FOREIGN_NAMESPACE(QOpcUaUserTokenPolicy) 49 | QML_NAMED_ELEMENT(UserTokenPolicy) 50 | QML_ADDED_IN_VERSION(5, 13) 51 | }; 52 | 53 | QT_END_NAMESPACE 54 | 55 | #endif // OPCUAFOREIGN_P_H 56 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuadeletereferenceitem.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUADELETEREFERENCEITEM_H 5 | #define QOPCUADELETEREFERENCEITEM_H 6 | 7 | #include 8 | 9 | #include 10 | 11 | QT_BEGIN_NAMESPACE 12 | 13 | class QOpcUaExpandedNodeId; 14 | 15 | class QOpcUaDeleteReferenceItemData; 16 | class Q_OPCUA_EXPORT QOpcUaDeleteReferenceItem 17 | { 18 | public: 19 | QOpcUaDeleteReferenceItem(); 20 | QOpcUaDeleteReferenceItem(const QOpcUaDeleteReferenceItem &other); 21 | QOpcUaDeleteReferenceItem &operator=(const QOpcUaDeleteReferenceItem &rhs); 22 | ~QOpcUaDeleteReferenceItem(); 23 | 24 | QString sourceNodeId() const; 25 | void setSourceNodeId(const QString &sourceNodeId); 26 | 27 | QString referenceTypeId() const; 28 | void setReferenceTypeId(const QString &referenceTypeId); 29 | 30 | bool isForwardReference() const; 31 | void setIsForwardReference(bool isForwardReference); 32 | 33 | QOpcUaExpandedNodeId targetNodeId() const; 34 | void setTargetNodeId(const QOpcUaExpandedNodeId &targetNodeId); 35 | 36 | bool deleteBidirectional() const; 37 | void setDeleteBidirectional(bool deleteBidirectional); 38 | 39 | private: 40 | QSharedDataPointer data; 41 | }; 42 | 43 | QT_END_NAMESPACE 44 | 45 | Q_DECLARE_METATYPE(QOpcUaDeleteReferenceItem) 46 | 47 | #endif // QOPCUADELETEREFERENCEITEM_H 48 | -------------------------------------------------------------------------------- /tools/datatypecodegenerator/enumeratedtype.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include "enumeratedtype.h" 5 | #include "enumeratedvalue.h" 6 | #include "visitor.h" 7 | 8 | #include 9 | 10 | EnumeratedType::EnumeratedType(const QString &name, quint32 lengthInBits) 11 | : XmlElement(name) 12 | , m_lengthInBits(lengthInBits) 13 | {} 14 | 15 | EnumeratedType::~EnumeratedType() 16 | { 17 | qDeleteAll(m_values); 18 | } 19 | 20 | quint32 EnumeratedType::lengthInBits() const 21 | { 22 | return m_lengthInBits; 23 | } 24 | 25 | void EnumeratedType::setLengthInBits(quint32 lengthInBits) 26 | { 27 | m_lengthInBits = lengthInBits; 28 | } 29 | 30 | void EnumeratedType::addValue(EnumeratedValue *enumeratedValue) 31 | { 32 | m_values.push_back(enumeratedValue); 33 | } 34 | 35 | void EnumeratedType::print() const 36 | { 37 | XmlElement::print(); 38 | qDebug() << "LengthInBits: " << m_lengthInBits; 39 | for (int i = 0; i < m_values.size(); i++) 40 | m_values.at(i)->print(); 41 | } 42 | 43 | void EnumeratedType::accept(Visitor *visitor) 44 | { 45 | visitor->visit(this); 46 | for (auto &enumeratedValues : m_values) 47 | enumeratedValues->accept(visitor); 48 | } 49 | 50 | QList EnumeratedType::values() const 51 | { 52 | return m_values; 53 | } 54 | 55 | void EnumeratedType::setValues(const QList &values) 56 | { 57 | m_values = values; 58 | } 59 | -------------------------------------------------------------------------------- /examples/opcua/opcuaviewer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | cmake_minimum_required(VERSION 3.16) 5 | project(opcuaviewer LANGUAGES CXX) 6 | 7 | if(NOT DEFINED INSTALL_EXAMPLESDIR) 8 | set(INSTALL_EXAMPLESDIR "examples") 9 | endif() 10 | 11 | set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opcua/opcuaviewer") 12 | 13 | find_package(Qt6 REQUIRED COMPONENTS Core Gui OpcUa Widgets) 14 | 15 | qt_standard_project_setup() 16 | 17 | qt_add_executable(opcuaviewer 18 | certificatedialog.cpp certificatedialog.h certificatedialog.ui 19 | main.cpp 20 | mainwindow.cpp mainwindow.h mainwindow.ui 21 | opcuamodel.cpp opcuamodel.h 22 | treeitem.cpp treeitem.h 23 | ) 24 | 25 | qt_add_resources(opcuaviewer "pki" 26 | PREFIX / 27 | FILES 28 | pki/own/certs/opcuaviewer.der 29 | pki/own/private/opcuaviewer.pem 30 | pki/trusted/certs/3d8ec65c47524d6ad67bed912c19a895.der 31 | pki/trusted/certs/ca.der 32 | pki/trusted/certs/open62541-testserver.der 33 | pki/trusted/crl/ca.crl.pem 34 | ) 35 | 36 | set_target_properties(opcuaviewer PROPERTIES 37 | WIN32_EXECUTABLE TRUE 38 | MACOSX_BUNDLE TRUE 39 | ) 40 | 41 | target_link_libraries(opcuaviewer PRIVATE 42 | Qt6::Core 43 | Qt6::Gui 44 | Qt6::OpcUa 45 | Qt6::Widgets 46 | ) 47 | 48 | install(TARGETS opcuaviewer 49 | RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" 50 | BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" 51 | LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" 52 | ) 53 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuareaditem.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAREADITEM_H 5 | #define QOPCUAREADITEM_H 6 | 7 | #include 8 | #include 9 | 10 | QT_BEGIN_NAMESPACE 11 | 12 | class QOpcUaReadItemData; 13 | class Q_OPCUA_EXPORT QOpcUaReadItem 14 | { 15 | public: 16 | QOpcUaReadItem(); 17 | QOpcUaReadItem(const QOpcUaReadItem &other); 18 | QOpcUaReadItem(const QString &nodeId, QOpcUa::NodeAttribute attr = QOpcUa::NodeAttribute::Value, 19 | const QString &indexRange = QString()); 20 | QOpcUaReadItem &operator=(const QOpcUaReadItem &rhs); 21 | ~QOpcUaReadItem(); 22 | 23 | QString nodeId() const; 24 | void setNodeId(const QString &nodeId); 25 | 26 | QOpcUa::NodeAttribute attribute() const; 27 | void setAttribute(QOpcUa::NodeAttribute attribute); 28 | 29 | QString indexRange() const; 30 | void setIndexRange(const QString &indexRange); 31 | 32 | private: 33 | QSharedDataPointer data; 34 | 35 | friend Q_OPCUA_EXPORT bool operator==(const QOpcUaReadItem &lhs, 36 | const QOpcUaReadItem &rhs) noexcept; 37 | friend inline bool operator!=(const QOpcUaReadItem &lhs, const QOpcUaReadItem &rhs) noexcept 38 | { 39 | return !(lhs == rhs); 40 | } 41 | }; 42 | 43 | QT_END_NAMESPACE 44 | 45 | Q_DECLARE_METATYPE(QOpcUaReadItem) 46 | 47 | #endif // QOPCUAREADITEM_H 48 | -------------------------------------------------------------------------------- /src/opcua/x509/qopcuakeypair.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAKEYPAIR_H 5 | #define QOPCUAKEYPAIR_H 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | QT_BEGIN_NAMESPACE 13 | 14 | class QOpcUaKeyPairPrivate; 15 | 16 | class Q_OPCUA_EXPORT QOpcUaKeyPair : public QObject 17 | { 18 | Q_OBJECT 19 | Q_DECLARE_PRIVATE(QOpcUaKeyPair) 20 | 21 | public: 22 | enum class RsaKeyStrength { 23 | Bits1024 = 1024, 24 | Bits2048 = 2048, 25 | Bits4096 = 4096, 26 | }; 27 | 28 | enum class KeyType { 29 | Rsa, 30 | Empty, 31 | Unknown, 32 | }; 33 | 34 | enum class Cipher { 35 | Aes128Cbc, 36 | Unencrypted, 37 | }; 38 | 39 | QOpcUaKeyPair(QObject *parent = nullptr); 40 | 41 | virtual ~QOpcUaKeyPair(); 42 | bool loadFromPemData(const QByteArray &data); 43 | QByteArray publicKeyToByteArray() const; 44 | QByteArray privateKeyToByteArray(Cipher cipher, const QString &password) const; 45 | KeyType type() const; 46 | bool hasPrivateKey() const; 47 | void generateRsaKey(QOpcUaKeyPair::RsaKeyStrength strength); 48 | 49 | Q_SIGNALS: 50 | void passphraseNeeded(QString &passphrase, int maximumLength, bool writeOperation); 51 | 52 | friend class QOpcUaX509CertificateSigningRequestPrivate; 53 | }; 54 | 55 | QT_END_NAMESPACE 56 | 57 | #endif // QOPCUAKEYPAIR_H 58 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qml/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | cmake_minimum_required(VERSION 3.16) 5 | project(waterpump-qml LANGUAGES CXX) 6 | 7 | if(NOT DEFINED INSTALL_EXAMPLESDIR) 8 | set(INSTALL_EXAMPLESDIR "examples") 9 | endif() 10 | 11 | set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opcua/waterpump/waterpump-qml") 12 | 13 | find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick) 14 | 15 | qt_standard_project_setup() 16 | 17 | qt_add_executable(waterpump-qml 18 | main.cpp 19 | ) 20 | 21 | set_target_properties(waterpump-qml PROPERTIES 22 | WIN32_EXECUTABLE TRUE 23 | MACOSX_BUNDLE TRUE 24 | ) 25 | 26 | target_link_libraries(waterpump-qml PRIVATE 27 | Qt6::Core 28 | Qt6::Gui 29 | Qt6::Quick 30 | ) 31 | 32 | # Resources: 33 | set(qml_resource_files 34 | "MachineDisplay.qml" 35 | "Pump.qml" 36 | "ServerControl.qml" 37 | "Tank1Unit.qml" 38 | "Tank2Unit.qml" 39 | "TankDisplay.qml" 40 | "ValueDisplay.qml" 41 | "machine/Machine.qml" 42 | "machine/Tank.qml" 43 | "main.qml" 44 | ) 45 | 46 | qt6_add_resources(waterpump-qml "qml" 47 | PREFIX 48 | "/" 49 | FILES 50 | ${qml_resource_files} 51 | ) 52 | 53 | install(TARGETS waterpump-qml 54 | RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" 55 | BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" 56 | LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" 57 | ) 58 | 59 | if (WIN32) 60 | target_compile_definitions(waterpump-qml PRIVATE EXAMPLES_CMAKE_SPECIFIC_PATH) 61 | endif() 62 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuabrowserequest.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUABROWSEREQUEST_H 5 | #define QOPCUABROWSEREQUEST_H 6 | 7 | #include 8 | 9 | #include 10 | 11 | QT_BEGIN_NAMESPACE 12 | 13 | class QOpcUaBrowseRequestData; 14 | class Q_OPCUA_EXPORT QOpcUaBrowseRequest 15 | { 16 | public: 17 | 18 | enum class BrowseDirection : quint32 { 19 | Forward = 0, 20 | Inverse = 1, 21 | Both = 2, 22 | }; 23 | 24 | QOpcUaBrowseRequest(); 25 | QOpcUaBrowseRequest(const QOpcUaBrowseRequest &other); 26 | QOpcUaBrowseRequest &operator=(const QOpcUaBrowseRequest &rhs); 27 | ~QOpcUaBrowseRequest(); 28 | 29 | QOpcUaBrowseRequest::BrowseDirection browseDirection() const; 30 | void setBrowseDirection(const QOpcUaBrowseRequest::BrowseDirection &browseDirection); 31 | 32 | QString referenceTypeId() const; 33 | void setReferenceTypeId(const QString &referenceTypeId); 34 | void setReferenceTypeId(QOpcUa::ReferenceTypeId referenceTypeId); 35 | 36 | bool includeSubtypes() const; 37 | void setIncludeSubtypes(bool includeSubtypes); 38 | 39 | QOpcUa::NodeClasses nodeClassMask() const; 40 | void setNodeClassMask(const QOpcUa::NodeClasses &nodeClassMask); 41 | 42 | private: 43 | QSharedDataPointer data; 44 | }; 45 | 46 | QT_END_NAMESPACE 47 | 48 | Q_DECLARE_METATYPE(QOpcUaBrowseRequest) 49 | 50 | #endif // QOPCUABROWSEREQUEST_H 51 | -------------------------------------------------------------------------------- /src/3rdparty/open62541/BSD-3-CLAUSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 1991, 1993 2 | The Regents of the University of California. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 1. Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | 3. Neither the name of the University nor the names of its contributors 13 | may be used to endorse or promote products derived from this software 14 | without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 | SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuaeuinformation.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAEUINFORMATION_H 5 | #define QOPCUAEUINFORMATION_H 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | QT_BEGIN_NAMESPACE 13 | 14 | class QOpcUaLocalizedText; 15 | 16 | class QOpcUaEUInformationData; 17 | class Q_OPCUA_EXPORT QOpcUaEUInformation 18 | { 19 | public: 20 | QOpcUaEUInformation(); 21 | QOpcUaEUInformation(const QOpcUaEUInformation &); 22 | QOpcUaEUInformation(const QString &namespaceUri, qint32 unitId, 23 | const QOpcUaLocalizedText &displayName, const QOpcUaLocalizedText &description); 24 | QOpcUaEUInformation &operator=(const QOpcUaEUInformation &); 25 | bool operator==(const QOpcUaEUInformation &rhs) const; 26 | operator QVariant() const; 27 | ~QOpcUaEUInformation(); 28 | 29 | QString namespaceUri() const; 30 | void setNamespaceUri(const QString &namespaceUri); 31 | 32 | qint32 unitId() const; 33 | void setUnitId(qint32 unitId); 34 | 35 | QOpcUaLocalizedText displayName() const; 36 | void setDisplayName(const QOpcUaLocalizedText &displayName); 37 | 38 | QOpcUaLocalizedText description() const; 39 | void setDescription(const QOpcUaLocalizedText &description); 40 | 41 | private: 42 | QSharedDataPointer data; 43 | }; 44 | 45 | QT_END_NAMESPACE 46 | 47 | Q_DECLARE_METATYPE(QOpcUaEUInformation) 48 | 49 | #endif // QOPCUAEUINFORMATION_H 50 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/waterpump-qmlcpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | cmake_minimum_required(VERSION 3.16) 5 | project(waterpump-qmlcpp LANGUAGES CXX) 6 | 7 | if(NOT DEFINED INSTALL_EXAMPLESDIR) 8 | set(INSTALL_EXAMPLESDIR "examples") 9 | endif() 10 | 11 | set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opcua/waterpump/waterpump-qmlcpp") 12 | 13 | find_package(Qt6 REQUIRED COMPONENTS Core Gui OpcUa Quick) 14 | 15 | qt_standard_project_setup() 16 | 17 | qt_add_executable(waterpump-qmlcpp 18 | main.cpp 19 | opcuamachinebackend.cpp opcuamachinebackend.h 20 | ) 21 | 22 | set_target_properties(waterpump-qmlcpp PROPERTIES 23 | WIN32_EXECUTABLE TRUE 24 | MACOSX_BUNDLE TRUE 25 | ) 26 | 27 | target_link_libraries(waterpump-qmlcpp PRIVATE 28 | Qt6::Core 29 | Qt6::Gui 30 | Qt6::OpcUa 31 | Qt6::Quick 32 | ) 33 | 34 | # Resources: 35 | set(qml_resource_files 36 | "Pump.qml" 37 | "ServerControl.qml" 38 | "Tank.qml" 39 | "Tank1Unit.qml" 40 | "Tank2Unit.qml" 41 | "TankSimulation.qml" 42 | "ValueDisplay.qml" 43 | "main.qml" 44 | ) 45 | 46 | qt6_add_resources(waterpump-qmlcpp "qml" 47 | PREFIX 48 | "/" 49 | FILES 50 | ${qml_resource_files} 51 | ) 52 | 53 | install(TARGETS waterpump-qmlcpp 54 | RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" 55 | BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" 56 | LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" 57 | ) 58 | 59 | if (WIN32) 60 | target_compile_definitions(waterpump-qmlcpp PRIVATE EXAMPLES_CMAKE_SPECIFIC_PATH) 61 | endif() 62 | -------------------------------------------------------------------------------- /examples/opcua/waterpump/simulationserver/simulationserver.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | CONFIG += c++11 console 3 | QT += opcua opcua-private 4 | QT -= gui 5 | 6 | # Installed example package 7 | 8 | MODULE_SOURCES=../../../../../$$QT_VERSION/Src/qtopcua/ 9 | 10 | !exists($$MODULE_SOURCES/src/plugins/opcua/open62541/qopen62541utils.cpp):{ 11 | # Build from source tree 12 | MODULE_SOURCES=$$PWD/../../../../ 13 | } 14 | 15 | !exists($$MODULE_SOURCES/src/plugins/opcua/open62541/qopen62541utils.cpp):{ 16 | # Build from source tree 17 | MODULE_SOURCES=$$QTOPCUA_SOURCE_DIR 18 | } 19 | 20 | !exists($$MODULE_SOURCES/src/plugins/opcua/open62541/qopen62541utils.cpp):{ 21 | error("Unable to build the server, the Qt OPC UA module source is not available. Set QTOPCUA_SOURCE_DIR to the location of the Qt OPC UA sources.") 22 | } 23 | 24 | INCLUDEPATH += $$MODULE_SOURCES/src/plugins/opcua/open62541 25 | DEPENDPATH += INCLUDEPATH 26 | 27 | qtConfig(open62541):!qtConfig(system-open62541) { 28 | include($$MODULE_SOURCES/src/3rdparty/open62541.pri) 29 | } else { 30 | DEFINES += USE_SYSTEM_OPEN62541 31 | QMAKE_LIBS_PRIVATE += -lopen62541 32 | 33 | # The system open62541 library might require OpenSSL 34 | qtConfig(open62541-security): QMAKE_LIBS_PRIVATE += -lcrypto 35 | } 36 | 37 | SOURCES += main.cpp \ 38 | simulationserver.cpp \ 39 | $$MODULE_SOURCES/src/plugins/opcua/open62541/qopen62541utils.cpp \ 40 | $$MODULE_SOURCES/src/plugins/opcua/open62541/qopen62541valueconverter.cpp 41 | 42 | HEADERS += \ 43 | simulationserver.h 44 | 45 | #install 46 | target.path = $$[QT_INSTALL_EXAMPLES]/opcua/waterpump/simulationserver 47 | INSTALLS += target 48 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuaelementoperand.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAELEMENTOPERAND_H 5 | #define QOPCUAELEMENTOPERAND_H 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | QT_BEGIN_NAMESPACE 13 | 14 | // OPC UA 1.05 part 4, 7.7.4.2 15 | class QOpcUaElementOperandData; 16 | class Q_OPCUA_EXPORT QOpcUaElementOperand 17 | { 18 | public: 19 | QOpcUaElementOperand(); 20 | QOpcUaElementOperand(const QOpcUaElementOperand &); 21 | QOpcUaElementOperand(quint32 index); 22 | QOpcUaElementOperand &operator=(const QOpcUaElementOperand &); 23 | operator QVariant() const; 24 | ~QOpcUaElementOperand(); 25 | 26 | quint32 index() const; 27 | void setIndex(quint32 index); 28 | 29 | private: 30 | friend Q_OPCUA_EXPORT bool comparesEqual(const QOpcUaElementOperand &lhs, 31 | const QOpcUaElementOperand &rhs) noexcept; 32 | friend bool operator==(const QOpcUaElementOperand &lhs, 33 | const QOpcUaElementOperand &rhs) noexcept 34 | { return comparesEqual(lhs, rhs); } 35 | friend bool operator!=(const QOpcUaElementOperand &lhs, 36 | const QOpcUaElementOperand &rhs) noexcept 37 | { 38 | return !(lhs == rhs); 39 | } 40 | 41 | QSharedDataPointer data; 42 | }; 43 | 44 | QT_END_NAMESPACE 45 | 46 | Q_DECLARE_METATYPE(QOpcUaElementOperand) 47 | 48 | #endif // QOPCUAELEMENTOPERAND_H 49 | -------------------------------------------------------------------------------- /tools/datatypecodegenerator/structuredtype.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #pragma once 5 | 6 | #include "xmlelement.h" 7 | 8 | #include 9 | 10 | class Field; 11 | 12 | class StructuredType : public XmlElement 13 | { 14 | public: 15 | StructuredType(const QString &name, const QString &baseType); 16 | ~StructuredType(); 17 | 18 | QString baseType() const; 19 | void setBaseType(const QString &baseType); 20 | 21 | void addField(Field *field); 22 | 23 | void print() const override; 24 | void accept(Visitor *visitor) override; 25 | 26 | QList fields() const; 27 | void setFields(const QList &fields); 28 | 29 | bool containsBitMask() const; 30 | void setContainsBitMask(bool containsBitMask); 31 | 32 | bool isBuiltInType() const; 33 | void setIsBuiltInType(bool isBuiltInType); 34 | 35 | bool hasSwitchfield() const; 36 | void setHasSwitchfield(bool hasSwitchfield); 37 | 38 | bool hasUnion() const; 39 | void setHasUnion(bool hasUnion); 40 | 41 | QString targetNamespace() const; 42 | void setTargetNamespace(const QString &targetNamespace); 43 | 44 | bool recursive() const; 45 | void setRecursive(bool recursive); 46 | 47 | private: 48 | bool m_containsBitMask{false}; 49 | bool m_isBuiltInType{false}; 50 | bool m_hasSwitchfield{false}; 51 | bool m_hasUnion{false}; 52 | bool m_recursive{false}; 53 | QString m_baseType; 54 | QString m_targetNamespace; 55 | QList m_fields; 56 | }; 57 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuaauthenticationinformation.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAAUTHENTICATIONINFORMATION_H 5 | #define QOPCUAAUTHENTICATIONINFORMATION_H 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | QT_BEGIN_NAMESPACE 14 | 15 | class QOpcUaAuthenticationInformationData; 16 | class Q_OPCUA_EXPORT QOpcUaAuthenticationInformation 17 | { 18 | Q_GADGET 19 | 20 | public: 21 | QOpcUaAuthenticationInformation(); 22 | QOpcUaAuthenticationInformation(const QOpcUaAuthenticationInformation &); 23 | QOpcUaAuthenticationInformation &operator=(const QOpcUaAuthenticationInformation &); 24 | bool operator==(const QOpcUaAuthenticationInformation &rhs) const; 25 | ~QOpcUaAuthenticationInformation(); 26 | 27 | Q_INVOKABLE void setAnonymousAuthentication(); 28 | Q_INVOKABLE void setUsernameAuthentication(const QString &username, const QString &password); 29 | Q_INVOKABLE void setCertificateAuthentication(); 30 | Q_INVOKABLE void setCertificateAuthentication(const QString &certificatePath, const QString &privateKeyPath); 31 | 32 | const QVariant &authenticationData() const; 33 | Q_INVOKABLE QOpcUaUserTokenPolicy::TokenType authenticationType() const; 34 | 35 | private: 36 | QSharedDataPointer data; 37 | }; 38 | 39 | QT_END_NAMESPACE 40 | 41 | Q_DECLARE_METATYPE(QOpcUaAuthenticationInformation) 42 | 43 | #endif // QOPCUAAUTHETICATIONINFORMATION_H 44 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuaaddreferenceitem.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAADDREFERENCEITEM_H 5 | #define QOPCUAADDREFERENCEITEM_H 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | QT_BEGIN_NAMESPACE 13 | 14 | class QOpcUaExpandedNodeId; 15 | 16 | class QOpcUaAddReferenceItemData; 17 | class Q_OPCUA_EXPORT QOpcUaAddReferenceItem 18 | { 19 | public: 20 | QOpcUaAddReferenceItem(); 21 | QOpcUaAddReferenceItem(const QOpcUaAddReferenceItem &other); 22 | QOpcUaAddReferenceItem &operator=(const QOpcUaAddReferenceItem &rhs); 23 | ~QOpcUaAddReferenceItem(); 24 | 25 | QString sourceNodeId() const; 26 | void setSourceNodeId(const QString &sourceNodeId); 27 | 28 | QString referenceTypeId() const; 29 | void setReferenceTypeId(const QString &referenceTypeId); 30 | 31 | bool isForwardReference() const; 32 | void setIsForwardReference(bool isForwardReference); 33 | 34 | QOpcUaExpandedNodeId targetNodeId() const; 35 | void setTargetNodeId(const QOpcUaExpandedNodeId &targetNodeId); 36 | 37 | QOpcUa::NodeClass targetNodeClass() const; 38 | void setTargetNodeClass(QOpcUa::NodeClass targetNodeClass); 39 | 40 | QString targetServerUri() const; 41 | void setTargetServerUri(const QString &targetServerUri); 42 | 43 | private: 44 | QSharedDataPointer data; 45 | }; 46 | 47 | QT_END_NAMESPACE 48 | 49 | Q_DECLARE_METATYPE(QOpcUaAddReferenceItem) 50 | 51 | #endif // QOPCUAADDREFERENCEITEM_H 52 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuaargument.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAARGUMENT_H 5 | #define QOPCUAARGUMENT_H 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | QT_BEGIN_NAMESPACE 13 | 14 | class QVariant; 15 | 16 | class QOpcUaArgumentData; 17 | class Q_OPCUA_EXPORT QOpcUaArgument 18 | { 19 | public: 20 | QOpcUaArgument(); 21 | QOpcUaArgument(const QOpcUaArgument &rhs); 22 | QOpcUaArgument(const QString &name, const QString &dataTypeId, qint32 valueRank, 23 | const QList &arrayDimensions, const QOpcUaLocalizedText &description); 24 | QOpcUaArgument &operator=(const QOpcUaArgument &); 25 | bool operator==(const QOpcUaArgument &other) const; 26 | operator QVariant() const; 27 | ~QOpcUaArgument(); 28 | 29 | QString name() const; 30 | void setName(const QString &name); 31 | 32 | QString dataTypeId() const; 33 | void setDataTypeId(const QString &dataTypeId); 34 | 35 | qint32 valueRank() const; 36 | void setValueRank(qint32 valueRank); 37 | 38 | QList arrayDimensions() const; 39 | QList &arrayDimensionsRef(); 40 | void setArrayDimensions(const QList &arrayDimensions); 41 | 42 | QOpcUaLocalizedText description() const; 43 | void setDescription(const QOpcUaLocalizedText &description); 44 | 45 | private: 46 | QSharedDataPointer data; 47 | }; 48 | 49 | QT_END_NAMESPACE 50 | 51 | Q_DECLARE_METATYPE(QOpcUaArgument) 52 | 53 | #endif // QOPCUAARGUMENT_H 54 | -------------------------------------------------------------------------------- /src/3rdparty/open62541/REUSE.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[annotations]] 4 | path = ["open62541.c", 5 | "open62541.h"] 6 | precedence = "override" 7 | comment = "In file: license is not in reuse readable format and copyright refers to a list of authors." 8 | SPDX-FileCopyrightText = ["Copyright (C) 2014-2021 Bauer, Maximilian", 9 | "Copyright (C) 2014-2021 Ebrahimi, Reza ", 10 | "Copyright (C) 2014-2021 Graube, Markus ", 11 | "Copyright (C) 2014-2021 Gruener, Sten ", 12 | "Copyright (C) 2014-2021 Iatrou, Chris Paul ", 13 | "Copyright (C) 2014-2021 Jeromin, Holger", 14 | "Copyright (C) 2014-2021 Palm, Florian ", 15 | "Copyright (C) 2014-2021 Pfrommer, Julius ", 16 | "Copyright (C) 2014-2021 Profanter, Stefan ", 17 | "Copyright (C) 2014-2021 Stalder, Thomas ", 18 | "Copyright (C) 2014-2021 Urbas, Leon "] 19 | SPDX-License-Identifier = "MPL-2.0 AND CC0-1.0 AND CC-BY-SA-4.0 AND BSD-3-Clause AND Apache-2.0 AND MIT" 20 | 21 | [[annotations]] 22 | path = ["BSD-3-CLAUSE", "CC-BY-SA-4.0", "LICENSE*", "MIT", "mpl-2.0.815ca599c9df.txt", "AUTHORS"] 23 | precedence = "override" 24 | comment = "License and copyright files" 25 | SPDX-FileCopyrightText = "None" 26 | SPDX-License-Identifier = "CC0-1.0" -------------------------------------------------------------------------------- /tests/auto/declarative/SecurityTest.qml: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only 3 | 4 | import QtQuick 5 | import QtTest 6 | import QtOpcUa as QtOpcUa 7 | 8 | Item { 9 | property string backendName 10 | property int completedTestCases: 0 11 | property int availableTestCases: 0 12 | property bool completed: completedTestCases == availableTestCases 13 | property bool shouldRun: false 14 | 15 | onShouldRunChanged: { 16 | if (shouldRun) 17 | console.log("Running", parent.testName, "with", backendName); 18 | } 19 | 20 | CompletionLoggingTestCase { 21 | name: parent.parent.testName + ": " + backendName + ": Check supported security features" 22 | when: shouldRun || SKIP_TESTS 23 | 24 | QtOpcUa.Connection { 25 | id: connection2 26 | backend: backendName 27 | } 28 | 29 | function test_nodeTest() { 30 | verify(connection2.supportedSecurityPolicies.length > 0); 31 | if (backendName === "open62541") { 32 | if (SERVER_SUPPORTS_SECURITY) 33 | compare(connection2.supportedSecurityPolicies.length, 34 | connection2.supportedSecurityPolicies.includes("http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15") 35 | ? 6 : 4); 36 | else 37 | compare(connection2.supportedSecurityPolicies.length, 1); 38 | compare(connection2.supportedUserTokenTypes.length, 2); 39 | } else { 40 | fail(backendName, "is not support by this test case"); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/opcua/x509/qopcuax509certificatesigningrequest.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAX509CERTIFICATESIGNINGREQUEST_H 5 | #define QOPCUAX509CERTIFICATESIGNINGREQUEST_H 6 | 7 | #include "QtOpcUa/qopcuakeypair.h" 8 | #include "QtOpcUa/qopcuax509extension.h" 9 | #include "QtOpcUa/qopcuax509distinguishedname.h" 10 | #include 11 | #include 12 | 13 | QT_BEGIN_NAMESPACE 14 | 15 | class QOpcUaX509CertificateSigningRequestPrivate; 16 | 17 | class Q_OPCUA_EXPORT QOpcUaX509CertificateSigningRequest 18 | { 19 | Q_DECLARE_PRIVATE(QOpcUaX509CertificateSigningRequest) 20 | 21 | public: 22 | enum class MessageDigest { 23 | SHA256, 24 | }; 25 | enum class Encoding { 26 | PEM, 27 | DER, 28 | }; 29 | 30 | QOpcUaX509CertificateSigningRequest(); 31 | ~QOpcUaX509CertificateSigningRequest(); 32 | 33 | void setMessageDigest(MessageDigest digest); 34 | MessageDigest messageDigest() const; 35 | 36 | void setEncoding(Encoding encoding); 37 | Encoding encoding() const; 38 | 39 | void setSubject(const QOpcUaX509DistinguishedName &subject); 40 | const QOpcUaX509DistinguishedName &subject() const; 41 | 42 | void addExtension(QOpcUaX509Extension *extension); 43 | QByteArray createRequest(const QOpcUaKeyPair &privateKey); 44 | QByteArray createSelfSignedCertificate(const QOpcUaKeyPair &privateKey, int validityInDays = 365); 45 | 46 | private: 47 | QOpcUaX509CertificateSigningRequestPrivate *d_ptr = nullptr; 48 | }; 49 | 50 | QT_END_NAMESPACE 51 | 52 | #endif // QOPCUAX509CERTIFICATESIGNINGREQUEST_H 53 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuausertokenpolicy.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAUSERTOKENPOLICY_H 5 | #define QOPCUAUSERTOKENPOLICY_H 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | QT_BEGIN_NAMESPACE 13 | 14 | class QOpcUaUserTokenPolicyData; 15 | class Q_OPCUA_EXPORT QOpcUaUserTokenPolicy 16 | { 17 | Q_GADGET 18 | public: 19 | QOpcUaUserTokenPolicy(); 20 | QOpcUaUserTokenPolicy(const QOpcUaUserTokenPolicy &); 21 | QOpcUaUserTokenPolicy &operator=(const QOpcUaUserTokenPolicy &); 22 | bool operator==(const QOpcUaUserTokenPolicy &) const; 23 | ~QOpcUaUserTokenPolicy(); 24 | 25 | enum TokenType { 26 | Anonymous = 0, 27 | Username = 1, 28 | Certificate = 2, 29 | IssuedToken = 3, 30 | }; 31 | Q_ENUM(TokenType) 32 | 33 | QString policyId() const; 34 | void setPolicyId(const QString &policyId); 35 | 36 | QOpcUaUserTokenPolicy::TokenType tokenType() const; 37 | void setTokenType(QOpcUaUserTokenPolicy::TokenType tokenType); 38 | 39 | QString issuedTokenType() const; 40 | void setIssuedTokenType(const QString &issuedTokenType); 41 | 42 | QString issuerEndpointUrl() const; 43 | void setIssuerEndpointUrl(const QString &issuerEndpointUrl); 44 | 45 | QString securityPolicy() const; 46 | void setSecurityPolicy(const QString &securityPolicy); 47 | 48 | private: 49 | QSharedDataPointer data; 50 | }; 51 | 52 | QT_END_NAMESPACE 53 | 54 | Q_DECLARE_METATYPE(QOpcUaUserTokenPolicy) 55 | 56 | #endif // QOPCUAUSERTOKENPOLICY_H 57 | -------------------------------------------------------------------------------- /src/declarative_opcua/doc/snippets/basic/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | QGuiApplication app(argc, argv); 13 | 14 | QString serverExePath; 15 | #ifdef Q_OS_WIN 16 | #ifdef QT_DEBUG 17 | serverExePath = app.applicationDirPath().append("/../../../../../../tests/open62541-testserver/debug/open62541-testserver.exe"); 18 | #else 19 | serverExePath = app.applicationDirPath().append("/../../../../../../tests/open62541-testserver/release/open62541-testserver.exe"); 20 | #endif 21 | #elif defined(Q_OS_MACOS) 22 | serverExePath = app.applicationDirPath().append("/../../../../../../../../tests/open62541-testserver/open62541-testserver.app/Contents/MacOS/open62541-testserver"); 23 | #else 24 | serverExePath = app.applicationDirPath().append("/../../../../../tests/open62541-testserver/open62541-testserver"); 25 | #endif 26 | 27 | if (!QFile::exists(serverExePath)) { 28 | qWarning() << "Could not find server executable:" << serverExePath; 29 | return EXIT_FAILURE; 30 | } 31 | 32 | QProcess serverProcess; 33 | 34 | serverProcess.start(serverExePath); 35 | if (!serverProcess.waitForStarted()) { 36 | qWarning() << "Could not start server:" << serverProcess.errorString(); 37 | return EXIT_FAILURE; 38 | } 39 | 40 | QQmlApplicationEngine engine; 41 | engine.load(QUrl(QStringLiteral("qrc:/basic.qml"))); 42 | if (engine.rootObjects().isEmpty()) 43 | return EXIT_FAILURE; 44 | 45 | return app.exec(); 46 | } 47 | -------------------------------------------------------------------------------- /src/opcua/client/qopcualiteraloperand.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUALITERALOPERAND_H 5 | #define QOPCUALITERALOPERAND_H 6 | 7 | #include 8 | 9 | #include 10 | 11 | QT_BEGIN_NAMESPACE 12 | 13 | // OPC UA 1.05 part 4, 7.7.4.3 14 | class QOpcUaLiteralOperandData; 15 | class Q_OPCUA_EXPORT QOpcUaLiteralOperand 16 | { 17 | public: 18 | QOpcUaLiteralOperand(); 19 | QOpcUaLiteralOperand(const QOpcUaLiteralOperand &); 20 | QOpcUaLiteralOperand(const QVariant &value, QOpcUa::Types type = QOpcUa::Types::Undefined); 21 | QOpcUaLiteralOperand &operator=(const QOpcUaLiteralOperand &); 22 | operator QVariant() const; 23 | ~QOpcUaLiteralOperand(); 24 | 25 | QVariant value() const; 26 | void setValue(const QVariant &value); 27 | 28 | QOpcUa::Types type() const; 29 | void setType(QOpcUa::Types type); 30 | 31 | private: 32 | friend Q_OPCUA_EXPORT bool comparesEqual(const QOpcUaLiteralOperand &lhs, 33 | const QOpcUaLiteralOperand &rhs) noexcept; 34 | friend bool operator==(const QOpcUaLiteralOperand &lhs, 35 | const QOpcUaLiteralOperand &rhs) noexcept 36 | { return comparesEqual(lhs, rhs); } 37 | friend bool operator!=(const QOpcUaLiteralOperand &lhs, 38 | const QOpcUaLiteralOperand &rhs) noexcept 39 | { 40 | return !(lhs == rhs); 41 | } 42 | 43 | QSharedDataPointer data; 44 | }; 45 | 46 | QT_END_NAMESPACE 47 | 48 | Q_DECLARE_METATYPE(QOpcUaLiteralOperand) 49 | 50 | #endif // QOPCUALITERALOPERAND_H 51 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuahistoryreadresponse.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAHISTORYREADRESPONSE_H 5 | #define QOPCUAHISTORYREADRESPONSE_H 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include 14 | 15 | QT_BEGIN_NAMESPACE 16 | 17 | class QOpcUaHistoryReadResponseImpl; 18 | 19 | class QOpcUaHistoryReadResponsePrivate; 20 | 21 | class Q_OPCUA_EXPORT QOpcUaHistoryReadResponse : public QObject { 22 | Q_OBJECT 23 | Q_DECLARE_PRIVATE(QOpcUaHistoryReadResponse) 24 | public: 25 | explicit QOpcUaHistoryReadResponse(QOpcUaHistoryReadResponseImpl *impl); 26 | ~QOpcUaHistoryReadResponse(); 27 | 28 | enum class State : quint32 { 29 | Unknown, 30 | Reading, 31 | Finished, 32 | MoreDataAvailable, 33 | Error, 34 | }; 35 | Q_ENUM(State) 36 | 37 | bool hasMoreData() const; 38 | bool readMoreData(); 39 | State state() const; 40 | 41 | bool releaseContinuationPoints(); 42 | 43 | QList data() const; 44 | QList events() const; 45 | QOpcUa::UaStatusCode serviceResult() const; 46 | 47 | Q_SIGNALS: 48 | void readHistoryDataFinished(const QList &results, QOpcUa::UaStatusCode serviceResult); 49 | void readHistoryEventsFinished(const QList &results, QOpcUa::UaStatusCode serviceResult); 50 | void stateChanged(State state); 51 | }; 52 | 53 | QT_END_NAMESPACE 54 | 55 | #endif // QOPCUAHISTORYREADRESPONSE_H 56 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuainternaldatatypenode_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | // 5 | // W A R N I N G 6 | // ------------- 7 | // 8 | // This file is not part of the Qt API. It exists purely as an 9 | // implementation detail. This header file may change from version to 10 | // version without notice, or even be removed. 11 | // 12 | // We mean it. 13 | // 14 | 15 | #ifndef QOPCUAINTERNALDATATYPENODE_H 16 | #define QOPCUAINTERNALDATATYPENODE_H 17 | 18 | #include 19 | 20 | #include 21 | 22 | QT_BEGIN_NAMESPACE 23 | 24 | class QOpcUaInternalDataTypeNode : public QObject { 25 | Q_OBJECT 26 | Q_DISABLE_COPY(QOpcUaInternalDataTypeNode) 27 | public: 28 | QOpcUaInternalDataTypeNode(QOpcUaClient *client); 29 | 30 | bool initialize(const QString &nodeId); 31 | 32 | QVariant definition() const; 33 | 34 | bool isAbstract() const; 35 | 36 | QString name() const; 37 | 38 | QString nodeId() const; 39 | 40 | const std::vector> &children() const; 41 | 42 | Q_SIGNALS: 43 | void initializeFinished(bool success); 44 | 45 | protected: 46 | void handleFinished(bool success); 47 | 48 | private: 49 | 50 | QPointer m_client; 51 | QScopedPointer m_node; 52 | std::vector> m_children; 53 | 54 | QVariant m_definition; 55 | bool m_isAbstract = false; 56 | QString m_name; 57 | QString m_nodeId; 58 | 59 | size_t m_finishedCount = 0; 60 | bool m_hasError = false; 61 | }; 62 | 63 | QT_END_NAMESPACE 64 | 65 | #endif // QOPCUAINTERNALDATATYPENODE_H 66 | -------------------------------------------------------------------------------- /tests/open62541-testserver/pki/own/private/open62541-testserver.der: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEowIBAAKCAQEApUcL4Nv8g35PW0ac+P0brG/D4EXRxL5neuuxFNEgTaxcAqa5 3 | 3FiqqDQI5yaNvzQOOEIT7MAA1Cj4xO0eGLOQnY+p7kFhUam4TxuISsY/ZlemuLW5 4 | JyTI65A7vj91WyVOXHZ4VBqEsZmigRTXFAYC28MP5BymzdS65xheItWa1CQZzh3X 5 | Lpv4URzY/NRrLTJtXMZmFGWLjI97V/bzCzaRjPNWTTUoUyVrd5jfcmF6VdH1U7S0 6 | 9FABfKq91+V+GGhFTiUWvTfFBzNEbyCsTN9T2NCOk6i2b3oJKfWsPMZM71G1ka+o 7 | HZJ/J/qd0zqH+LC8K4bkYF8DpXF8RKVWfI+CHwIDAQABAoIBACRKQ0tuQjXFKDuM 8 | d68cNFVafRHjgrnGbQZKdilx+bvUWqeiYDEHrwEb29CVYI5ZKb4klCdpyUTMckMb 9 | JX6a/uf5wYA1Dt9Vesiz7OsuOIGKQWtRS4RSyWMf2l5dpLEMsfYPdUBSSkyMxWe+ 10 | YbNd1obWf8jAmcecLCXN7e2MJWDq6eQyQhOYkoRHDynHjb4D+HmEJVgUayLBjA4X 11 | cItBxGtmz34CcT79/j/MX48swYtoDQehb9U+uhE5Po5qt7WhUOo3JU9twSsGhL3D 12 | RObCcFxHN5aqpWG/8ZVuhHY/Feybk6b9xTfRJWRFvHv78OichOAhJYmDtdVKTXaD 13 | IEESp6ECgYEA2I+G6knOFPilw4oX5nH1L1gX0xdz1AkpkxB9VVE6sbLfsY23s/mb 14 | 1aRQWyIUEz3xxCb02yY+sPOPH4LGbqIBIDoU6ZY8kbpPAj4/poowcPnVp6owRgNv 15 | WFQIXWjIyAA8pAD8dtD5hB8TJHkJoB9okmwzUTzMdg2upBZEi8NudmkCgYEAw2Ca 16 | BBg95IpI+1E+HD1lnfzFpoSCXVT9QFjGq/I7EhshkzpZkTclFaIixxH+5lxpGOEP 17 | 2ENLbez+clNkDFxgIDZTbneoiW0iB7ElSgna/F6K+Ac2Hd5oom/PUM6XFKXnDwdn 18 | 78SIPINHvaLEZ9I2Kyi2/fBr45KQYNSZPn9v80cCgYBN7lh+t1CR+2irlWZEZ330 19 | K59nN2lXRHTRl32C1lho2hXlrzoMaibKGvdP1FOlGQWHsP0sX/bvdrZqgIUoCuSc 20 | 1EnyRT5GsuT7yareI5yLC1z3mScGCvZmstbPxoV6c5te6XvwxgMEqKoa1fPAy4y2 21 | JHnTIi3xzbqrEdhY81stAQKBgC9eL1kIy5CqGjGcK9PK6uUX0I+jlrusDE5ad6he 22 | bQXhwA0i225CkWIiUg4zhbox82UNw7qp7hKzn6j2IM6CYufMZAPnTNwsslBtGV5O 23 | 72G6RjUGAo/RSUsAkqHDxItEAbX6FK/j1SfeqDkIyldldq6WC2+bp3ygHxLq2FB3 24 | sxunAoGBAICay3zM3BBnhgZmjjn8riO8ZlMOV5V9CG+aeHFoGtGMrJhardn9N3He 25 | zaN6DkcTkpHRhl5OBcHQugXGqk6g78acLIaVmDPiuRxb+44aMpxiT1NacKHWGyAf 26 | CT+UU7yUlQJKltFuuNTzWvuqdM0FPdwGrpRqp0yR/os2x0k+Lt1K 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuaextensionobject.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAEXTENSIONOBJECT_H 5 | #define QOPCUAEXTENSIONOBJECT_H 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | QT_BEGIN_NAMESPACE 13 | 14 | class QOpcUaExtensionObjectData; 15 | class Q_OPCUA_EXPORT QOpcUaExtensionObject 16 | { 17 | public: 18 | enum Encoding { 19 | NoBody = 0, 20 | ByteString = 1, 21 | Xml = 2, 22 | }; 23 | 24 | QOpcUaExtensionObject(); 25 | QOpcUaExtensionObject(const QOpcUaExtensionObject &); 26 | explicit QOpcUaExtensionObject(const QString &typeId, Encoding encoding = Encoding::ByteString); 27 | ~QOpcUaExtensionObject(); 28 | QOpcUaExtensionObject &operator=(const QOpcUaExtensionObject &); 29 | bool operator==(const QOpcUaExtensionObject &rhs) const; 30 | operator QVariant() const; 31 | 32 | QString encodingTypeId() const; 33 | void setEncodingTypeId(const QString &encodingTypeId); 34 | 35 | QByteArray encodedBody() const; 36 | QByteArray &encodedBodyRef(); 37 | void setEncodedBody(const QByteArray &encodedBody); 38 | 39 | void setBinaryEncodedBody(const QByteArray &encodedBody, const QString &typeId); 40 | void setXmlEncodedBody(const QByteArray &encodedBody, const QString &typeId); 41 | 42 | QOpcUaExtensionObject::Encoding encoding() const; 43 | void setEncoding(QOpcUaExtensionObject::Encoding encoding); 44 | 45 | private: 46 | QSharedDataPointer data; 47 | }; 48 | 49 | QT_END_NAMESPACE 50 | 51 | Q_DECLARE_METATYPE(QOpcUaExtensionObject) 52 | 53 | #endif // QOPCUAEXTENSIONOBJECT_H 54 | -------------------------------------------------------------------------------- /examples/opcua/opcuaviewer/pki/own/private/opcuaviewer.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCpmis8IxNXR7FM 3 | OndsBssXpHCCHbFf0ifMZOG/EJ+bUqIwNjqqTEK+hw18TZHpSIbSh8Y1EKLL8AIp 4 | LYqFZ/pkKe68g5LtL5/cS5YdorXBL5Ly0cNNtjJjzi+YsJx6000mNDLXRXiASX+U 5 | CvMAeddWkosogxkNVG/QQoY+rEr5L2uD8yj1b+noftw+72qYzliuj6OJttvgh3Av 6 | t5KCD/XoSFV8V8c1MI9BV3PVBRjzUIPS+4iKKcnjoSXqUVke0vB3LzLDPO6kiqze 7 | Ki9jbEwXZ3HwmCZaB4a0p8FGZ+cpj/9BBsrn2u/RyGetmqLcroUH0sA01UyEJYL6 8 | EiXNRBzzAgMBAAECggEAGjgasffMMCSFrL6nIpykPfnuaLcVajZPb8IywfpcakMq 9 | jqB7jkMu2EyBkbNeOL29FgPmaOKzACsQ8nO3Y+tQorZ20U7X4nIH2SMYSGmUhpKH 10 | uaEi+7sMbDB+XDEFZ9mNpjfQmkYDnHWAUw8kRPERELGj8LXfpBdnF7+JCFxTVNU2 11 | bZA2mWY309U78DCZkH6MLpZoWrLtpLNEB7gdHB+xZWko6pTglkpHKveddpaBvIyT 12 | +F2VGDuWFYnsDyWnRUZvfiTFTOzzi7uLpyY324bP29+cytnswQZYjYBGny53LOeI 13 | 7QVTuGG8Oc4Pkx1M+FwOYyVP/MCZM4m9RN/3LHwwAQKBgQC3pGT4Y8uMAxpVEiLP 14 | Jp1FCyEYOkQq4bX6fIPRk9IPBuvqiUixibw288AkFYUnU1s+ET1fBFWgw8UdOT0i 15 | KV++ojGylI4x+YeeaiEq98bVwRA49Oo9M/Ca+DPWI7ndHZiEW4B9RHYfbsx4Fqrq 16 | 7vg+VL5YhPks0iNgsq/qa/3QAQKBgQDsbZgqlxrAxHRjqcKE2rV2aBNd9vdGcCit 17 | mvEGoCtki/ehERuDGZzP8IkWaRKASPdLHXAmKrVwkNgQf2jtRGtHclAnIkhKKaOM 18 | Hg1p5vLVvlfpy4N4jptijIL5lvWwg4p6t+J8iuKei4gWHlL0kSsVKDQGM9GDNXcX 19 | KHztE5es8wKBgEoob8HCgvLyWdLatQXUARRdjyq6dMagSR1y5MRgHiaFVAVtFNbk 20 | 2QWT3xZzPkcIKUNiMNdK58044UOQ1rgR3yEbXFhSFy3lJzf4gZZZYoj1IrjtZh36 21 | +IGME1q5KJg7GFjynmt3lv/QfW9NMA4ZHFQHYqpaYEkSPskQv2s52tABAoGBAIiW 22 | 0EBax8PyO2OQoaZrTEa53eZ9VWJGTdnuF61CP495JXjSD1jwJR4k0q41ydB/Vw74 23 | VOBX8Da2F32AfjgFPQ0rx460SZs+7xN2ET3LhSNjMhsJzkyJ5s9KaiiTxCFT/V7k 24 | eV6GRmJeLiLJJhfQ/ljcvyGOMk5hRwoEBBhbJ1dtAoGAYdoTCywu9HQbcc3asCaO 25 | M/mcspyqTV2Aw/prM9oUofQrLyumtsgQvCCJg1WG1GzqDMTmdo5qlVN8ICGdWUZs 26 | 5A2SkgR02w1AaTfyqJ8OfZfOUEwf8VGfQZItcBMUcHh18pHXaez6mjekDIbn2BH7 27 | YaGbIVtCIcmQFWEPzK2rBCg= 28 | -----END PRIVATE KEY----- 29 | -------------------------------------------------------------------------------- /src/declarative_opcua/opcuawriteresult_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef OPCUAWRITERESULT_P_H 5 | #define OPCUAWRITERESULT_P_H 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | // 14 | // W A R N I N G 15 | // ------------- 16 | // 17 | // This file is not part of the Qt API. It exists purely as an 18 | // implementation detail. This header file may change from version to 19 | // version without notice, or even be removed. 20 | // 21 | // We mean it. 22 | // 23 | 24 | QT_BEGIN_NAMESPACE 25 | 26 | class QOpcUaWriteResult; 27 | class QOpcUaClient; 28 | class OpcUaWriteResultData; 29 | class OpcUaWriteResult 30 | { 31 | Q_GADGET 32 | Q_PROPERTY(QOpcUa::NodeAttribute attribute READ attribute) 33 | Q_PROPERTY(QString indexRange READ indexRange) 34 | Q_PROPERTY(QString nodeId READ nodeId) 35 | Q_PROPERTY(QString namespaceName READ namespaceName) 36 | Q_PROPERTY(OpcUaStatus status READ status) 37 | 38 | public: 39 | OpcUaWriteResult(); 40 | OpcUaWriteResult(const OpcUaWriteResult &other); 41 | OpcUaWriteResult(const QOpcUaWriteResult &other, const QOpcUaClient *client); 42 | OpcUaWriteResult &operator=(const OpcUaWriteResult &rhs); 43 | ~OpcUaWriteResult(); 44 | 45 | const QString &indexRange() const; 46 | const QString &nodeId() const; 47 | QOpcUa::NodeAttribute attribute() const; 48 | const QString &namespaceName() const; 49 | 50 | OpcUaStatus status() const; 51 | 52 | private: 53 | QSharedDataPointer data; 54 | }; 55 | 56 | 57 | QT_END_NAMESPACE 58 | 59 | Q_DECLARE_METATYPE(OpcUaWriteResult) 60 | 61 | #endif // OPCUAWRITERESULT_P_H 62 | -------------------------------------------------------------------------------- /tests/auto/security/pki/own/private/privateKeyWithoutPassword.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDwfehGxb7k+Z8T 3 | GBkhwVHk4A8qi1w5vG7oXF9QtE5vNcl6JJCbZK7bVIDzDaNb2tk7FidaI5mQsZHz 4 | ptlRhuV8jLGzrvSuxv4bpJDC7MOaOZasbc5g90JU24v7tKEa+k17tcn+Tk8ePRIR 5 | JBuf8TLKEEZIqYHe2pVM8BL0Dmud0cQlkpj3F/RAVWkwh9xJIMuMsiOffI0HzF/2 6 | CSgbVdJKeZgco3MEpfkvLMtYtkCDFyA4XvSKaDB88YjJtGXlMC0XB7wFeWu1y6OZ 7 | RgLlS4Zir5/rKsSwuhzkIBjeHMwP/gxX2Y+rlrCAwjhuJ7hvev230+8VSKaEtY/Z 8 | M1rUgf3RAgMBAAECggEBALEUBHQYJvdy1i65D8hLEIH2eTRaaQ4aMY/mdEh4e0hn 9 | 0nKdedzxxc656jkNUbvQ6SMYrOEyVWC1X0KJGHtvWIrdDfvAV2paG8E+61ib/WsR 10 | /F/6envrlGvnPKuZ1QaIR4VP1evqvVcGoMb+T1j1wPAIC7h1F6uAR27fVxVdiOAq 11 | pzw+gCqF1962aj/Tz7StU51WohtmMTJHouoGOqTFSoKW5Mya6Yf99A7W5I0hKCZr 12 | ddyKhX6TkbosGS5CP6lMK6P9KfZzzxP8v7g2OJ6Mfpb7U+nKggHvUtUz5UzuzSY5 13 | Iorf8fjLQtMRWGbDzLrtll/jPv1Hdh2YwdBOx2mAOAECgYEA/qv3oPuGn2Bt8qg0 14 | e8gyT+U4b8ssWIjcPBWgdsJo79RdF1xrHY3T0cC6EbMCO8ZDgwv+aMl9FBfJWRYM 15 | ObXITh5R5xMIBFpZHkBIEMNxfnQaH7RBNuYwiCSzmSptzNk+6z2TkZFFW6JfILTe 16 | rAiea0DeCKJakp2/N2UincUOc40CgYEA8b8B3PFZoxxDbRPhNwlvdSWNvLslBNU2 17 | /OhW19MnXwY7MMZVPt7YSVDaAcZEX1mU/eUTSzIvm6Sow0EXocS7nzmuoLnsnv9f 18 | vhtAkp3AEpvF0zNbD8MlT8z4El8JK+tW2XEtkE5HgjQt5YQrk4nc0eJIlHOTJw7y 19 | cbMg6OZUIFUCgYBxQlV8mKAEXURIeJnuutf1REHXJgpwzVz0s8GLT2aP0mgcLZPN 20 | rveW/xlBKdVCdCguLbVVMNaZiwKWxgFl4PxWEZHnLEWSegPMOlZSbjkZPdUoaGfg 21 | XHsU8Q2WfpIaWjtrLxVj1bF80TdxOj8VTzf1BwI34MxbDCCwKCA+/hYxOQKBgGId 22 | mvz4e+AGrZsM0YCL9M/AASnTbu/qNZoqFm0cR0N6/PUL2jddLL188i58MO3eJulx 23 | WwZPBSGPj+tHdPb0KQ4z1Btpuo7BqTM4TlnzaqxiysSweEoKcw9Tam/SYJ+Rsbsp 24 | A0wpaT6APQyFO0ZzUstgowKVcekNWPsqr7W3HffNAoGAJXZlTvCq/m1Zc176a0cN 25 | NayUjgWTeXIk+8RqB3/UeA5DLD5XfOUJPL/XvIZ2n5mlUrbMuHuvsXo0TnQm7sT2 26 | dt3jl0yo2JLtKXKuR5Q9KC7ehOUozIc9vsi0YzSL1zRHL35ZNx4wx/QNCfMuwUIT 27 | 5EL80FokYrFEWZ5qRuyAT6M= 28 | -----END PRIVATE KEY----- 29 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuamultidimensionalarray.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAMULTIDIMENSIONALARRAY_H 5 | #define QOPCUAMULTIDIMENSIONALARRAY_H 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | QT_BEGIN_NAMESPACE 14 | 15 | class QOpcUaMultiDimensionalArrayData; 16 | class Q_OPCUA_EXPORT QOpcUaMultiDimensionalArray 17 | { 18 | public: 19 | QOpcUaMultiDimensionalArray(); 20 | QOpcUaMultiDimensionalArray(const QOpcUaMultiDimensionalArray &other); 21 | QOpcUaMultiDimensionalArray &operator=(const QOpcUaMultiDimensionalArray &rhs); 22 | QOpcUaMultiDimensionalArray(const QVariantList &valueArray, const QList &arrayDimensions); 23 | QOpcUaMultiDimensionalArray(const QList &arrayDimensions); 24 | ~QOpcUaMultiDimensionalArray(); 25 | 26 | QVariantList valueArray() const; 27 | QVariantList &valueArrayRef(); 28 | void setValueArray(const QVariantList &valueArray); 29 | 30 | int arrayIndex(const QList &indices) const; 31 | QVariant value(const QList &indices) const; 32 | bool setValue(const QList &indices, const QVariant &value); 33 | 34 | bool isValid() const; 35 | 36 | QList arrayDimensions() const; 37 | void setArrayDimensions(const QList &arrayDimensions); 38 | 39 | bool operator==(const QOpcUaMultiDimensionalArray &other) const; 40 | 41 | operator QVariant() const; 42 | 43 | private: 44 | QSharedDataPointer data; 45 | }; 46 | 47 | QT_END_NAMESPACE 48 | 49 | Q_DECLARE_METATYPE(QOpcUaMultiDimensionalArray) 50 | 51 | #endif // QOPCUAMULTIDIMENSIONALARRAY_H 52 | -------------------------------------------------------------------------------- /src/declarative_opcua/opcuaattributecache.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #include 5 | #include 6 | 7 | QT_BEGIN_NAMESPACE 8 | 9 | /*! 10 | \class OpcUaAttributeCache 11 | \inqmlmodule QtOpcUa 12 | \brief Flexible attribute value cache providing signals. 13 | \deprecated [6.9] 14 | \internal 15 | 16 | This class is just for internal use in the declarative backend and not exposed to users. 17 | 18 | It caches node attribute values and provides access. Main purpose is to 19 | let \l OpcUaAttributeValue provide separate value change signals for each attribute. 20 | 21 | \sa OpcUaAttributeValue 22 | */ 23 | 24 | OpcUaAttributeCache::OpcUaAttributeCache(QObject *parent) : QObject(parent) 25 | { 26 | } 27 | 28 | void OpcUaAttributeCache::setAttributeValue(QOpcUa::NodeAttribute attr, const QVariant &value) 29 | { 30 | attribute(attr)->setValue(value); 31 | } 32 | 33 | void OpcUaAttributeCache::invalidate() 34 | { 35 | // Reset all values in the cache to invalid. 36 | // Do not clear() the cache because there are still objects with 37 | // connections waiting for notifications 38 | for (auto i = m_attributeCache.constBegin(); i != m_attributeCache.constEnd(); ++i) 39 | i.value()->invalidate(); 40 | } 41 | 42 | OpcUaAttributeValue *OpcUaAttributeCache::attribute(QOpcUa::NodeAttribute attr) 43 | { 44 | if (!m_attributeCache.contains(attr)) 45 | m_attributeCache.insert(attr, new OpcUaAttributeValue(this)); 46 | return m_attributeCache.value(attr); 47 | } 48 | 49 | const QVariant &OpcUaAttributeCache::attributeValue(QOpcUa::NodeAttribute attr) 50 | { 51 | return attribute(attr)->value(); 52 | } 53 | 54 | QT_END_NAMESPACE 55 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuaaddnodeitem.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUADDNODEITEM_H 5 | #define QOPCUADDNODEITEM_H 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | QT_BEGIN_NAMESPACE 13 | 14 | class QOpcUaAddNodeItemData; 15 | class Q_OPCUA_EXPORT QOpcUaAddNodeItem 16 | { 17 | public: 18 | QOpcUaAddNodeItem(); 19 | QOpcUaAddNodeItem(const QOpcUaAddNodeItem &); 20 | QOpcUaAddNodeItem &operator=(const QOpcUaAddNodeItem &); 21 | ~QOpcUaAddNodeItem(); 22 | 23 | QOpcUaExpandedNodeId parentNodeId() const; 24 | void setParentNodeId(const QOpcUaExpandedNodeId &parentNodeId); 25 | 26 | QString referenceTypeId() const; 27 | void setReferenceTypeId(const QString &referenceTypeId); 28 | 29 | QOpcUaExpandedNodeId requestedNewNodeId() const; 30 | void setRequestedNewNodeId(const QOpcUaExpandedNodeId &requestedNewNodeId); 31 | 32 | QOpcUaQualifiedName browseName() const; 33 | void setBrowseName(const QOpcUaQualifiedName &browseName); 34 | 35 | QOpcUa::NodeClass nodeClass() const; 36 | void setNodeClass(const QOpcUa::NodeClass &nodeClass); 37 | 38 | QOpcUaNodeCreationAttributes nodeAttributes() const; 39 | QOpcUaNodeCreationAttributes &nodeAttributesRef(); 40 | void setNodeAttributes(const QOpcUaNodeCreationAttributes &nodeAttributes); 41 | 42 | QOpcUaExpandedNodeId typeDefinition() const; 43 | void setTypeDefinition(const QOpcUaExpandedNodeId &typeDefinition); 44 | 45 | private: 46 | QSharedDataPointer data; 47 | }; 48 | 49 | QT_END_NAMESPACE 50 | 51 | Q_DECLARE_METATYPE(QOpcUaAddNodeItem) 52 | 53 | #endif // QOPCUADDNODEITEM_H 54 | -------------------------------------------------------------------------------- /src/opcua/client/qopcuapkiconfiguration.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 Unified Automation GmbH 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | #ifndef QOPCUAPKICONFIGURATION_H 5 | #define QOPCUAPKICONFIGURATION_H 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | QT_BEGIN_NAMESPACE 15 | 16 | class QOpcUaPkiConfigurationData; 17 | class QOpcUaApplicationIdentity; 18 | 19 | class Q_OPCUA_EXPORT QOpcUaPkiConfiguration 20 | { 21 | public: 22 | QOpcUaPkiConfiguration(); 23 | ~QOpcUaPkiConfiguration(); 24 | QOpcUaPkiConfiguration(const QOpcUaPkiConfiguration &other); 25 | QOpcUaPkiConfiguration &operator=(const QOpcUaPkiConfiguration &rhs); 26 | 27 | QString clientCertificateFile() const; 28 | void setClientCertificateFile(const QString &value); 29 | 30 | QString privateKeyFile() const; 31 | void setPrivateKeyFile(const QString &value); 32 | 33 | QString trustListDirectory() const; 34 | void setTrustListDirectory(const QString &value); 35 | 36 | QString revocationListDirectory() const; 37 | void setRevocationListDirectory(const QString &value); 38 | 39 | QString issuerListDirectory() const; 40 | void setIssuerListDirectory(const QString &value); 41 | 42 | QString issuerRevocationListDirectory() const; 43 | void setIssuerRevocationListDirectory(const QString &value); 44 | 45 | QOpcUaApplicationIdentity applicationIdentity() const; 46 | 47 | bool isPkiValid() const; // Bad name, open for better ideas 48 | bool isKeyAndCertificateFileSet() const; 49 | 50 | private: 51 | QSharedDataPointer data; 52 | }; 53 | 54 | QT_END_NAMESPACE 55 | 56 | Q_DECLARE_METATYPE(QOpcUaPkiConfiguration) 57 | 58 | #endif // QOPCUAPKICONFIGURATION_H 59 | --------------------------------------------------------------------------------