PropertyWriteBuilder Class

class QKnxDeviceManagementFrame::PropertyWriteBuilder

The QKnxDeviceManagementFrame::PropertyWriteBuilder class provides the means to create valid device management property write service frames. More...

Public Functions

QKnxDeviceManagementFrame createConfirmation(const QKnxDeviceManagementFrame &request = {}) const
QKnxDeviceManagementFrame createNegativeConfirmation(QKnxNetIpCemiServer::Error error, const QKnxDeviceManagementFrame &request = {}) const
QKnxDeviceManagementFrame createRequest(const QKnxByteArray &data) const
PropertyWriteBuilder &setNumberOfElements(quint8 noe)
PropertyWriteBuilder &setObjectInstance(quint8 instance)
PropertyWriteBuilder &setObjectType(QKnxInterfaceObjectType type)
PropertyWriteBuilder &setProperty(QKnxInterfaceObjectProperty pid)
PropertyWriteBuilder &setStartIndex(quint16 startIndex)

Detailed Description

The property write service is used by a common external message interface (cEMI) client to send a property write request frame, M_PropWrite.req. It must be followed by a property write confirmation frame, M_PropWrite.con. The confirmation indicates whether the request was successful.

See also QKnxDeviceManagementFrame::MessageCode, QKnxDeviceManagementFrame, and Qt KNX Device Management Classes.

Member Function Documentation

QKnxDeviceManagementFrame PropertyWriteBuilder::createConfirmation(const QKnxDeviceManagementFrame &request = {}) const

Creates a and returns a device management property write confirmation frame.

The available default argument request can be used to fill some of the returned frame fields instead of using the setter functions provided.

The common way to create such a request is:

void MyCemiServer::slotFrameReceived(const QKnxDeviceManagementFrame &request)
{
    if (request.messageCode() != QKnxDeviceManagementFrame::MessageCode::PropertyWriteRequest)
        return;

    // execute the write operation

    auto confirmation = QKnxDeviceManagementFrame::propertyWriteBuilder()
        .createConfirmation(request);
    deviceManagement.sendFrame(confirmation);
}

Note: The returned frame may be invalid depending on the values used during setup.

See also QKnxDeviceManagementFrame and QKnxDeviceManagementFrame::isValid().

QKnxDeviceManagementFrame PropertyWriteBuilder::createNegativeConfirmation(QKnxNetIpCemiServer::Error error, const QKnxDeviceManagementFrame &request = {}) const

Creates and returns a negative device management property write confirmation frame.

The available default argument request can be used to fill some of the returned frame fields instead of using the setter functions provided.

The number of elements of a negative response is set to zero and the start index needs to be set to the value received with the request.

The error field of a negative response contains information about the error as a QKnx::NetIp::CemiServer::Error value.

The common way to create such a confirmation is:

void MyCemiServer::slotFrameReceived(const QKnxDeviceManagementFrame &request)
{
    if (request.messageCode() != QKnxDeviceManagementFrame::MessageCode::PropertyWriteRequest)
        return;

    bool readOnly = ... // check if the property is read only
    if (readOnly) {
        auto confirmation = QKnxDeviceManagementFrame::propertyWriteBuilder()
            .createNegativeConfirmation(QKnxNetIpCemiServer::Error::ReadOnly, request);
        deviceManagement.sendFrame(confirmation);
    }
}

Note: The returned frame may be invalid depending on the values used during setup.

See also QKnxDeviceManagementFrame and QKnxDeviceManagementFrame::isValid().

QKnxDeviceManagementFrame PropertyWriteBuilder::createRequest(const QKnxByteArray &data) const

Creates a and returns a device management property write request frame with the data field set to data.

The common way to create such a request is:

auto data = ...
auto request = QKnxDeviceManagementFrame::propertyWriteBuilder()
    .setObjectType(...)
    .setObjectInstance(...)
    .setProperty(...)
    .setNumberOfElements(...)
    .setStartIndex(...)
    .createRequest(data)
deviceManagement.sendFrame(request);

Note: The returned frame may be invalid depending on the values used during setup.

See also QKnxDeviceManagementFrame and QKnxDeviceManagementFrame::isValid().

PropertyWriteBuilder &PropertyWriteBuilder::setNumberOfElements(quint8 noe)

Sets the number of elements of this builder to noe and returns a reference to the builder.

PropertyWriteBuilder &PropertyWriteBuilder::setObjectInstance(quint8 instance)

Sets the object instance of this builder to instance and returns a reference to the builder.

PropertyWriteBuilder &PropertyWriteBuilder::setObjectType(QKnxInterfaceObjectType type)

Sets the interface object type of this builder to type and returns a reference to the builder.

PropertyWriteBuilder &PropertyWriteBuilder::setProperty(QKnxInterfaceObjectProperty pid)

Sets the interface object property of this builder to pid and returns a reference to the builder.

PropertyWriteBuilder &PropertyWriteBuilder::setStartIndex(quint16 startIndex)

Sets the start index of this builder to startIndex and returns a reference to the builder.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.