deCONZ C++ API v2.6.1
Loading...
Searching...
No Matches
deCONZ::ZclAttribute Class Reference

Represents a ZigBee cluster attribute. More...

#include <zcl.h>

Public Types

enum  FormatHint { DefaultFormat = 0 , Prefix , SliderFormat }
 Used to change the display format in the GUI. More...
 

Public Member Functions

 ZclAttribute ()
 Constructor.
 
 ZclAttribute (uint16_t id, uint8_t type, const QString &name, ZclAccess access, bool required)
 Constructor used by ZCLDB parser.
 
 ZclAttribute (ZclAttributeId_t id, ZclDataTypeId_t type, const QString &name, ZclAccess access, bool required)
 Strong typed constructor (preferred).
 
 ZclAttribute (const ZclAttribute &other)
 Copy constructor.
 
 ZclAttribute (ZclAttribute &&other) noexcept
 Move constructor.
 
ZclAttributeoperator= (const ZclAttribute &other)
 Copy assignment onstructor.
 
ZclAttributeoperator= (ZclAttribute &&other) noexcept
 Move assignment onstructor.
 
 ~ZclAttribute ()
 Deconstructor.
 
uint16_t id () const
 Returns the attribute identifier.
 
ZclAttributeId_t id_t () const
 Returns the strong typed attribute identifier.
 
const QString & description () const
 Returns the attribute description.
 
void setDescription (const QString &description)
 Sets the attribute description.
 
uint8_t dataType () const
 Returns the attribute data type which is a ZclDataTypeId value.
 
ZclDataTypeId_t dataType_t () const
 Returns the strong type attribute data type.
 
void setDataType (uint8_t type)
 Sets the attribute data type which is a ZclDataTypeId value.
 
const QString & name () const
 Returns the attribute name.
 
const NumericUnionnumericValue () const
 Returns the attribute numberic value.
 
void setNumericValue (const NumericUnion &value)
 Sets the attribute numberic value.
 
QString valueNameAt (int bitOrEnum) const
 Returns the name of a enumerator or bitmap bit.
 
QStringList valuesNames () const
 Returns all enumerator or bitmap bit names.
 
const std::vector< int > & valueNamePositions () const
 Returns a list of all known bits or enumerators.
 
void setValue (bool value)
 Sets the attribute bool value.
 
void setValue (quint64 value)
 Sets the attribute unsigned value (8..64-bit).
 
void setValue (qint64 value)
 Sets the attribute signed value (8..64-bit).
 
void setValue (const QVariant &value)
 Sets the attribute value (various formats).
 
int64_t lastRead () const
 Sets the time where the attribute was last read.
 
bool isReadonly () const
 Returns true if the attribute is read only.
 
bool isMandatory () const
 Returns true if the attribute is mandatory.
 
bool isAvailable () const
 Returns true if the attribute is available on the device.
 
void setAvailable (bool available)
 Sets the is available flag of the attribute.
 
uint8_t numericBase () const
 Returns the numeric base (for GUI display).
 
void setNumericBase (uint8_t base)
 Sets the numeric base (for GUI display).
 
uint enumerator () const
 Returns the current enumerator.
 
void setEnumerator (uint value)
 Sets the current enumerator.
 
void setBit (uint bit, bool one)
 Set/unset a bit in the bitmap.
 
bool bit (int bit) const
 Returns true if a bit is set where 0 < bit < bitCount()
 
int bitCount () const
 Returns the number of bits in the bitmap.
 
quint64 bitmap () const
 Returns the bitmap (8..64-bit)
 
void setBitmap (quint64 bmp)
 Sets the bitmap to bmp (8..64-bit)
 
int enumCount () const
 Returns the number of enum values.
 
quint8 enumerationId () const
 Returns the id of the enumeration.
 
void setEnumerationId (quint8 id)
 Sets the enumeration id.
 
bool writeToStream (QDataStream &stream) const
 Writes the attribute to stream.
 
bool readFromStream (QDataStream &stream)
 Reads the attribute from stream.
 
QString toString (FormatHint formatHint=DefaultFormat) const
 Returns the attribute as string representation.
 
QString toString (const deCONZ::ZclDataType &dataType, FormatHint formatHint=DefaultFormat) const
 Returns the attribute as string representation for given data type.
 
const QVariant & toVariant () const
 Returns the attribute as variant.
 
