deCONZ C++ API v2.6.1
|
Strong typed Zigbee types like cluster and attribute identifiers. More...
Classes | |
class | deCONZ::ZclDataTypeId_t |
A strong typed ZCL data type identifier. More... | |
class | deCONZ::ZclCommandId_t |
A strong typed ZCL command identifier. More... | |
class | deCONZ::ZclAttributeId_t |
A strong typed ZCL attribute identifier. More... | |
class | deCONZ::ManufacturerCode_t |
A strong typed Zigbee manufacturer code. More... | |
class | deCONZ::ZclClusterId_t |
A strong typed ZCL cluster identifier. More... | |
Strong typed Zigbee types like cluster and attribute identifiers.
These types should be used instead plain C++ types like quint8
, quint16
, quint32
, etc. They prevent a common class of errors and provide safety at compile time.
Consider the following function:
The function can be called in various ways without the compiler complaining if something is wrong.
Here is the same function but using strong types arguments.
Using strong typed values improves the readability and guards against common bugs at compile time.
Albeit the declaration of these classes looks rather complex, the compiled code is equal to the weakly typed version. Therefore there is zero runtime overhead by using these types.