QKnxAddress Class

The QKnxAddress class represents a 16 bit KNX address value. More...

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

Public Types

class Group
class Individual
enum Notation { TwoLevel, ThreeLevel }
enum Type { Group, Individual }

Public Functions

QKnxAddress() = default
QKnxAddress(QKnxAddress::Type type, quint16 address)
QKnxAddress(QKnxAddress::Type type, const QString &address)
QKnxAddress(QKnxAddress::Type type, const QByteArray &address)
QKnxAddress(QKnxAddress::Type type, const QVector<quint8> &address)
bool isBroadcast() const
bool isCouplerOrRouter() const
bool isUnregistered() const
bool isValid() const
quint8 size() const
QKnxAddress::Type type() const
bool operator!=(const QKnxAddress &other) const
bool operator==(const QKnxAddress &other) const

Static Public Members

QKnxAddress createGroup(quint8 mainGroup, quint16 subGroup)
QKnxAddress createGroup(quint8 mainGroup, quint16 middleGroup, quint8 subGroup)
QKnxAddress createIndividual(quint8 area, quint16 line, quint8 sequentialNumber)
QKnxAddress Broadcast
QKnxAddress Unregistered
QDebug operator<<(QDebug debug, const QKnxAddress &address)
QDataStream &operator<<(QDataStream &out, const QKnxAddress &address)

Detailed Description

The QKnxAddress class represents a 16 bit KNX address value.

KNX is a fully distributed network, which accommodates up to 65,536 devices in a 16-bit individual address space. Concrete address types are Group and Individual.

Member Type Documentation

enum QKnxAddress::Notation

This enum describes the supported KNX address human-readable representation.

ConstantValueDescription
QKnxAddress::TwoLevel0x00The visual representation will be main group and sub group, separated by a forward slash.
QKnxAddress::ThreeLevel0x01The visual representation for Group addresses will be main, middle, and sub group separated by a forward slash, while Individual addresses will be formatted as area, line, and sequential number, separated by a dot.

Note: Only Group addresses support 2-level notation as of now.

enum QKnxAddress::Type

This enum describes the supported KNX address types.

ConstantValueDescription
QKnxAddress::Group0x01The Group address shall be a 2-byte value and does not need to be unique. A device may have more than one Group address.
QKnxAddress::Individual0x00The Individual address shall be a 2-byte value and needs to be unique within a KNX installation.

Member Function Documentation

[default] QKnxAddress::QKnxAddress()

Constructs an new, invalid KNX address object. The formatting is set to 3-level notation.

QKnxAddress::QKnxAddress(QKnxAddress::Type type, quint16 address)

Creates a KNX address from a 16-bit address value. The type of the address is specified by type. The value of address should be in the range 0 to 65535. Hexadecimal, octal, and decimal notation are supported. The formatting is set to 3-level notation.

QKnxAddress::QKnxAddress(QKnxAddress::Type type, const QString &address)

Creates a KNX address from a string address representation. The type of the address is specified by type. Depending on parsed sections, the formatting is set to 2 or 3-level notation. If the address or parts begin with "0x", hexadecimal notation is assumed; if the address begins with "0", octal notation is assumed; otherwise decimal notation.

QKnxAddress can be in one of the following formats:

  • 2-level notation, like 1/2000, for Group addresses.
  • 3-level notation, like 1/1/1 for Group or 1.1.1 for Individual addresses.
  • Number in the range 0 to 65535 without separator for Group and Individual addresses.

Note: For Group address 2-level notation, the value of the main group should be in the range 0 to 31 and the sub group value in the range 0 to 2047.

Note: For Group address 3-level notation, the value of the main group should be in the range 0 to 31, the value of middle group in the range 0 to 7, and the sub group value in the range 0 to 255.

Note: For Individual address 3-level notation, the value of area should be in the range 0 to 15, the value of line in the range 0 to 15, and the sequential number value in the range 0 to 255.

QKnxAddress::QKnxAddress(QKnxAddress::Type type, const QByteArray &address)

Creates a KNX address from the first two bytes of the address byte array. The type of the address is specified by type. Hexadecimal, octal, and decimal notation are supported.

Note: The byte array must contain at least two elements.

QKnxAddress::QKnxAddress(QKnxAddress::Type type, const QVector<quint8> &address)

Creates a KNX address from the first two bytes of the address vector. The type of the address is specified by type. Hexadecimal, octal, and decimal notation are supported.

Note: The vector must contain at least two elements.

[static] QKnxAddress QKnxAddress::createGroup(quint8 mainGroup, quint16 subGroup)

Creates a KNX Group address from the 2-level notation. The value of mainGroup should be in the range 0 to 31 and the subGroup value in the range 0 to 2047. Hexadecimal, octal, and decimal notation are supported.

[static] QKnxAddress QKnxAddress::createGroup(quint8 mainGroup, quint16 middleGroup, quint8 subGroup)

Creates a KNX Group address from the 3-level notation. The value of mainGroup should be in the range 0 to 31, the value of middleGroup in the range 0 to 7, and the subGroup value in the range 0 to 255. Hexadecimal, octal, and decimal notation are supported.

[static] QKnxAddress QKnxAddress::createIndividual(quint8 area, quint16 line, quint8 sequentialNumber)

Creates a KNX Individual address from the 3-level notation. The value of area should be in the range 0 to 15, the value of line in the range 0 to 15, and the sequentialNumber value in the range 0 to 255. Hexadecimal, octal, and decimal notation are supported.

bool QKnxAddress::isBroadcast() const

Returns true if this is a valid Group KNX address object and the address is set to 0x0000; false otherwise.

bool QKnxAddress::isCouplerOrRouter() const

Returns true if this is a valid Individual KNX address object and the device's sequential number is set to 0x00; false otherwise.

Area and line couplers, as well as KNXnet/IP routers (routing) are given the sequential number 0x00.

For example, the individual address 1.5.0 identifies a KNXnet/IP router acting as a line coupler that couples the fifth line with the main line in the first area.

bool QKnxAddress::isUnregistered() const

Returns true if this is a valid Individual KNX address object and the device's sequential number is set to 0xff; false otherwise.

bool QKnxAddress::isValid() const

Returns true if this is a valid KNX address object; false otherwise.

quint8 QKnxAddress::size() const

QKnxAddress::Type QKnxAddress::type() const

Returns the address type.

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

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

Related Non-Members

QKnxAddress Group::Broadcast

Represents a single KNX Group address with the value 0x0000 that is reserved for the broadcast address that shall be exclusively used in broadcast communication mode.

QKnxAddress Individual::Unregistered

Represents a single KNX Individual address with the value 0xffff.

QDebug operator<<(QDebug debug, const QKnxAddress &address)

Writes the KNX address address to the debug stream.

QDataStream &operator<<(QDataStream &out, const QKnxAddress &address)

Writes the KNX address address to the stream out and returns a reference to the stream.

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