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 QOPCUAGDSCLIENT_H
5#define QOPCUAGDSCLIENT_H
6
7#include <QtCore/QObject>
8#include <QtOpcUa/qopcuaglobal.h>
9
10QT_BEGIN_NAMESPACE
11
12class QOpcUaApplicationIdentity;
13class QOpcUaAuthenticationInformation;
14class QOpcUaEndpointDescription;
15class QOpcUaPkiConfiguration;
16class QOpcUaGdsClientPrivate;
17class QOpcUaApplicationRecordDataType;
18class QOpcUaX509DistinguishedName;
19
20class Q_OPCUA_EXPORT QOpcUaGdsClient : public QObject
21{
22 Q_OBJECT
23 Q_DECLARE_PRIVATE(QOpcUaGdsClient)
24
25public:
26 enum class Error {
27 NoError,
28 InvalidBackend,
29 InvalidEndpoint,
30 ConnectionError,
31 DirectoryNodeNotFound,
32 FailedToRegisterApplication,
33 FailedToUnregisterApplication,
34 FailedToGetCertificateStatus,
35 FailedToGetCertificate,
36 };
37 Q_ENUM(Error)
38
39 enum class State {
40 Idle,
41 BackendInstantiated,
42 Connecting,
43 Connected,
44 RegisteringApplication,
45 ApplicationRegistered,
46 //
47 Error,
48 };
49 Q_ENUM(State)
50
51 QOpcUaGdsClient(QObject *parent = nullptr);
52 virtual ~QOpcUaGdsClient();
53
54 void setBackend(const QString &backend);
55 const QString &backend() const;
56
57 void setEndpoint(const QOpcUaEndpointDescription &endpoint);
58 const QOpcUaEndpointDescription &endpoint() const;
59
60 void setPkiConfiguration(const QOpcUaPkiConfiguration &pkiConfig);
61 const QOpcUaPkiConfiguration &pkiConfiguration() const;
62
63 void setApplicationIdentity(const QOpcUaApplicationIdentity &appIdentity);
64 const QOpcUaApplicationIdentity &applicationIdentity() const;
65
66 void setApplicationRecord(const QOpcUaApplicationRecordDataType &appRecord);
67 const QOpcUaApplicationRecordDataType &applicationRecord() const;
68
69 QString applicationId() const;
70
71 void setCertificateSigningRequestPresets(const QOpcUaX509DistinguishedName &dn, const QString &dns);
72 const QOpcUaX509DistinguishedName &distinguishedNameCertificateSigningRequestPreset() const;
73 const QString &dnsCertificateSigningRequestPreset() const;
74
75 void setCertificateCheckInterval(int interval);
76 int certificateCheckInterval() const;
77
78 void setTrustListUpdateInterval(int interval);
79 int trustListUpdateInterval() const;
80
81 Error error() const;
82 State state() const;
83
84 void start();
85 void unregisterApplication();
86
87Q_SIGNALS:
88 void stateChanged(State state);
89 void errorChanged(Error error);
90 void applicationRegistered();
91 void certificateGroupsReceived(QStringList certificateGroups);
92 void certificateUpdateRequired();
93 void certificateUpdated();
94 void unregistered();
95 void trustListUpdated();
96 void authenticationRequired(QOpcUaAuthenticationInformation &authInfo);
97
98private:
99 Q_PRIVATE_SLOT(d_func(), void _q_handleDirectoryNodeMethodCallFinished(QString, QVariant, QOpcUa::UaStatusCode))
100 Q_PRIVATE_SLOT(d_func(), void _q_handleResolveBrowsePathFinished(QList<QOpcUaBrowsePathTarget>, QList<QOpcUaRelativePathElement>, QOpcUa::UaStatusCode))
101 Q_PRIVATE_SLOT(d_func(), void _q_certificateCheckTimeout())
102 Q_PRIVATE_SLOT(d_func(), void _q_updateTrustList())
103};
104
105QT_END_NAMESPACE
106
107#endif // QOPCUAGDSCLIENT_H
108
109

source code of qtopcua/src/opcua/client/qopcuagdsclient.h