summaryrefslogtreecommitdiffstats
path: root/src/BobinkAuth.h
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-02-18 00:18:33 +0100
committerThomas Vanbesien <tvanbesi@proton.me>2026-02-18 00:18:33 +0100
commit1a79ab468d8cc23cfdf28ddfa85d3e03ffddf44c (patch)
treee19d73f0aa00958dc65d19cb2dfc607f2469089b /src/BobinkAuth.h
parent343169dff6b062074fd3c4a5e240b449ffc4a449 (diff)
downloadBobinkQtOpcUa-1a79ab468d8cc23cfdf28ddfa85d3e03ffddf44c.tar.gz
BobinkQtOpcUa-1a79ab468d8cc23cfdf28ddfa85d3e03ffddf44c.zip
Refactor and document: fix cert filenames, add Doxygen, improve demo
Refactoring (issues 1,3,4,5,7,8,9,10 from review): - Replace hardcoded cert filenames with certFile/keyFile properties - Add 30s timeout to certificate trust QEventLoop - Cache servers() QVariantList instead of rebuilding per call - Validate URLs before passing to QtOpcUa - Use ComboBox valueRole for robust enum mapping - Add certificate trust dialog to demo - Remove unnecessary RowLayout wrapper - Remove debug output from BuildDeps.cmake Documentation: - Add Doxygen file blocks to all C++ files - Document AuthMode enum, toAuthenticationInformation(), key Q_INVOKABLE methods, certificateTrustRequested signal contract - Convert section banners to standard format - Add file/target comments to CMake and QML files
Diffstat (limited to 'src/BobinkAuth.h')
-rw-r--r--src/BobinkAuth.h65
1 files changed, 40 insertions, 25 deletions
diff --git a/src/BobinkAuth.h b/src/BobinkAuth.h
index 2e3ea6a..2bd3c05 100644
--- a/src/BobinkAuth.h
+++ b/src/BobinkAuth.h
@@ -1,3 +1,7 @@
+/**
+ * @file BobinkAuth.h
+ * @brief QML component for OPC UA authentication configuration.
+ */
#ifndef BOBINKAUTH_H
#define BOBINKAUTH_H
@@ -5,49 +9,60 @@
#include <QOpcUaAuthenticationInformation>
#include <QQmlEngine>
-class BobinkAuth : public QObject {
+class BobinkAuth : public QObject
+{
Q_OBJECT
QML_ELEMENT
- Q_PROPERTY(AuthMode mode READ mode WRITE setMode NOTIFY modeChanged)
- Q_PROPERTY(
+ Q_PROPERTY (AuthMode mode READ mode WRITE setMode NOTIFY modeChanged)
+ Q_PROPERTY (
QString username READ username WRITE setUsername NOTIFY usernameChanged)
- Q_PROPERTY(
+ Q_PROPERTY (
QString password READ password WRITE setPassword NOTIFY passwordChanged)
- Q_PROPERTY(
+ Q_PROPERTY (
QString certPath READ certPath WRITE setCertPath NOTIFY certPathChanged)
- Q_PROPERTY(
+ Q_PROPERTY (
QString keyPath READ keyPath WRITE setKeyPath NOTIFY keyPathChanged)
public:
- enum AuthMode { Anonymous, UserPass, Certificate };
- Q_ENUM(AuthMode)
+ /// Authentication modes supported by OPC UA.
+ enum AuthMode
+ {
+ Anonymous,
+ UserPass,
+ Certificate
+ };
+ Q_ENUM (AuthMode)
- explicit BobinkAuth(QObject *parent = nullptr);
+ explicit BobinkAuth (QObject *parent = nullptr);
- AuthMode mode() const;
- void setMode(AuthMode mode);
+ AuthMode mode () const;
+ void setMode (AuthMode mode);
- QString username() const;
- void setUsername(const QString &username);
+ QString username () const;
+ void setUsername (const QString &username);
- QString password() const;
- void setPassword(const QString &password);
+ QString password () const;
+ void setPassword (const QString &password);
- QString certPath() const;
- void setCertPath(const QString &path);
+ QString certPath () const;
+ void setCertPath (const QString &path);
- QString keyPath() const;
- void setKeyPath(const QString &path);
+ QString keyPath () const;
+ void setKeyPath (const QString &path);
- QOpcUaAuthenticationInformation toAuthenticationInformation() const;
+ /**
+ * @brief Build a QOpcUaAuthenticationInformation from the
+ * current mode and credentials.
+ */
+ QOpcUaAuthenticationInformation toAuthenticationInformation () const;
signals:
- void modeChanged();
- void usernameChanged();
- void passwordChanged();
- void certPathChanged();
- void keyPathChanged();
+ void modeChanged ();
+ void usernameChanged ();
+ void passwordChanged ();
+ void certPathChanged ();
+ void keyPathChanged ();
private:
AuthMode m_mode = Anonymous;