QKnxGroupAddressInfos Class

The QKnxGroupAddressInfos class provides access to information about group addresses used inside a KNX project. More...

Header: #include <QKnxGroupAddressInfos>
qmake: QT += knx

Public Types

enum class Status { NoError, FileError, ProjectError, ParseError }

Public Functions

QKnxGroupAddressInfos(QKnxGroupAddressInfos &&other)
QKnxGroupAddressInfos(const QKnxGroupAddressInfos &other)
QKnxGroupAddressInfos(const QString &projectFile)
QKnxGroupAddressInfos()
QKnxGroupAddressInfos &operator=(QKnxGroupAddressInfos &&other)
QKnxGroupAddressInfos &operator=(const QKnxGroupAddressInfos &other)
~QKnxGroupAddressInfos()
void add(const QKnxGroupAddressInfo &info, const QString &projectId)
void add(const QString &name, const QKnxAddress &address, QKnxDatapointType::Type type, const QString &description, const QString &projectId, const QString &installation = {})
void add(const QString &name, const QKnxAddress &address, const QString &datapointType, const QString &description, const QString &projectId, const QString &installation = {})
QVector<QKnxGroupAddressInfo> addressInfos(const QString &projectId, const QString &installation = {}) const
QVector<QKnxGroupAddressInfo> addressInfos(const QKnxAddress &address, const QString &projectId, const QString &installation = {}) const
QVector<QKnxGroupAddressInfo> addressInfos(QKnxDatapointType::Type type, const QString &projectId, const QString &installation = {}) const
void clear()
QString errorString() const
qint32 infoCount(const QString &projectId, const QString &installation = {}) const
QVector<QString> installations(const QString &projectId) const
bool parse()
QString projectFile() const
QVector<QString> projectIds() const
QString projectName(const QString &projectId) const
void remove(const QKnxAddress &address, const QString &projectId, const QString &installation = {})
void remove(const QKnxGroupAddressInfo &info, const QString &projectId)
void setProjectFile(const QString &projectFile)
QKnxGroupAddressInfos::Status status() const
void swap(QKnxGroupAddressInfos &other)
bool operator!=(const QKnxGroupAddressInfos &other) const
bool operator==(const QKnxGroupAddressInfos &other) const
QDebug operator<<(QDebug debug, const QKnxGroupAddressInfos &infos)

Detailed Description

This class parses the KNX project information specified via the setProjectFile() method and provides access to the information defined within the file through an API. You can:

  • Get information about existing project IDs and, if available, the corresponding project names.
  • Get the installations used inside a given project.
  • Get information about the number of group addresses used throughout an installation inside a given KNX project.
  • Fetch and set group address information for an installation associated with a KNX project.

Member Type Documentation

enum class QKnxGroupAddressInfos::Status

This enum holds the status of parsing the KNX project information.

ConstantValue
QKnxGroupAddressInfos::Status::NoError0
QKnxGroupAddressInfos::Status::FileError1
QKnxGroupAddressInfos::Status::ProjectError2
QKnxGroupAddressInfos::Status::ParseError3

See also parse().

Member Function Documentation

QKnxGroupAddressInfos::QKnxGroupAddressInfos(QKnxGroupAddressInfos &&other)

Move-constructs an object instance, making it point to the same object that other was pointing to.

QKnxGroupAddressInfos::QKnxGroupAddressInfos(const QKnxGroupAddressInfos &other)

Constructs a copy of other.

QKnxGroupAddressInfos::QKnxGroupAddressInfos(const QString &projectFile)

Creates a new empty group address infos object and sets the current project file to projectFile. Creating the object does not automatically trigger parsing the given projectFile.

The function argument can be either a valid KNX 0.xml or a .knxproj project file.

See also parse().

QKnxGroupAddressInfos::QKnxGroupAddressInfos()

Creates a new empty group address infos object.

QKnxGroupAddressInfos &QKnxGroupAddressInfos::operator=(QKnxGroupAddressInfos &&other)

Move-assigns other to this object instance.

QKnxGroupAddressInfos &QKnxGroupAddressInfos::operator=(const QKnxGroupAddressInfos &other)

Assigns the specified other to this object.

QKnxGroupAddressInfos::~QKnxGroupAddressInfos()

Destroys the object and frees any allocated resources.

void QKnxGroupAddressInfos::add(const QKnxGroupAddressInfo &info, const QString &projectId)

Adds a group address info object of a KNX project identified by projectId. The group address info QKnxGroupAddressInfo::installation ID is used to associate the group address info with an existing KNX project.

