diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-02-17 23:58:08 +0100 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-02-17 23:58:08 +0100 |
| commit | 343169dff6b062074fd3c4a5e240b449ffc4a449 (patch) | |
| tree | a2ef1edc8dd1b1c1dbac757192fa681d8ec76717 /src/BobinkAuth.cpp | |
| download | BobinkQtOpcUa-343169dff6b062074fd3c4a5e240b449ffc4a449.tar.gz BobinkQtOpcUa-343169dff6b062074fd3c4a5e240b449ffc4a449.zip | |
Initial Bobink library: BobinkAuth, BobinkClient, and demo app
Implements the core OPC UA wrapper library with:
- Build system with automatic dep building (open62541, QtOpcUa)
- BobinkAuth: QML auth component (anonymous/userpass/certificate)
- BobinkClient: QML singleton managing connection, LDS discovery,
PKI configuration, endpoint selection, and certificate trust flow
- Demo app for manual testing of the full connection flow
Diffstat (limited to 'src/BobinkAuth.cpp')
| -rw-r--r-- | src/BobinkAuth.cpp | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/BobinkAuth.cpp b/src/BobinkAuth.cpp new file mode 100644 index 0000000..fed1da2 --- /dev/null +++ b/src/BobinkAuth.cpp @@ -0,0 +1,73 @@ +#include "BobinkAuth.h" + +BobinkAuth::BobinkAuth(QObject *parent) + : QObject(parent) +{ +} + +BobinkAuth::AuthMode BobinkAuth::mode() const { return m_mode; } + +void BobinkAuth::setMode(AuthMode mode) +{ + if (m_mode == mode) + return; + m_mode = mode; + emit modeChanged(); +} + +QString BobinkAuth::username() const { return m_username; } + +void BobinkAuth::setUsername(const QString &username) +{ + if (m_username == username) + return; + m_username = username; + emit usernameChanged(); +} + +QString BobinkAuth::password() const { return m_password; } + +void BobinkAuth::setPassword(const QString &password) +{ + if (m_password == password) + return; + m_password = password; + emit passwordChanged(); +} + +QString BobinkAuth::certPath() const { return m_certPath; } + +void BobinkAuth::setCertPath(const QString &path) +{ + if (m_certPath == path) + return; + m_certPath = path; + emit certPathChanged(); +} + +QString BobinkAuth::keyPath() const { return m_keyPath; } + +void BobinkAuth::setKeyPath(const QString &path) +{ + if (m_keyPath == path) + return; + m_keyPath = path; + emit keyPathChanged(); +} + +QOpcUaAuthenticationInformation BobinkAuth::toAuthenticationInformation() const +{ + QOpcUaAuthenticationInformation info; + switch (m_mode) { + case Anonymous: + info.setAnonymousAuthentication(); + break; + case UserPass: + info.setUsernameAuthentication(m_username, m_password); + break; + case Certificate: + info.setCertificateAuthentication(m_certPath, m_keyPath); + break; + } + return info; +} |
