diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-02-20 10:41:09 +0100 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-02-20 10:41:09 +0100 |
| commit | 0012cb312e92c33f5263478d318eb82da22ee879 (patch) | |
| tree | caac374dd3716b42d13cb85b85a7f90c7d5aac45 /src/OpcUaAuth.h | |
| parent | 11b99fda8727f2225961c0b83ecdb18674a9670a (diff) | |
| download | BobinkQtOpcUa-0012cb312e92c33f5263478d318eb82da22ee879.tar.gz BobinkQtOpcUa-0012cb312e92c33f5263478d318eb82da22ee879.zip | |
Rename classes to OpcUa* prefix, replace BobinkNode with OpcUaMonitoredNode boilerplate
Rename BobinkAuth → OpcUaAuth, BobinkClient → OpcUaClient (C++ class
names only; QML module URI and singleton name stay as Bobink).
Remove BobinkNode (QQuickItem-based) and add OpcUaMonitoredNode
skeleton using QObject + QQmlParserStatus, following Qt convention
for non-visual QML types.
Diffstat (limited to 'src/OpcUaAuth.h')
| -rw-r--r-- | src/OpcUaAuth.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/src/OpcUaAuth.h b/src/OpcUaAuth.h new file mode 100644 index 0000000..8d53c1d --- /dev/null +++ b/src/OpcUaAuth.h @@ -0,0 +1,75 @@ +/** + * @file OpcUaAuth.h + * @brief QML component for OPC UA authentication configuration. + */ +#ifndef OPCUAAUTH_H +#define OPCUAAUTH_H + +#include <QObject> +#include <QOpcUaAuthenticationInformation> +#include <QQmlEngine> + +class OpcUaAuth : public QObject +{ + Q_OBJECT + QML_ELEMENT + + Q_PROPERTY (AuthMode mode READ mode WRITE setMode NOTIFY modeChanged) + Q_PROPERTY ( + QString username READ username WRITE setUsername NOTIFY usernameChanged) + Q_PROPERTY ( + QString password READ password WRITE setPassword NOTIFY passwordChanged) + Q_PROPERTY ( + QString certPath READ certPath WRITE setCertPath NOTIFY certPathChanged) + Q_PROPERTY ( + QString keyPath READ keyPath WRITE setKeyPath NOTIFY keyPathChanged) + +public: + /// Authentication modes supported by OPC UA. + enum AuthMode + { + Anonymous, + UserPass, + Certificate + }; + Q_ENUM (AuthMode) + + explicit OpcUaAuth (QObject *parent = nullptr); + + AuthMode mode () const; + void setMode (AuthMode mode); + + QString username () const; + void setUsername (const QString &username); + + QString password () const; + void setPassword (const QString &password); + + QString certPath () const; + void setCertPath (const QString &path); + + QString keyPath () const; + void setKeyPath (const QString &path); + + /** + * @brief Build a QOpcUaAuthenticationInformation from the + * current mode and credentials. + */ + QOpcUaAuthenticationInformation toAuthenticationInformation () const; + +signals: + void modeChanged (); + void usernameChanged (); + void passwordChanged (); + void certPathChanged (); + void keyPathChanged (); + +private: + AuthMode m_mode = Anonymous; + QString m_username; + QString m_password; + QString m_certPath; + QString m_keyPath; +}; + +#endif // OPCUAAUTH_H |