Note: The value of projectId must not be empty.

Note: The function does not prevent multiple identical entries.

void QKnxGroupAddressInfos::add(const QString &name, const QKnxAddress &address, QKnxDatapointType::Type type, const QString &description, const QString &projectId, const QString &installation = {})

Creates a group address info object with values set to name, address, type, description and installation. The created object is associated with the given KNX projectId ID, and installation.

Note: The value of projectId must not be empty.

Note: The function does not prevent multiple identical entries.

void QKnxGroupAddressInfos::add(const QString &name, const QKnxAddress &address, const QString &datapointType, const QString &description, const QString &projectId, const QString &installation = {})

Creates a group address info object with values set to name, address, datapointType, description and installation. The created object is associated with the given KNX projectId ID, and installation.

Note: The value of projectId must not be empty.

Note: The function does not prevent multiple identical entries.

QVector<QKnxGroupAddressInfo> QKnxGroupAddressInfos::addressInfos(const QString &projectId, const QString &installation = {}) const

Returns a vector of all available group address infos from a KNX project identified by projectId and installation.

QVector<QKnxGroupAddressInfo> QKnxGroupAddressInfos::addressInfos(const QKnxAddress &address, const QString &projectId, const QString &installation = {}) const

Returns a vector of all available group address infos from a KNX project identified by address, projectId, and installation.

QVector<QKnxGroupAddressInfo> QKnxGroupAddressInfos::addressInfos(QKnxDatapointType::Type type, const QString &projectId, const QString &installation = {}) const

Returns a vector of all available group address infos from a KNX project identified by datapoint type, projectId and installation.

void QKnxGroupAddressInfos::clear()

Clears all existing information including the KNX project file name.

QString QKnxGroupAddressInfos::errorString() const

Returns the human-readable message appropriate to the reported read status.

qint32 QKnxGroupAddressInfos::infoCount(const QString &projectId, const QString &installation = {}) const

Returns the number of group address info objects contained in this class; identified by projectId and installation.

QVector<QString> QKnxGroupAddressInfos::installations(const QString &projectId) const

Returns a vector of all installation ids for the given KNX projectId ID.

bool QKnxGroupAddressInfos::parse()

Clears all existing information and parses the KNX project file.

Returns true if parsing was successful; otherwise returns false. If an error occurs, sets the Status, and fills the errorString().

QString QKnxGroupAddressInfos::projectFile() const

Returns the current project file from where the group address information was collected.

See also setProjectFile().

QVector<QString> QKnxGroupAddressInfos::projectIds() const

Returns a vector of all KNX project ids found in the KNX project file.

QString QKnxGroupAddressInfos::projectName(const QString &projectId) const

Returns the project name associated with the given KNX projectId ID. Since the project name is an optional field in a KNX project, it can be empty.

void QKnxGroupAddressInfos::remove(const QKnxAddress &address, const QString &projectId, const QString &installation = {})

Removes all the group address info objects from a KNX project identified by projectId and installation ID and with the same KNX group address.

Note: The value of projectId must not be empty.

void QKnxGroupAddressInfos::remove(const QKnxGroupAddressInfo &info, const QString &projectId)

Removes all the objects equal to group address info from a KNX project identified by projectId. The group address info QKnxGroupAddressInfo::installation ID is used to associate the group address info with an existing KNX project.

Note: The value of projectId must not be empty.

void QKnxGroupAddressInfos::setProjectFile(const QString &projectFile)

Sets the current project file to projectFile and clears all existing information. Calling this function does not automatically trigger parsing the given projectFile.

The function argument can be either a valid KNX 0.xml or a .knxproj project file.

See also projectFile() and parse().

QKnxGroupAddressInfos::Status QKnxGroupAddressInfos::status() const

Returns the read status of the current KNX project file.

void QKnxGroupAddressInfos::swap(QKnxGroupAddressInfos &other)

Swaps other with this object. This operation is very fast and never fails.

bool QKnxGroupAddressInfos::operator!=(const QKnxGroupAddressInfos &other) const

Returns true if this object and the given other are not equal; otherwise returns false.

bool QKnxGroupAddressInfos::operator==(const QKnxGroupAddressInfos &other) const

Returns true if this object and the given other are equal; otherwise returns false.

Related Non-Members

QDebug operator<<(QDebug debug, const QKnxGroupAddressInfos &infos)

Writes the infos object to the debug stream and returns a reference to the stream.

© 2023 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.