summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew O'Doherty <andrew.odoherty@qt.io>2018-09-11 14:49:59 +0200
committerKarsten Heimrich <karsten.heimrich@qt.io>2018-09-13 08:19:56 +0000
commit071ac7c6b3b20f738c3c8d016f30cc50bd6cae71 (patch)
treecca168ac22546e4d13b086a00015c3a88e38cbaf
parent9b3df740acb61e68ce1cb061153b2684858cd3c4 (diff)
Add d-pointers to new builder classes
Change-Id: I303795f8b1cf627986588541db129ce2bfb787ca Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
-rw-r--r--src/knx/netip/qknxnetiproutingsystembroadcast.cpp44
-rw-r--r--src/knx/netip/qknxnetiproutingsystembroadcast.h9
-rw-r--r--src/knx/netip/qknxnetipsecuredservicefamiliesdib.cpp48
-rw-r--r--src/knx/netip/qknxnetipsecuredservicefamiliesdib.h9
-rw-r--r--src/knx/netip/qknxnetipsessionauthenticate.cpp49
-rw-r--r--src/knx/netip/qknxnetipsessionauthenticate.h10
-rw-r--r--src/knx/netip/qknxnetipsessionrequest.cpp47
-rw-r--r--src/knx/netip/qknxnetipsessionrequest.h10
-rw-r--r--src/knx/netip/qknxnetipsessionresponse.cpp53
-rw-r--r--src/knx/netip/qknxnetipsessionresponse.h11
-rw-r--r--src/knx/netip/qknxnetipsessionstatus.cpp44
-rw-r--r--src/knx/netip/qknxnetipsessionstatus.h9
-rw-r--r--src/knx/netip/qknxnetiptimernotify.cpp56
-rw-r--r--src/knx/netip/qknxnetiptimernotify.h12
14 files changed, 364 insertions, 47 deletions
diff --git a/src/knx/netip/qknxnetiproutingsystembroadcast.cpp b/src/knx/netip/qknxnetiproutingsystembroadcast.cpp
index 2bbf250..6b3f7fe 100644
--- a/src/knx/netip/qknxnetiproutingsystembroadcast.cpp
+++ b/src/knx/netip/qknxnetiproutingsystembroadcast.cpp
@@ -85,6 +85,15 @@ QT_BEGIN_NAMESPACE
\internal
*/
+class QKnxNetIpRoutingSystemBroadcastBuilderPrivate : public QSharedData
+{
+public:
+ QKnxNetIpRoutingSystemBroadcastBuilderPrivate() = default;
+ ~QKnxNetIpRoutingSystemBroadcastBuilderPrivate() = default;
+
+ QKnxLinkLayerFrame m_llf;
+};
+
namespace QKnxPrivate
{
static bool isCemiValid(const QKnxLinkLayerFrame &linkFrame)
@@ -161,6 +170,18 @@ QKnxNetIpRoutingSystemBroadcastProxy::Builder QKnxNetIpRoutingSystemBroadcastPro
*/
/*!
+ Creates a new empty system broadcast frame builder object.
+*/
+QKnxNetIpRoutingSystemBroadcastProxy::Builder::Builder()
+ : d_ptr(new QKnxNetIpRoutingSystemBroadcastBuilderPrivate)
+{}
+
+/*!
+ Destroys the object and frees any allocated resources.
+*/
+QKnxNetIpRoutingSystemBroadcastProxy::Builder::~Builder() = default;
+
+/*!
Sets the cEMI frame containing the routing system broadcast message to
\a cemi.
*/
@@ -168,7 +189,7 @@ QKnxNetIpRoutingSystemBroadcastProxy::Builder &
QKnxNetIpRoutingSystemBroadcastProxy::Builder::setCemi(const QKnxLinkLayerFrame &cemi)
{
if (QKnxPrivate::isCemiValid(cemi))
- m_llf = cemi;
+ d_ptr->m_llf = cemi;
return *this;
}
@@ -177,9 +198,26 @@ QKnxNetIpRoutingSystemBroadcastProxy::Builder &
*/
QKnxNetIpFrame QKnxNetIpRoutingSystemBroadcastProxy::Builder::create() const
{
- if (!m_llf.isValid())
+ if (!d_ptr->m_llf.isValid())
return {};
- return { QKnxNetIp::ServiceType::RoutingSystemBroadcast, m_llf.bytes() };
+ return { QKnxNetIp::ServiceType::RoutingSystemBroadcast, d_ptr->m_llf.bytes() };
+}
+
+/*!
+ Constructs a copy of \a other.
+*/
+QKnxNetIpRoutingSystemBroadcastProxy::Builder::Builder(const Builder &other)
+ : d_ptr(other.d_ptr)
+{}
+
+/*!
+ Assigns the specified \a other to this object.
+*/
+QKnxNetIpRoutingSystemBroadcastProxy::Builder &
+ QKnxNetIpRoutingSystemBroadcastProxy::Builder::operator=(const Builder &other)
+{
+ d_ptr = other.d_ptr;
+ return *this;
}
QT_END_NAMESPACE
diff --git a/src/knx/netip/qknxnetiproutingsystembroadcast.h b/src/knx/netip/qknxnetiproutingsystembroadcast.h
index 28b690c..b74d861 100644
--- a/src/knx/netip/qknxnetiproutingsystembroadcast.h
+++ b/src/knx/netip/qknxnetiproutingsystembroadcast.h
@@ -37,6 +37,7 @@
QT_BEGIN_NAMESPACE
+class QKnxNetIpRoutingSystemBroadcastBuilderPrivate;
class Q_KNX_EXPORT QKnxNetIpRoutingSystemBroadcastProxy final
{
public:
@@ -53,12 +54,18 @@ public:
class Q_KNX_EXPORT Builder final
{
public:
+ Builder();
+ ~Builder();
+
Builder &setCemi(const QKnxLinkLayerFrame &cemi);
QKnxNetIpFrame create() const;
+ Builder(const Builder &other);
+ Builder &operator=(const Builder &other);
+
private:
- QKnxLinkLayerFrame m_llf;
+ QSharedDataPointer<QKnxNetIpRoutingSystemBroadcastBuilderPrivate> d_ptr;
};
static QKnxNetIpRoutingSystemBroadcastProxy::Builder builder();
diff --git a/src/knx/netip/qknxnetipsecuredservicefamiliesdib.cpp b/src/knx/netip/qknxnetipsecuredservicefamiliesdib.cpp
index 9a6ef25..770e6f3 100644
--- a/src/knx/netip/qknxnetipsecuredservicefamiliesdib.cpp
+++ b/src/knx/netip/qknxnetipsecuredservicefamiliesdib.cpp
@@ -116,6 +116,15 @@ QT_BEGIN_NAMESPACE
\fn QKnxNetIpSecuredServiceFamiliesDibProxy::QKnxNetIpSecuredServiceFamiliesDibProxy(const QKnxNetIpDib &&)
*/
+class QKnxNetIpSecuredServiceFamiliesDibBuilderPrivate : public QSharedData
+{
+public:
+ QKnxNetIpSecuredServiceFamiliesDibBuilderPrivate() = default;
+ ~QKnxNetIpSecuredServiceFamiliesDibBuilderPrivate() = default;
+
+ QVector<QKnxSecuredServiceInfo> m_infos;
+};
+
/*!
Constructs a proxy object with the specified KNXnet/IP DIB structure
\a dib to read the supported service families and security versions.
@@ -198,15 +207,27 @@ QKnxNetIpSecuredServiceFamiliesDibProxy::Builder QKnxNetIpSecuredServiceFamilies
*/
/*!
+ Constructs a KnxNet/IP secured service families dib builder.
+*/
+QKnxNetIpSecuredServiceFamiliesDibProxy::Builder::Builder()
+ : d_ptr(new QKnxNetIpSecuredServiceFamiliesDibBuilderPrivate)
+{}
+
+/*!
+ Destroys the object and frees any allocated resources.
+*/
+QKnxNetIpSecuredServiceFamiliesDibProxy::Builder::~Builder() = default;
+
+/*!
Sets the supported service families and versions of the KNXnet/IP DIB
structure to \a infos and returns a reference to the builder.
*/
QKnxNetIpSecuredServiceFamiliesDibProxy::Builder &QKnxNetIpSecuredServiceFamiliesDibProxy::
Builder::setServiceInfos(const QVector<QKnxSecuredServiceInfo> &infos)
{
- m_infos = infos;
+ d_ptr->m_infos = infos;
- std::sort(m_infos.begin(), m_infos.end(),
+ std::sort(d_ptr->m_infos.begin(), d_ptr->m_infos.end(),
[](const QKnxSecuredServiceInfo &a, const QKnxSecuredServiceInfo &b) {
if (a.ServiceFamily < b.ServiceFamily)
return true;
@@ -216,11 +237,11 @@ QKnxNetIpSecuredServiceFamiliesDibProxy::Builder &QKnxNetIpSecuredServiceFamilie
}
return false;
});
- m_infos.erase(std::unique(m_infos.begin(), m_infos.end(),
+ d_ptr->m_infos.erase(std::unique(d_ptr->m_infos.begin(), d_ptr->m_infos.end(),
[](const QKnxSecuredServiceInfo &a, const QKnxSecuredServiceInfo &b) {
return a.ServiceFamily == b.ServiceFamily
&& a.RequiredSecurityVersion == b.RequiredSecurityVersion;
- }), m_infos.end());
+ }), d_ptr->m_infos.end());
return *this;
}
@@ -236,9 +257,26 @@ QKnxNetIpSecuredServiceFamiliesDibProxy::Builder &QKnxNetIpSecuredServiceFamilie
QKnxNetIpDib QKnxNetIpSecuredServiceFamiliesDibProxy::Builder::create() const
{
QKnxByteArray bytes;
- for (const auto &info : qAsConst(m_infos))
+ for (const auto &info : qAsConst(d_ptr->m_infos))
bytes += { quint8(info.ServiceFamily), info.RequiredSecurityVersion };
return { QKnxNetIp::DescriptionType::SecuredServices, bytes };
}
+/*!
+ Constructs a copy of \a other.
+*/
+QKnxNetIpSecuredServiceFamiliesDibProxy::Builder::Builder(const Builder &other)
+ : d_ptr(other.d_ptr)
+{}
+
+/*!
+ Assigns the specified \a other to this object.
+*/
+QKnxNetIpSecuredServiceFamiliesDibProxy::Builder &
+ QKnxNetIpSecuredServiceFamiliesDibProxy::Builder::operator=(const Builder &other)
+{
+ d_ptr = other.d_ptr;
+ return *this;
+}
+
QT_END_NAMESPACE
diff --git a/src/knx/netip/qknxnetipsecuredservicefamiliesdib.h b/src/knx/netip/qknxnetipsecuredservicefamiliesdib.h
index 1a34970..b01dd55 100644
--- a/src/knx/netip/qknxnetipsecuredservicefamiliesdib.h
+++ b/src/knx/netip/qknxnetipsecuredservicefamiliesdib.h
@@ -41,6 +41,7 @@ struct Q_KNX_EXPORT QKnxSecuredServiceInfo
quint8 RequiredSecurityVersion;
};
+class QKnxNetIpSecuredServiceFamiliesDibBuilderPrivate;
class Q_KNX_EXPORT QKnxNetIpSecuredServiceFamiliesDibProxy final
{
public:
@@ -58,12 +59,18 @@ public:
class Q_KNX_EXPORT Builder final
{
public:
+ Builder();
+ ~Builder();
+
Builder &setServiceInfos(const QVector<QKnxSecuredServiceInfo> &infos);
QKnxNetIpDib create() const;
+ Builder(const Builder &other);
+ Builder &operator=(const Builder &other);
+
private:
- QVector<QKnxSecuredServiceInfo> m_infos;
+ QSharedDataPointer<QKnxNetIpSecuredServiceFamiliesDibBuilderPrivate> d_ptr;
};
static QKnxNetIpSecuredServiceFamiliesDibProxy::Builder builder();
diff --git a/src/knx/netip/qknxnetipsessionauthenticate.cpp b/src/knx/netip/qknxnetipsessionauthenticate.cpp
index af6c368..46300f5 100644
--- a/src/knx/netip/qknxnetipsessionauthenticate.cpp
+++ b/src/knx/netip/qknxnetipsessionauthenticate.cpp
@@ -181,6 +181,28 @@ QKnxNetIpSessionAuthenticateProxy::Builder QKnxNetIpSessionAuthenticateProxy::bu
\sa QKnxCryptographicEngine
*/
+class QKnxNetIpSessionAuthenticateBuilderPrivate : public QSharedData
+{
+public:
+ QKnxNetIpSessionAuthenticateBuilderPrivate() = default;
+ ~QKnxNetIpSessionAuthenticateBuilderPrivate() = default;
+
+ quint16 m_id { 0 };
+ QKnxByteArray m_authCode;
+};
+
+/*!
+ Creates a new empty session authenticate frame builder.
+*/
+QKnxNetIpSessionAuthenticateProxy::Builder::Builder()
+ : d_ptr(new QKnxNetIpSessionAuthenticateBuilderPrivate)
+{}
+
+/*!
+ Destroys the object and frees any allocated resources.
+*/
+QKnxNetIpSessionAuthenticateProxy::Builder::~Builder() = default;
+
/*!
Sets the user ID of the KNXnet/IP session authentication frame to \a userId
and returns a reference to the builder.
@@ -191,7 +213,7 @@ QKnxNetIpSessionAuthenticateProxy::Builder QKnxNetIpSessionAuthenticateProxy::bu
QKnxNetIpSessionAuthenticateProxy::Builder &
QKnxNetIpSessionAuthenticateProxy::Builder::setUserId(quint16 userId)
{
- m_id = userId;
+ d_ptr->m_id = userId;
return *this;
}
@@ -203,7 +225,7 @@ QKnxNetIpSessionAuthenticateProxy::Builder &
QKnxNetIpSessionAuthenticateProxy::Builder &
QKnxNetIpSessionAuthenticateProxy::Builder::setMessageAuthenticationCode(const QKnxByteArray &data)
{
- m_authCode = data;
+ d_ptr->m_authCode = data;
return *this;
}
@@ -217,11 +239,28 @@ QKnxNetIpSessionAuthenticateProxy::Builder &
*/
QKnxNetIpFrame QKnxNetIpSessionAuthenticateProxy::Builder::create() const
{
- if (m_id == 0 || m_id >= 0x80 || m_authCode.size() != 16)
+ if (d_ptr->m_id == 0 || d_ptr->m_id >= 0x80 || d_ptr->m_authCode.size() != 16)
return { QKnxNetIp::ServiceType::SessionAuthenticate };
- return { QKnxNetIp::ServiceType::SessionAuthenticate, QKnxUtils::QUint16::bytes(m_id)
- + m_authCode };
+ return { QKnxNetIp::ServiceType::SessionAuthenticate, QKnxUtils::QUint16::bytes(d_ptr->m_id)
+ + d_ptr->m_authCode };
+}
+
+/*!
+ Constructs a copy of \a other.
+*/
+QKnxNetIpSessionAuthenticateProxy::Builder::Builder(const Builder &other)
+ : d_ptr(other.d_ptr)
+{}
+
+/*!
+ Assigns the specified \a other to this object.
+*/
+QKnxNetIpSessionAuthenticateProxy::Builder &
+ QKnxNetIpSessionAuthenticateProxy::Builder::operator=(const Builder &other)
+{
+ d_ptr = other.d_ptr;
+ return *this;
}
QT_END_NAMESPACE
diff --git a/src/knx/netip/qknxnetipsessionauthenticate.h b/src/knx/netip/qknxnetipsessionauthenticate.h
index 35c5a93..97884fd 100644
--- a/src/knx/netip/qknxnetipsessionauthenticate.h
+++ b/src/knx/netip/qknxnetipsessionauthenticate.h
@@ -35,6 +35,7 @@
QT_BEGIN_NAMESPACE
+class QKnxNetIpSessionAuthenticateBuilderPrivate;
class Q_KNX_EXPORT QKnxNetIpSessionAuthenticateProxy final
{
public:
@@ -52,14 +53,19 @@ public:
class Q_KNX_EXPORT Builder final
{
public:
+ Builder();
+ ~Builder();
+
Builder &setUserId(quint16 userId);
Builder &setMessageAuthenticationCode(const QKnxByteArray &data);
QKnxNetIpFrame create() const;
+ Builder(const Builder &other);
+ Builder &operator=(const Builder &other);
+
private:
- quint16 m_id { 0 };
- QKnxByteArray m_authCode;
+ QSharedDataPointer<QKnxNetIpSessionAuthenticateBuilderPrivate> d_ptr;
};
static QKnxNetIpSessionAuthenticateProxy::Builder builder();
diff --git a/src/knx/netip/qknxnetipsessionrequest.cpp b/src/knx/netip/qknxnetipsessionrequest.cpp
index 297011a..2f28860 100644
--- a/src/knx/netip/qknxnetipsessionrequest.cpp
+++ b/src/knx/netip/qknxnetipsessionrequest.cpp
@@ -178,6 +178,28 @@ QKnxNetIpSessionRequestProxy::Builder QKnxNetIpSessionRequestProxy::builder()
\endcode
*/
+class QKnxNetIpSessionRequestBuilderPrivate : public QSharedData
+{
+public:
+ QKnxNetIpSessionRequestBuilderPrivate() = default;
+ ~QKnxNetIpSessionRequestBuilderPrivate() = default;
+
+ QKnxNetIpHpai m_hpai;
+ QKnxByteArray m_publicKey;
+};
+
+/*!
+ Creates a new empty session request frame builder object.
+*/
+QKnxNetIpSessionRequestProxy::Builder::Builder()
+ : d_ptr(new QKnxNetIpSessionRequestBuilderPrivate)
+{}
+
+/*!
+ Destroys the object and frees any allocated resources.
+*/
+QKnxNetIpSessionRequestProxy::Builder::~Builder() = default;
+
/*!
Sets the control endpoint of the KNXnet/IP session request frame to \a hpai
and returns a reference to the builder.
@@ -185,7 +207,7 @@ QKnxNetIpSessionRequestProxy::Builder QKnxNetIpSessionRequestProxy::builder()
QKnxNetIpSessionRequestProxy::Builder &
QKnxNetIpSessionRequestProxy::Builder::setControlEndpoint(const QKnxNetIpHpai &hpai)
{
- m_hpai = hpai;
+ d_ptr->m_hpai = hpai;
return *this;
}
@@ -198,7 +220,7 @@ QKnxNetIpSessionRequestProxy::Builder &
QKnxNetIpSessionRequestProxy::Builder &
QKnxNetIpSessionRequestProxy::Builder::setPublicKey(const QKnxByteArray &publicKey)
{
- m_publicKey = publicKey;
+ d_ptr->m_publicKey = publicKey;
return *this;
}
@@ -212,9 +234,26 @@ QKnxNetIpSessionRequestProxy::Builder &
*/
QKnxNetIpFrame QKnxNetIpSessionRequestProxy::Builder::create() const
{
- if (m_hpai.isValid() && m_publicKey.size() == 32)
- return { QKnxNetIp::ServiceType::SessionRequest, m_hpai.bytes() + m_publicKey };
+ if (d_ptr->m_hpai.isValid() && d_ptr->m_publicKey.size() == 32)
+ return { QKnxNetIp::ServiceType::SessionRequest, d_ptr->m_hpai.bytes() + d_ptr->m_publicKey };
return { QKnxNetIp::ServiceType::SessionRequest };
}
+/*!
+ Constructs a copy of \a other.
+*/
+QKnxNetIpSessionRequestProxy::Builder::Builder(const Builder &other)
+ : d_ptr(other.d_ptr)
+{}
+
+/*!
+ Assigns the specified \a other to this object.
+*/
+QKnxNetIpSessionRequestProxy::Builder &
+ QKnxNetIpSessionRequestProxy::Builder::operator=(const Builder &other)
+{
+ d_ptr = other.d_ptr;
+ return *this;
+}
+
QT_END_NAMESPACE
diff --git a/src/knx/netip/qknxnetipsessionrequest.h b/src/knx/netip/qknxnetipsessionrequest.h
index f547330..a2a07ad 100644
--- a/src/knx/netip/qknxnetipsessionrequest.h
+++ b/src/knx/netip/qknxnetipsessionrequest.h
@@ -36,6 +36,7 @@
QT_BEGIN_NAMESPACE
+class QKnxNetIpSessionRequestBuilderPrivate;
class Q_KNX_EXPORT QKnxNetIpSessionRequestProxy final
{
public:
@@ -53,14 +54,19 @@ public:
class Q_KNX_EXPORT Builder final
{
public:
+ Builder();
+ ~Builder();
+
Builder &setControlEndpoint(const QKnxNetIpHpai &hpai);
Builder &setPublicKey(const QKnxByteArray &publicKey);
QKnxNetIpFrame create() const;
+ Builder(const Builder &other);
+ Builder &operator=(const Builder &other);
+
private:
- QKnxNetIpHpai m_hpai;
- QKnxByteArray m_publicKey;
+ QSharedDataPointer<QKnxNetIpSessionRequestBuilderPrivate> d_ptr;
};
static QKnxNetIpSessionRequestProxy::Builder builder();
diff --git a/src/knx/netip/qknxnetipsessionresponse.cpp b/src/knx/netip/qknxnetipsessionresponse.cpp
index 7c01050..b9ea89e 100644
--- a/src/knx/netip/qknxnetipsessionresponse.cpp
+++ b/src/knx/netip/qknxnetipsessionresponse.cpp
@@ -184,6 +184,29 @@ QKnxNetIpSessionResponseProxy::Builder QKnxNetIpSessionResponseProxy::builder()
\sa QKnxCryptographicEngine
*/
+class QKnxNetIpSessionResponseBuilderPrivate : public QSharedData
+{
+public:
+ QKnxNetIpSessionResponseBuilderPrivate() = default;
+ ~QKnxNetIpSessionResponseBuilderPrivate() = default;
+
+ qint32 m_id { -1 };
+ QKnxByteArray m_publicKey;
+ QKnxByteArray m_authCode;
+};
+
+/*!
+ Creates a new empty session response builder object.
+*/
+QKnxNetIpSessionResponseProxy::Builder::Builder()
+ : d_ptr(new QKnxNetIpSessionResponseBuilderPrivate)
+{}
+
+/*!
+ Destroys the object and frees any allocated resources.
+*/
+QKnxNetIpSessionResponseProxy::Builder::~Builder() = default;
+
/*!
Sets the secure session ID of the KNXnet/IP session response frame to
\a sessionId and returns a reference to the builder.
@@ -191,7 +214,7 @@ QKnxNetIpSessionResponseProxy::Builder QKnxNetIpSessionResponseProxy::builder()
QKnxNetIpSessionResponseProxy::Builder &
QKnxNetIpSessionResponseProxy::Builder::setSecureSessionId(quint16 sessionId)
{
- m_id = sessionId;
+ d_ptr->m_id = sessionId;
return *this;
}
@@ -203,7 +226,7 @@ QKnxNetIpSessionResponseProxy::Builder &
QKnxNetIpSessionResponseProxy::Builder &
QKnxNetIpSessionResponseProxy::Builder::setPublicKey(const QKnxByteArray &publicKey)
{
- m_publicKey = publicKey;
+ d_ptr->m_publicKey = publicKey;
return *this;
}
@@ -215,7 +238,7 @@ QKnxNetIpSessionResponseProxy::Builder &
QKnxNetIpSessionResponseProxy::Builder &
QKnxNetIpSessionResponseProxy::Builder::setMessageAuthenticationCode(const QKnxByteArray &data)
{
- m_authCode = data;
+ d_ptr->m_authCode = data;
return *this;
}
@@ -229,10 +252,28 @@ QKnxNetIpSessionResponseProxy::Builder &
*/
QKnxNetIpFrame QKnxNetIpSessionResponseProxy::Builder::create() const
{
- if (m_id < 0 || m_publicKey.size() != 32 || m_authCode.size() != 16)
+ if (d_ptr->m_id < 0 || d_ptr->m_publicKey.size() != 32 || d_ptr->m_authCode.size() != 16)
return { QKnxNetIp::ServiceType::SessionResponse };
- return { QKnxNetIp::ServiceType::SessionResponse, QKnxUtils::QUint16::bytes(m_id) + m_publicKey
- + m_authCode };
+
+ return { QKnxNetIp::ServiceType::SessionResponse, QKnxUtils::QUint16::bytes(d_ptr->m_id)
+ + d_ptr->m_publicKey + d_ptr->m_authCode };
+}
+
+/*!
+ Constructs a copy of \a other.
+*/
+QKnxNetIpSessionResponseProxy::Builder::Builder(const Builder &other)
+ : d_ptr(other.d_ptr)
+{}
+
+/*!
+ Assigns the specified \a other to this object.
+*/
+QKnxNetIpSessionResponseProxy::Builder &
+ QKnxNetIpSessionResponseProxy::Builder::operator=(const Builder &other)
+{
+ d_ptr = other.d_ptr;
+ return *this;
}
QT_END_NAMESPACE
diff --git a/src/knx/netip/qknxnetipsessionresponse.h b/src/knx/netip/qknxnetipsessionresponse.h
index 0ed3693..c2eecf6 100644
--- a/src/knx/netip/qknxnetipsessionresponse.h
+++ b/src/knx/netip/qknxnetipsessionresponse.h
@@ -36,6 +36,7 @@
QT_BEGIN_NAMESPACE
+class QKnxNetIpSessionResponseBuilderPrivate;
class Q_KNX_EXPORT QKnxNetIpSessionResponseProxy final
{
public:
@@ -54,16 +55,20 @@ public:
class Q_KNX_EXPORT Builder final
{
public:
+ Builder();
+ ~Builder();
+
Builder &setSecureSessionId(quint16 sessionId);
Builder &setPublicKey(const QKnxByteArray &publicKey);
Builder &setMessageAuthenticationCode(const QKnxByteArray &data);
QKnxNetIpFrame create() const;
+ Builder(const Builder &other);
+ Builder &operator=(const Builder &other);
+
private:
- qint32 m_id { -1 };
- QKnxByteArray m_publicKey;
- QKnxByteArray m_authCode;
+ QSharedDataPointer<QKnxNetIpSessionResponseBuilderPrivate> d_ptr;
};
static QKnxNetIpSessionResponseProxy::Builder builder();
diff --git a/src/knx/netip/qknxnetipsessionstatus.cpp b/src/knx/netip/qknxnetipsessionstatus.cpp
index 08df506..0b79ad6 100644
--- a/src/knx/netip/qknxnetipsessionstatus.cpp
+++ b/src/knx/netip/qknxnetipsessionstatus.cpp
@@ -158,6 +158,27 @@ QKnxNetIpSessionStatusProxy::Builder QKnxNetIpSessionStatusProxy::builder()
\endcode
*/
+class QKnxNetIpSessionStatusBuilderPrivate : public QSharedData
+{
+public:
+ QKnxNetIpSessionStatusBuilderPrivate() = default;
+ ~QKnxNetIpSessionStatusBuilderPrivate() = default;
+
+ QKnxNetIp::SecureSessionStatus m_status = QKnxNetIp::SecureSessionStatus::Unknown;
+};
+
+/*!
+ Creates a new empty session status frame builder object.
+*/
+QKnxNetIpSessionStatusProxy::Builder::Builder()
+ : d_ptr(new QKnxNetIpSessionStatusBuilderPrivate)
+{}
+
+/*!
+ Destroys the object and frees any allocated resources.
+*/
+QKnxNetIpSessionStatusProxy::Builder::~Builder() = default;
+
/*!
Sets the status of the KNXnet/IP session status frame to \a status
and returns a reference to the builder.
@@ -165,7 +186,7 @@ QKnxNetIpSessionStatusProxy::Builder QKnxNetIpSessionStatusProxy::builder()
QKnxNetIpSessionStatusProxy::Builder &
QKnxNetIpSessionStatusProxy::Builder::setStatus(QKnxNetIp::SecureSessionStatus status)
{
- m_status = status;
+ d_ptr->m_status = status;
return *this;
}
@@ -179,11 +200,28 @@ QKnxNetIpSessionStatusProxy::Builder &
*/
QKnxNetIpFrame QKnxNetIpSessionStatusProxy::Builder::create() const
{
- if (m_status > QKnxNetIp::SecureSessionStatus::Close)
+ if (d_ptr->m_status > QKnxNetIp::SecureSessionStatus::Close)
return { QKnxNetIp::ServiceType::SessionStatus };
return { QKnxNetIp::ServiceType::SessionStatus,
- QKnxUtils::QUint16::bytes(quint16(m_status) << 8) };
+ QKnxUtils::QUint16::bytes(quint16(d_ptr->m_status) << 8) };
+}
+
+/*!
+ Constructs a copy of \a other.
+*/
+QKnxNetIpSessionStatusProxy::Builder::Builder(const Builder &other)
+ : d_ptr(other.d_ptr)
+{}
+
+/*!
+ Assigns the specified \a other to this object.
+*/
+QKnxNetIpSessionStatusProxy::Builder &
+ QKnxNetIpSessionStatusProxy::Builder::operator=(const Builder &other)
+{
+ d_ptr = other.d_ptr;
+ return *this;
}
QT_END_NAMESPACE
diff --git a/src/knx/netip/qknxnetipsessionstatus.h b/src/knx/netip/qknxnetipsessionstatus.h
index ecb97c1..ec9616e 100644
--- a/src/knx/netip/qknxnetipsessionstatus.h
+++ b/src/knx/netip/qknxnetipsessionstatus.h
@@ -35,6 +35,7 @@
QT_BEGIN_NAMESPACE
+class QKnxNetIpSessionStatusBuilderPrivate;
class Q_KNX_EXPORT QKnxNetIpSessionStatusProxy final
{
public:
@@ -50,12 +51,18 @@ public:
class Q_KNX_EXPORT Builder final
{
public:
+ Builder();
+ ~Builder();
+
Builder &setStatus(QKnxNetIp::SecureSessionStatus status);
QKnxNetIpFrame create() const;
+ Builder(const Builder &other);
+ Builder &operator=(const Builder &other);
+
private:
- QKnxNetIp::SecureSessionStatus m_status = QKnxNetIp::SecureSessionStatus::Unknown;
+ QSharedDataPointer<QKnxNetIpSessionStatusBuilderPrivate> d_ptr;
};
static QKnxNetIpSessionStatusProxy::Builder builder();
diff --git a/src/knx/netip/qknxnetiptimernotify.cpp b/src/knx/netip/qknxnetiptimernotify.cpp
index 18ea35b..495189b 100644
--- a/src/knx/netip/qknxnetiptimernotify.cpp
+++ b/src/knx/netip/qknxnetiptimernotify.cpp
@@ -192,6 +192,30 @@ QKnxNetIpTimerNotifyProxy::Builder QKnxNetIpTimerNotifyProxy::builder()
\sa QKnxCryptographicEngine
*/
+class QKnxNetIpTimerNotifyBuilderPrivate : public QSharedData
+{
+public:
+ QKnxNetIpTimerNotifyBuilderPrivate() = default;
+ ~QKnxNetIpTimerNotifyBuilderPrivate() = default;
+
+ quint64 m_timer { Q_UINT48_MAX + 1 };
+ QKnxByteArray m_serial;
+ qint32 m_tag { -1 };
+ QKnxByteArray m_authCode;
+};
+
+/*!
+ Creates a new empty timer notify frame builder object.
+*/
+QKnxNetIpTimerNotifyProxy::Builder::Builder()
+ : d_ptr(new QKnxNetIpTimerNotifyBuilderPrivate)
+{}
+
+/*!
+ Destroys the object and frees any allocated resources.
+*/
+QKnxNetIpTimerNotifyProxy::Builder::~Builder() = default;
+
/*!
Sets the timer value to \a timerValue and returns a reference to the
builder.
@@ -203,7 +227,7 @@ QKnxNetIpTimerNotifyProxy::Builder QKnxNetIpTimerNotifyProxy::builder()
QKnxNetIpTimerNotifyProxy::Builder &
QKnxNetIpTimerNotifyProxy::Builder::setTimerValue(quint48 timerValue)
{
- m_timer = timerValue;
+ d_ptr->m_timer = timerValue;
return *this;
}
@@ -216,7 +240,7 @@ QKnxNetIpTimerNotifyProxy::Builder &
QKnxNetIpTimerNotifyProxy::Builder &
QKnxNetIpTimerNotifyProxy::Builder::setSerialNumber(const QKnxByteArray &serialNumber)
{
- m_serial = serialNumber;
+ d_ptr->m_serial = serialNumber;
return *this;
}
@@ -230,7 +254,7 @@ QKnxNetIpTimerNotifyProxy::Builder &
*/
QKnxNetIpTimerNotifyProxy::Builder &QKnxNetIpTimerNotifyProxy::Builder::setMessageTag(quint16 tag)
{
- m_tag = tag;
+ d_ptr->m_tag = tag;
return *this;
}
@@ -242,7 +266,7 @@ QKnxNetIpTimerNotifyProxy::Builder &QKnxNetIpTimerNotifyProxy::Builder::setMessa
QKnxNetIpTimerNotifyProxy::Builder &
QKnxNetIpTimerNotifyProxy::Builder::setMessageAuthenticationCode(const QKnxByteArray &data)
{
- m_authCode = data;
+ d_ptr->m_authCode = data;
return *this;
}
@@ -256,11 +280,29 @@ QKnxNetIpTimerNotifyProxy::Builder &
*/
QKnxNetIpFrame QKnxNetIpTimerNotifyProxy::Builder::create() const
{
- if (m_timer <= Q_UINT48_MAX && m_serial.size() == 6 && m_tag >= 0 && m_authCode.size() == 16) {
- return { QKnxNetIp::ServiceType::TimerNotify, QKnxUtils::QUint48::bytes(m_timer)
- + m_serial + QKnxUtils::QUint16::bytes(m_tag) + m_authCode };
+ if (d_ptr->m_timer <= Q_UINT48_MAX && d_ptr->m_serial.size() == 6 && d_ptr->m_tag >= 0
+ && d_ptr->m_authCode.size() == 16) {
+ return { QKnxNetIp::ServiceType::TimerNotify, QKnxUtils::QUint48::bytes(d_ptr->m_timer)
+ + d_ptr->m_serial + QKnxUtils::QUint16::bytes(d_ptr->m_tag) + d_ptr->m_authCode };
}
return { QKnxNetIp::ServiceType::TimerNotify };
}
+/*!
+ Constructs a copy of \a other.
+*/
+QKnxNetIpTimerNotifyProxy::Builder::Builder(const Builder &other)
+ : d_ptr(other.d_ptr)
+{}
+
+/*!
+ Assigns the specified \a other to this object.
+*/
+QKnxNetIpTimerNotifyProxy::Builder &
+ QKnxNetIpTimerNotifyProxy::Builder::operator=(const Builder &other)
+{
+ d_ptr = other.d_ptr;
+ return *this;
+}
+
QT_END_NAMESPACE
diff --git a/src/knx/netip/qknxnetiptimernotify.h b/src/knx/netip/qknxnetiptimernotify.h
index 298e568..5b94acf 100644
--- a/src/knx/netip/qknxnetiptimernotify.h
+++ b/src/knx/netip/qknxnetiptimernotify.h
@@ -35,6 +35,7 @@
QT_BEGIN_NAMESPACE
+class QKnxNetIpTimerNotifyBuilderPrivate;
class Q_KNX_EXPORT QKnxNetIpTimerNotifyProxy final
{
public:
@@ -54,6 +55,9 @@ public:
class Q_KNX_EXPORT Builder final
{
public:
+ Builder();
+ ~Builder();
+
Builder &setTimerValue(quint48 timerValue);
Builder &setSerialNumber(const QKnxByteArray &serialNumber);
Builder &setMessageTag(quint16 tag);
@@ -61,11 +65,11 @@ public:
QKnxNetIpFrame create() const;
+ Builder(const Builder &other);
+ Builder &operator=(const Builder &other);
+
private:
- quint64 m_timer { Q_UINT48_MAX + 1 };
- QKnxByteArray m_serial;
- qint32 m_tag { -1 };
- QKnxByteArray m_authCode;
+ QSharedDataPointer<QKnxNetIpTimerNotifyBuilderPrivate> d_ptr;
};
static QKnxNetIpTimerNotifyProxy::Builder builder();