uint16_t minReportInterval () const
 Returns the minimum report interval.
 
void setMinReportInterval (uint16_t interval)
 Sets the minimum report interval.
 
uint16_t maxReportInterval () const
 Returns the maximum report interval.
 
void setMaxReportInterval (uint16_t interval)
 Sets the maximum report interval.
 
uint16_t reportTimeoutPeriod () const
 Returns the report timeout period.
 
void setReportTimeoutPeriod (uint16_t period)
 Sets the report timeout period.
 
const NumericUnionreportableChange () const
 Returns the reportable change as numeric value.
 
void setReportableChange (const NumericUnion &reportableChange)
 Sets the reportable change.
 
bool writeReportableChangeToStream (QDataStream &stream) const
 Writes the reportable change to stream TODO: describe.
 
bool readReportableChangeFromStream (QDataStream &stream)
 Reads the reportable change from stream TODO: describe.
 
void setFormatHint (FormatHint formatHint)
 Sets the format hint for GUI display.
 
FormatHint formatHint () const
 Returns the format hint for GUI display.
 
int rangeMin () const
 Return the minimum range.
 
void setRangeMin (int rangeMin)
 Sets the minimum range.
 
int rangeMax () const
 Return the maximum range.
 
void setRangeMax (int rangeMax)
 Sets the maximum range.
 
quint16 manufacturerCode () const
 Returns the manufacturer code (default: 0x0000 = not manufacturer specific).
 
ManufacturerCode_t manufacturerCode_t () const
 Returns the strong typed manufacturer code (preferred).
 
void setManufacturerCode (quint16 mfcode)
 Sets the manufacturer code.
 
void setManufacturerCode (ManufacturerCode_t mfcode)
 Sets the strong typed manufacturer code (preferred).
 
bool isManufacturerSpecific () const
 Returns true if attribute is manufacturer specific.
 

Friends

class ZclDataBase
 

Detailed Description

Represents a ZigBee cluster attribute.

Member Enumeration Documentation

◆ FormatHint

Used to change the display format in the GUI.

Enumerator
DefaultFormat 

Use the default format for a value.

Prefix 

Prepend prefix like 0x or 0b.

SliderFormat 

Present a numeric value as a slider.

Constructor & Destructor Documentation

◆ ZclAttribute()

deCONZ::ZclAttribute::ZclAttribute ( ZclAttributeId_t  id,
ZclDataTypeId_t  type,
const QString &  name,
ZclAccess  access,
bool  required 
)

Strong typed constructor (preferred).

Since
v2.6.1

Member Function Documentation

◆ dataType_t()

ZclDataTypeId_t deCONZ::ZclAttribute::dataType_t ( ) const

Returns the strong type attribute data type.

Since
v2.6.1

◆ id_t()

ZclAttributeId_t deCONZ::ZclAttribute::id_t ( ) const

Returns the strong typed attribute identifier.

Since
v2.6.1

◆ lastRead()

int64_t deCONZ::ZclAttribute::lastRead ( ) const

Sets the time where the attribute was last read.

Returns the last read time.

◆ manufacturerCode_t()

ManufacturerCode_t deCONZ::ZclAttribute::manufacturerCode_t ( ) const

Returns the strong typed manufacturer code (preferred).

Since
v2.6.1

◆ setManufacturerCode()

void deCONZ::ZclAttribute::setManufacturerCode ( ManufacturerCode_t  mfcode)

Sets the strong typed manufacturer code (preferred).

Since
v2.6.1

◆ valueNameAt()

QString deCONZ::ZclAttribute::valueNameAt ( int  bitOrEnum) const

Returns the name of a enumerator or bitmap bit.

There: 0 < bitOrEnum < bitCount() or bitOrEnum is a known enumerator

If bitOrEnum is unknown QString() will be returned.

◆ writeReportableChangeToStream()

bool deCONZ::ZclAttribute::writeReportableChangeToStream ( QDataStream &  stream) const

Writes the reportable change to stream TODO: describe.

Writes the reportable change in the specifications format to the stream.

Returns
true if the data was written false if the type is not supported or the data is not valid.

◆ writeToStream()

bool deCONZ::ZclAttribute::writeToStream ( QDataStream &  stream) const

Writes the attribute to stream.

Writes the attribute in the specifications format to the stream.

Returns
true if the attribute was written false if the type is not supported or the attribute is not valid.

The documentation for this class was generated from the following files: