QKnxAddress Class

The QKnxAddress class represents a 16-bit KNX address value. 更多...

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

公共类型

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

公共函数

QKnxAddress (QKnxAddress::Type type , const QKnxByteArray & address )
QKnxAddress (QKnxAddress::Type type , const QString & address )
QKnxAddress (QKnxAddress::Type type , quint16 address )
QKnxAddress ()
QKnxByteArray bytes () const
bool isBroadcast () const
bool isCouplerOrRouter () const
bool isUnregistered () const
bool isValid () const
quint8 mainOrAreaSection () const
quint8 middleOrLineSection () const
quint8 size () const
quint16 subOrDeviceSection (QKnxAddress::Notation notation = Notation::ThreeLevel) const
QString toString (QKnxAddress::Notation notation = Notation::ThreeLevel) const
QKnxAddress::Type type () const
bool operator!= (const QKnxAddress & other ) const
bool operator== (const QKnxAddress & other ) const

静态公共成员

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

详细描述

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

成员类型文档编制

enum class QKnxAddress:: Notation

This enum describes the supported human-readable representation of KNX addresses.

常量 描述
QKnxAddress::Notation::TwoLevel 0x00 The visual representation will be main group and sub group, separated by a forward slash.
QKnxAddress::Notation::ThreeLevel 0x01 The 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.

注意: Only group addresses support 2-level notation.

enum class QKnxAddress:: Type

This enum describes the supported KNX address types.

常量 描述
QKnxAddress::Type::Group 0x01 A group address is a 2-byte value that does not need to be unique. A device may have more than one group address.
QKnxAddress::Type::Individual 0x00 An individual address is a 2-byte value that needs to be unique within a KNX installation.

成员函数文档编制

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

Creates a KNX address from the first two bytes of the address byte array. The type of the address is specified by type .

注意: The byte array must contain at least two elements.

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

Creates a KNX address from the string address representation. The type of the address is specified by type . Depending on the parsed sections, the formatting is set to 2 or 3-level notation.

A KNX address can be in one of the following formats:

  • 2-level notation, such as 1/2000 for group addresses .
  • 3-level notation, such as 1/1/1 for group addresses or 1.1.1 for individual addresses .
  • Number in the range 0 to 65535 without a separator for group and individual addresses.

注意: 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 .

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

注意: 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 , 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 . The formatting is set to 3-level notation.

QKnxAddress:: QKnxAddress ()

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

QKnxByteArray QKnxAddress:: bytes () const

Returns a KNX address as a range of bytes if the address is valid; otherwise the return value is empty. Only the first two bytes of the return value are part of the address.

[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 that of subGroup in the range 0 to 2047 .

[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 , that of middleGroup in the range 0 to 7 , and that of subGroup in the range 0 to 255 .

[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 , that of line in the range 0 to 15 , and that of sequentialNumber in the range 0 to 255 .

bool QKnxAddress:: isBroadcast () const

返回 true if this is a valid group address object and the address is set to 0x0000 ; false 否则。

bool QKnxAddress:: isCouplerOrRouter () const

返回 true if this is a valid individual address object and the device's sequential number is set to 0x00 ; false 否则。

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

返回 true if this is a valid individual address object and the device's sequential number is set to 0xff ; false 否则。

bool QKnxAddress:: isValid () const

返回 true if this is a valid KNX address object; false 否则。

quint8 QKnxAddress:: mainOrAreaSection () const

Depending on the type of the address, this function returns either the area component or the main component of the address.

该函数在 Qt 5.12 引入。

quint8 QKnxAddress:: middleOrLineSection () const

Depending on the type of the address, this function returns either the line component or the middle component of the address.

该函数在 Qt 5.12 引入。

quint8 QKnxAddress:: size () const

Returns the size of a KNX address.

quint16 QKnxAddress:: subOrDeviceSection ( QKnxAddress::Notation notation = Notation::ThreeLevel) const

Depending on the type and the given notation , this function returns either the device component or the sub component of the address.

注意: Individual addresses support only 3-level notation, whereas group addresses support 2-level or 3-level notation.

该函数在 Qt 5.12 引入。

QString QKnxAddress:: toString ( QKnxAddress::Notation notation = Notation::ThreeLevel) const

Returns the KNX address as a string formatted using the internal stored notation . An address of the type Group is formatted using a forward slash as a separator, while an address of the type Individual is formatted using a dot as separator.

注意: Individual addresses support only 3-level notation, whereas group addresses support 2-level or 3-level notation. If the address is invalid or 2-level notation is requested for individual addresses, an empty string is returned.

QKnxAddress::Type QKnxAddress:: type () const

Returns the address type.

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

返回 true if this object is not equal with other ;否则返回 false .

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

返回 true if this object is equal with other ;否则返回 false .

相关非成员

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

Writes the KNX address address debug stream.