diff options
author | Karsten Heimrich <karsten.heimrich@qt.io> | 2018-09-14 11:50:29 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@qt.io> | 2018-09-14 11:14:37 +0000 |
commit | 2182b5fea063b3b905c82a29b44f3b17b0078b4e (patch) | |
tree | 2779a503576a17cd6b8233d592c75492f566963e | |
parent | 7305d1875c1f56bdaf02c15866b3ee910bad5b0c (diff) |
Doc: Add important notice about object lifetime, unify examples
Change-Id: Iec61fae10612f9f4460429626d369940aa0851b0
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
22 files changed, 167 insertions, 79 deletions
diff --git a/src/knx/netip/qknxnetipconnectionstaterequest.cpp b/src/knx/netip/qknxnetipconnectionstaterequest.cpp index f2d7ece..109b2a8 100644 --- a/src/knx/netip/qknxnetipconnectionstaterequest.cpp +++ b/src/knx/netip/qknxnetipconnectionstaterequest.cpp @@ -55,18 +55,22 @@ QT_BEGIN_NAMESPACE \l QKnxNetIpTunnel or \l QKnxNetIpDeviceManagement class is used to establish a functional connection to a KNXnet/IP server. + \note When using QKnxNetIpConnectionStateRequestProxy, care must be taken + to ensure that the referenced KNXnet/IP frame outlives the proxy on all code + paths, lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the connection state request information sent by a KNXnet/IP client: \code auto frame = QKnxNetIpFrame::fromBytes(...); - const QKnxNetIpConnectionStateRequestProxy connectionStateRequest(netIpFrame); - if (!connectionStateRequest.isValid()) + const QKnxNetIpConnectionStateRequestProxy proxy(netIpFrame); + if (!proxy.isValid()) return; - quint8 chanId = connectionStateRequest.channelId(); - auto hpai = connectionStateRequest.controlEndpoint(); + quint8 chanId = proxy.channelId(); + auto hpai = proxy.controlEndpoint(); \endcode \sa builder(), QKnxNetIpConnectionStateResponseProxy, {Qt KNXnet/IP Connection Classes} diff --git a/src/knx/netip/qknxnetipconnectionstateresponse.cpp b/src/knx/netip/qknxnetipconnectionstateresponse.cpp index d757b12..3c9e224 100644 --- a/src/knx/netip/qknxnetipconnectionstateresponse.cpp +++ b/src/knx/netip/qknxnetipconnectionstateresponse.cpp @@ -51,18 +51,22 @@ QT_BEGIN_NAMESPACE \l QKnxNetIpTunnel or \l QKnxNetIpDeviceManagement class is used to establish a functional connection to a KNXnet/IP server. + \note When using QKnxNetIpConnectionStateResponseProxy, care must be taken + to ensure that the referenced KNXnet/IP frame outlives the proxy on all code + paths, lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the connection state response information sent by a KNXnet/IP server: \code auto netIpFrame = QKnxNetIpFrame::fromBytes(...); - const QKnxNetIpConnectionStateResponseProxy connectionStateResponse(netIpFrame); - if (!connectionStateResponse.isValid()) + const QKnxNetIpConnectionStateResponseProxy proxy(netIpFrame); + if (!proxy.isValid()) return; - auto chanId = connectionStateResponse.channelId(); - auto status = connectionStateResponse.status(); + auto chanId = proxy.channelId(); + auto status = proxy.status(); \endcode \sa builder(), QKnxNetIpConnectionStateRequestProxy, {Qt KNXnet/IP Connection Classes} diff --git a/src/knx/netip/qknxnetipconnectrequest.cpp b/src/knx/netip/qknxnetipconnectrequest.cpp index d6f2861..998dc63 100644 --- a/src/knx/netip/qknxnetipconnectrequest.cpp +++ b/src/knx/netip/qknxnetipconnectrequest.cpp @@ -58,19 +58,23 @@ QT_BEGIN_NAMESPACE \l QKnxNetIpServerDescriptionAgent and \l QKnxNetIpServerInfo to check that the server supports the requested connection type and options. + \note When using QKnxNetIpConnectRequestProxy, care must be taken to ensure + that the referenced KNXnet/IP frame outlives the proxy on all code paths, + lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the connection request information sent by a KNXnet/IP client: \code auto frame = QKnxNetIpFrame::fromBytes(...); - const QKnxNetIpConnectRequestProxy request(frame); - if (!request.isValid()) + const QKnxNetIpConnectRequestProxy proxy(frame); + if (!proxy.isValid()) return; - auto ctrlEndpoint = request.controlEndpoint(); - auto dataEndpoint = request.dataEndpoint(); - auto cri = request. requestInformation(); + auto ctrlEndpoint = proxy.controlEndpoint(); + auto dataEndpoint = proxy.dataEndpoint(); + auto cri = proxy. requestInformation(); \endcode \sa builder(), {Qt KNXnet/IP Connection Classes} diff --git a/src/knx/netip/qknxnetipconnectresponse.cpp b/src/knx/netip/qknxnetipconnectresponse.cpp index 43aa4f9..9b8002e 100644 --- a/src/knx/netip/qknxnetipconnectresponse.cpp +++ b/src/knx/netip/qknxnetipconnectresponse.cpp @@ -52,19 +52,23 @@ QT_BEGIN_NAMESPACE \l QKnxNetIpTunnel or \l QKnxNetIpDeviceManagement class is used to establish a functional connection to a KNXnet/IP server. + \note When using QKnxNetIpConnectResponseProxy, care must be taken to + ensure that the referenced KNXnet/IP frame outlives the proxy on all code + paths, lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the connection response information sent by a KNXnet/IP server: \code auto netIpFrame = QKnxNetIpFrame::fromBytes(...); - const QKnxNetIpConnectResponseProxy connectResponse(netIpFrame); - if (!connectResponse.isValid()) + const QKnxNetIpConnectResponseProxy proxy(netIpFrame); + if (!proxy.isValid()) return; - auto chanId = connectResponse.channelId(); - auto data = connectResponse.responseData(); - auto endPoint = connectResponse.dataEndpoint(); - auto netIpError = connectResponse.status(); + auto chanId = proxy.channelId(); + auto data = proxy.responseData(); + auto endPoint = proxy.dataEndpoint(); + auto netIpError = proxy.status(); \endcode \sa builder(), {Qt KNXnet/IP Connection Classes} diff --git a/src/knx/netip/qknxnetipdescriptionrequest.cpp b/src/knx/netip/qknxnetipdescriptionrequest.cpp index ac1c1e7..e78d458 100644 --- a/src/knx/netip/qknxnetipdescriptionrequest.cpp +++ b/src/knx/netip/qknxnetipdescriptionrequest.cpp @@ -49,17 +49,21 @@ QT_BEGIN_NAMESPACE \l QKnxNetIpServerDescriptionAgent and \l QKnxNetIpServerInfo are provided to check that the server supports the requested connection type and options. + \note When using QKnxNetIpDescriptionRequestProxy, care must be taken to + ensure that the referenced KNXnet/IP frame outlives the proxy on all code + paths, lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the description request information sent by a KNXnet/IP client: \code auto netIpFrame = QKnxNetIpFrame::fromBytes(...); - const QKnxNetIpDescriptionRequestProxy descriptionRequest(netIpFrame); - if (!descriptionRequest.isValid()) + const QKnxNetIpDescriptionRequestProxy proxy(netIpFrame); + if (!proxy.isValid()) return; - auto endPoint = descriptionRequest.controlEndpoint(); + auto endPoint = proxy.controlEndpoint(); \endcode \sa builder(), QKnxNetIpDescriptionResponseProxy, {Qt KNXnet/IP Connection Classes} diff --git a/src/knx/netip/qknxnetipdescriptionresponse.cpp b/src/knx/netip/qknxnetipdescriptionresponse.cpp index f6c584b..5e5b785 100644 --- a/src/knx/netip/qknxnetipdescriptionresponse.cpp +++ b/src/knx/netip/qknxnetipdescriptionresponse.cpp @@ -53,18 +53,22 @@ QT_BEGIN_NAMESPACE \l QKnxNetIpServerDescriptionAgent and \l QKnxNetIpServerInfo are provided to check that the server supports the requested connection type and options. + \note When using QKnxNetIpDescriptionResponseProxy, care must be taken to + ensure that the referenced KNXnet/IP frame outlives the proxy on all code + paths, lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the description response information sent by a KNXnet/IP server: \code auto netIpFrame = QKnxNetIpFrame::fromBytes(...); - const QKnxNetIpDescriptionResponseProxy response(netIpFrame); - if (!response.isValid()) + const QKnxNetIpDescriptionResponseProxy proxy(netIpFrame); + if (!proxy.isValid()) return; - auto hardware = response.deviceHardware(); - auto families = response.supportedFamilies(); + auto hardware = proxy.deviceHardware(); + auto families = proxy.supportedFamilies(); \endcode \sa builder(), QKnxNetIpDescriptionRequestProxy, {Qt KNXnet/IP Connection Classes} diff --git a/src/knx/netip/qknxnetipdeviceconfigurationacknowledge.cpp b/src/knx/netip/qknxnetipdeviceconfigurationacknowledge.cpp index 605e9c1..1b23454 100644 --- a/src/knx/netip/qknxnetipdeviceconfigurationacknowledge.cpp +++ b/src/knx/netip/qknxnetipdeviceconfigurationacknowledge.cpp @@ -62,19 +62,23 @@ QT_BEGIN_NAMESPACE \l QKnxNetIpTunnel or \l QKnxNetIpDeviceManagement class is used to establish a functional connection to a KNXnet/IP server. + \note When using QKnxNetIpDeviceConfigurationAcknowledgeProxy, care must be + taken to ensure that the referenced KNXnet/IP frame outlives the proxy on + all code paths, lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the device configuration acknowledgment information sent by a KNXnet/IP client: \code auto frame = QKnxNetIpFrame::fromBytes(...); - const QKnxNetIpDeviceConfigurationAcknowledgeProxy configAck(netIpFrame); - if (!configAck.isValid()) + const QKnxNetIpDeviceConfigurationAcknowledgeProxy proxy(netIpFrame); + if (!proxy.isValid()) return; - quint8 chanId = configAck.channelId(); - quint8 seqNum = configAck.sequenceNumber(); - QKnx::NetIp::Error error = configAck.status(); + quint8 chanId = proxy.channelId(); + quint8 seqNum = proxy.sequenceNumber(); + QKnx::NetIp::Error error = proxy.status(); \endcode \sa builder(), QKnxNetIpDeviceConfigurationRequestProxy, diff --git a/src/knx/netip/qknxnetipdeviceconfigurationrequest.cpp b/src/knx/netip/qknxnetipdeviceconfigurationrequest.cpp index ab329c1..4996f3a 100644 --- a/src/knx/netip/qknxnetipdeviceconfigurationrequest.cpp +++ b/src/knx/netip/qknxnetipdeviceconfigurationrequest.cpp @@ -77,19 +77,23 @@ QT_BEGIN_NAMESPACE \l QKnxNetIpTunnel or \l QKnxNetIpDeviceManagement class is used to establish a functional connection to a KNXnet/IP server. + \note When using QKnxNetIpDeviceConfigurationRequestProxy, care must be + taken to ensure that the referenced KNXnet/IP frame outlives the proxy on + all code paths, lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the device configuration request information sent by a KNXnet/IP client: \code auto netIpFrame = QKnxNetIpFrame::fromBytes(...); - const QKnxNetIpDeviceConfigurationRequestProxy configRequest(netIpFrame); - if (!configRequest.isValid()) + const QKnxNetIpDeviceConfigurationRequestProxy proxy(netIpFrame); + if (!proxy.isValid()) return; - quint8 chanId = configRequest.channelId(); - quint8 seqNum = configRequest.sequenceNumber(); - auto knxLinkFrame = configRequest.cemi(); + quint8 chanId = proxy.channelId(); + quint8 seqNum = proxy.sequenceNumber(); + auto knxLinkFrame = proxy.cemi(); \endcode \sa builder(), QKnxNetIpServerDiscoveryAgent, diff --git a/src/knx/netip/qknxnetipdisconnectrequest.cpp b/src/knx/netip/qknxnetipdisconnectrequest.cpp index f58884b..65ce26f 100644 --- a/src/knx/netip/qknxnetipdisconnectrequest.cpp +++ b/src/knx/netip/qknxnetipdisconnectrequest.cpp @@ -56,18 +56,22 @@ QT_BEGIN_NAMESPACE \l QKnxNetIpTunnel or \l QKnxNetIpDeviceManagement class is used to establish a functional connection to a KNXnet/IP server. + \note When using QKnxNetIpDisconnectRequestProxy, care must be taken to + ensure that the referenced KNXnet/IP frame outlives the proxy on all code + paths, lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the disconnection request information sent by a KNXnet/IP client: \code auto netIpFrame = QKnxNetIpFrame::fromBytes(...); - const QKnxNetIpDisconnectRequestProxy disconnectRequest(netIpFrame); - if (!disconnectRequest.isValid()) + const QKnxNetIpDisconnectRequestProxy proxy(netIpFrame); + if (!proxy.isValid()) return; - quint8 chanId = disconnectRequest.channelId(); - auto hpai = disconnectRequest.controlEndpoint(); + quint8 chanId = proxy.channelId(); + auto hpai = proxy.controlEndpoint(); \endcode \sa builder() diff --git a/src/knx/netip/qknxnetipdisconnectresponse.cpp b/src/knx/netip/qknxnetipdisconnectresponse.cpp index 364cd83..43fdae4 100644 --- a/src/knx/netip/qknxnetipdisconnectresponse.cpp +++ b/src/knx/netip/qknxnetipdisconnectresponse.cpp @@ -51,18 +51,22 @@ QT_BEGIN_NAMESPACE \l QKnxNetIpTunnel or \l QKnxNetIpDeviceManagement class is used to establish a functional connection to a KNXnet/IP server. + \note When using QKnxNetIpDisconnectResponseProxy, care must be taken to + ensure that the referenced KNXnet/IP frame outlives the proxy on all code + paths, lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the disconnection response information sent by a KNXnet/IP client: \code auto netIpFrame = QKnxNetIpFrame::fromBytes(...); - const QKnxNetIpDisconnectRequestProxy disconnectRequest(netIpFrame); - if (!disconnectRequest.isValid()) + const QKnxNetIpDisconnectResponseProxy proxy(netIpFrame); + if (!proxy.isValid()) return; - quint8 chanId = disconnectRequest.channelId(); - QKnx::NetIp::Error state = disconnectRequest.status(); + quint8 chanId = proxy.channelId(); + QKnx::NetIp::Error state = proxy.status(); \endcode \sa builder(), QKnxNetIpDisconnectRequestProxy, diff --git a/src/knx/netip/qknxnetiproutingbusy.cpp b/src/knx/netip/qknxnetiproutingbusy.cpp index 93f2d1b..cb70000 100644 --- a/src/knx/netip/qknxnetiproutingbusy.cpp +++ b/src/knx/netip/qknxnetiproutingbusy.cpp @@ -59,17 +59,21 @@ QT_BEGIN_NAMESPACE control field. The control field is set to \c 0000h, which requires all routers and devices to act upon receiving the router busy message. + \note When using QKnxNetIpRoutingBusyProxy, care must be taken to ensure + that the referenced KNXnet/IP frame outlives the proxy on all code paths, + lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the router busy message information sent by a KNXnet/IP router or device: \code auto netIpFrame = QKnxNetIpFrame::fromBytes(...); - const QKnxNetIpRoutingBusyProxy routerAnswer(netIpFrame); - if (!routerAnswer.isValid()) + const QKnxNetIpRoutingBusyProxy proxy(netIpFrame); + if (!proxy.isValid()) return; - auto busyTime = routerAnswer.routingBusyWaitTime(); + auto busyTime = proxy.routingBusyWaitTime(); \endcode The sending device will wait for \c busyTime before sending the next frame. diff --git a/src/knx/netip/qknxnetiproutingindication.cpp b/src/knx/netip/qknxnetiproutingindication.cpp index c13cbc2..c465181 100644 --- a/src/knx/netip/qknxnetiproutingindication.cpp +++ b/src/knx/netip/qknxnetiproutingindication.cpp @@ -45,17 +45,21 @@ QT_BEGIN_NAMESPACE A routing indication is sent by a KNXnet/IP router or device to transmit KNX link layer frames over IP networks. + \note When using QKnxNetIpRoutingIndicationProxy, care must be taken to + ensure that the referenced KNXnet/IP frame outlives the proxy on all code + paths, lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the routing indication information sent by a KNXnet/IP router or device: \code auto netIpFrame = QKnxNetIpFrame::fromBytes(...); - const QKnxNetIpRoutingIndicationProxy routingIndication(netIpFrame); - if (!routingIndication.isValid()) + const QKnxNetIpRoutingIndicationProxy proxy(netIpFrame); + if (!proxy.isValid()) return; - auto linkFrame = routingIndication.linkLayerFrame(); + auto linkFrame = proxy.linkLayerFrame(); \endcode \sa builder(), QKnxNetIpRoutingLostMessageProxy, QKnxNetIpRoutingBusyProxy, diff --git a/src/knx/netip/qknxnetiproutinglostmessage.cpp b/src/knx/netip/qknxnetiproutinglostmessage.cpp index 4f82500..f5e08b6 100644 --- a/src/knx/netip/qknxnetiproutinglostmessage.cpp +++ b/src/knx/netip/qknxnetiproutinglostmessage.cpp @@ -54,17 +54,21 @@ QT_BEGIN_NAMESPACE state of the router or device (\l QKnx::NetIp::DeviceState) and the number of lost frames. + \note When using QKnxNetIpRoutingLostMessageProxy, care must be taken to + ensure that the referenced KNXnet/IP frame outlives the proxy on all code + paths, lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the routing-lost message information sent by a KNXnet/IP router: \code auto netIpFrame = QKnxNetIpFrame::fromBytes(...); - QKnxNetIpRoutingLostMessageProxy routingProxy(netIpFrame); - if (!routingProxy.isValid()) + QKnxNetIpRoutingLostMessageProxy proxy(netIpFrame); + if (!proxy.isValid()) return; - if (routingProxy.deviceState() == QKnx::NetIp::DeviceState::KnxFault) { + if (proxy.deviceState() == QKnx::NetIp::DeviceState::KnxFault) { .... } \endcode diff --git a/src/knx/netip/qknxnetiproutingsystembroadcast.cpp b/src/knx/netip/qknxnetiproutingsystembroadcast.cpp index 6b3f7fe..66e8d6c 100644 --- a/src/knx/netip/qknxnetiproutingsystembroadcast.cpp +++ b/src/knx/netip/qknxnetiproutingsystembroadcast.cpp @@ -53,17 +53,21 @@ QT_BEGIN_NAMESPACE KNXnet/IP devices configured on different backbone keys are not able to communicate between each other. + \note When using QKnxNetIpRoutingSystemBroadcastProxy, care must be taken + to ensure that the referenced KNXnet/IP frame outlives the proxy on all code + paths, lest the proxy ends up referencing deleted data. + The following code sample illustrates how to introspect a routing system broadcast frame: \code auto netIpFrame = QKnxNetIpFrame::fromBytes(...); - const QKnxNetIpRoutingSystemBroadcastProxy sbc(netIpFrame); - if (!sbc.isValid()) + const QKnxNetIpRoutingSystemBroadcastProxy proxy(netIpFrame); + if (!proxy.isValid()) return; - auto linkFrame = sbc.linkLayerFrame(); + auto linkFrame = proxy.linkLayerFrame(); \endcode \sa builder(), QKnxNetIpRoutingSystemBroadcastProxy, diff --git a/src/knx/netip/qknxnetipsearchrequest.cpp b/src/knx/netip/qknxnetipsearchrequest.cpp index 572e3a6..9adbd9b 100644 --- a/src/knx/netip/qknxnetipsearchrequest.cpp +++ b/src/knx/netip/qknxnetipsearchrequest.cpp @@ -59,17 +59,21 @@ QT_BEGIN_NAMESPACE \l QKnxNetIpServerDiscoveryAgent and \l QKnxNetIpServerInfo are provided to discover KNXnet/IP servers on the network. + \note When using QKnxNetIpSearchRequestProxy, care must be taken to + ensure that the referenced KNXnet/IP frame outlives the proxy on all code + paths, lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the search request information sent by a KNXnet/IP client: \code auto netIpFrame = QKnxNetIpFrame::fromBytes(...); - QKnxNetIpSearchRequestProxy searchRequest(netIpFrame); - if (!searchRequest.isValid()) + QKnxNetIpSearchRequestProxy proxy(netIpFrame); + if (!proxy.isValid()) return; - QKnxNetIpHpai hpai = searchRequest.discoveryEndpoint(); + QKnxNetIpHpai hpai = proxy.discoveryEndpoint(); // ... \endcode diff --git a/src/knx/netip/qknxnetipsearchresponse.cpp b/src/knx/netip/qknxnetipsearchresponse.cpp index 7328b91..ac42b4b 100644 --- a/src/knx/netip/qknxnetipsearchresponse.cpp +++ b/src/knx/netip/qknxnetipsearchresponse.cpp @@ -60,19 +60,23 @@ QT_BEGIN_NAMESPACE \l QKnxNetIpServerDiscoveryAgent and \l QKnxNetIpServerInfo are provided to discover KNXnet/IP servers on the network. + \note When using QKnxNetIpSearchResponseProxy, care must be taken to + ensure that the referenced KNXnet/IP frame outlives the proxy on all code + paths, lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the search response information sent by a KNXnet/IP server: \code auto netIpFrame = QKnxNetIpFrame::fromBytes(...); - const QKnxNetIpSearchResponseProxy searchResponse(netIpFrame); - if (!searchResponse.isValid()) + const QKnxNetIpSearchResponseProxy proxy(netIpFrame); + if (!proxy.isValid()) return - auto netIpHpai = searchResponse.controlEndpoint(); - auto hardwareNetIpDib = searchResponse.deviceHardware(); - auto supportedFamillies = searchResponse.supportedFamilies(); + auto netIpHpai = proxy.controlEndpoint(); + auto hardwareNetIpDib = proxy.deviceHardware(); + auto supportedFamillies = proxy.supportedFamilies(); // ... \endcode diff --git a/src/knx/netip/qknxnetiptunnelingacknowledge.cpp b/src/knx/netip/qknxnetiptunnelingacknowledge.cpp index a83c144..f26ec3f 100644 --- a/src/knx/netip/qknxnetiptunnelingacknowledge.cpp +++ b/src/knx/netip/qknxnetiptunnelingacknowledge.cpp @@ -64,19 +64,23 @@ QT_BEGIN_NAMESPACE \l QKnxNetIpTunnel or \l QKnxNetIpDeviceManagement class is used to establish a functional connection to a KNXnet/IP server. + \note When using QKnxNetIpTunnelingAcknowledgeProxy, care must be taken to + ensure that the referenced KNXnet/IP frame outlives the proxy on all code + paths, lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the tunneling acknowledgment information sent by a KNXnet/IP client: \code auto netIpFrame = QKnxNetIpFrame::fromBytes(...); - const QKnxNetIpTunnelingAcknowledgeProxy tunnelAck(netIpFrame); - if (!tunnelAck.isValid()) + const QKnxNetIpTunnelingAcknowledgeProxy proxy(netIpFrame); + if (!proxy.isValid()) return; - auto chanId = tunnelAck.channelId(); - auto seqNum = tunnelAck.sequenceNumber(); - auto tunnelStatus = tunnelAck.status(); + auto chanId = proxy.channelId(); + auto seqNum = proxy.sequenceNumber(); + auto tunnelStatus = proxy.status(); \endcode \sa builder(), QKnxNetIpTunnelingRequestProxy, {Qt KNX Tunneling Classes}, diff --git a/src/knx/netip/qknxnetiptunnelingfeatureget.cpp b/src/knx/netip/qknxnetiptunnelingfeatureget.cpp index 7663dbd..33a61f5 100644 --- a/src/knx/netip/qknxnetiptunnelingfeatureget.cpp +++ b/src/knx/netip/qknxnetiptunnelingfeatureget.cpp @@ -58,6 +58,10 @@ QT_BEGIN_NAMESPACE If the tunneling server does not respond to the tunneling feature-get service frame the tunneling client may or may not repeat the request. + \note When using QKnxNetIpTunnelingFeatureGetProxy, care must be taken to + ensure that the referenced KNXnet/IP frame outlives the proxy on all code + paths, lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the tunneling feature-get information sent by a KNXnet/IP client: diff --git a/src/knx/netip/qknxnetiptunnelingfeatureinfo.cpp b/src/knx/netip/qknxnetiptunnelingfeatureinfo.cpp index a373e72..720e080 100644 --- a/src/knx/netip/qknxnetiptunnelingfeatureinfo.cpp +++ b/src/knx/netip/qknxnetiptunnelingfeatureinfo.cpp @@ -65,6 +65,10 @@ QT_BEGIN_NAMESPACE The tunneling server addresses the tunneling feature-info service frame to the data endpoint of the established tunneling connection. + \note When using QKnxNetIpTunnelingFeatureInfoProxy, care must be taken to + ensure that the referenced KNXnet/IP frame outlives the proxy on all code + paths, lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the tunneling feature-info service information sent by a KNXnet/IP server: diff --git a/src/knx/netip/qknxnetiptunnelingfeatureresponse.cpp b/src/knx/netip/qknxnetiptunnelingfeatureresponse.cpp index 5ca9a6c..05c3080 100644 --- a/src/knx/netip/qknxnetiptunnelingfeatureresponse.cpp +++ b/src/knx/netip/qknxnetiptunnelingfeatureresponse.cpp @@ -53,19 +53,23 @@ QT_BEGIN_NAMESPACE service used, the \l {QKnx::ReturnCode} {return code} in case of feature-set service, and the feature value as a byte array. + \note When using QKnxNetIpTunnelingFeatureResponseProxy, care must be taken + to ensure that the referenced KNXnet/IP frame outlives the proxy on all code + paths, lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the tunneling feature-response information sent by a KNXnet/IP server: \code auto netIpFrame = QKnxNetIpFrame::fromBytes(...); - const QKnxNetIpTunnelingFeatureResponseProxy response(netIpFrame); - if (!response.isValid()) + const QKnxNetIpTunnelingFeatureResponseProxy proxy(netIpFrame); + if (!proxy.isValid()) return; - auto id = response.featureIdentifier(); - auto returnCode = response.returnCode(); - auto value = response.featureValue(); + auto id = proxy.featureIdentifier(); + auto returnCode = proxy.returnCode(); + auto value = proxy.featureValue(); \endcode \sa builder(), QKnxNetIpTunnelingFeatureGetProxy, diff --git a/src/knx/netip/qknxnetiptunnelingfeatureset.cpp b/src/knx/netip/qknxnetiptunnelingfeatureset.cpp index 5537b40..e1da0da 100644 --- a/src/knx/netip/qknxnetiptunnelingfeatureset.cpp +++ b/src/knx/netip/qknxnetiptunnelingfeatureset.cpp @@ -61,6 +61,10 @@ QT_BEGIN_NAMESPACE tunneling server sends a tunneling feature-response frame. The frame contains the written value and a \l {QKnx::ReturnCode} {return code}. + \note When using QKnxNetIpTunnelingFeatureSetProxy, care must be taken to + ensure that the referenced KNXnet/IP frame outlives the proxy on all code + paths, lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the tunneling feature-set service information sent by a KNXnet/IP client: diff --git a/src/knx/netip/qknxnetiptunnelingrequest.cpp b/src/knx/netip/qknxnetiptunnelingrequest.cpp index 2721e4d..e25838b 100644 --- a/src/knx/netip/qknxnetiptunnelingrequest.cpp +++ b/src/knx/netip/qknxnetiptunnelingrequest.cpp @@ -65,19 +65,23 @@ QT_BEGIN_NAMESPACE \l QKnxNetIpServerDescriptionAgent and \l QKnxNetIpServerInfo to check that the server supports the requested connection type and options. + \note When using QKnxNetIpTunnelingRequestProxy, care must be taken to + ensure that the referenced KNXnet/IP frame outlives the proxy on all code + paths, lest the proxy ends up referencing deleted data. + The following code sample illustrates how to read the tunneling request information sent by a KNXnet/IP client: \code auto netIpFrame = QKnxNetIpFrame::fromBytes(...); - const QKnxNetIpTunnelingRequestProxy tunnelRequest(netIpFrame); - if (!tunnelRequest.isValid()) + const QKnxNetIpTunnelingRequestProxy proxy(netIpFrame); + if (!proxy.isValid()) return; - auto chanId = tunnelRequest.channelId(); - auto seqNum = tunnelRequest.sequenceNumber(); - auto knxLinkFrame = tunnelRequest.cemi(); + auto chanId = proxy.channelId(); + auto seqNum = proxy.sequenceNumber(); + auto knxLinkFrame = proxy.cemi(); \endcode \sa builder(), QKnxNetIpTunnelingAcknowledgeProxy, |