Hue::Device Class Referenceabstract

#include <Device.h>

Inheritance diagram for Hue::Device:
[legend]
Collaboration diagram for Hue::Device:
[legend]

Classes

class  Enumerator
 Abstract class to manage a list of devices. More...
 

Public Types

enum  Attribute { Attribute::XX }
 
enum  ColorMode { ColorMode::XX }
 
using ID = uint32_t
 
using Attributes = BitSet< uint8_t, Attribute >
 
using Callback = Delegate< void(Status status, int errorCode)>
 Callback invoked when setAttribute() has completed. More...
 

Public Member Functions

virtual ~Device ()
 
virtual ID getId () const =0
 
virtual String getName () const =0
 
virtual Status setAttribute (Attribute attr, unsigned value, Callback callback)=0
 Set a device attribute. More...
 
virtual bool getAttribute (Attribute attr, unsigned &value) const =0
 Get the (cached) device attribute value. More...
 
virtual String getUniqueId () const
 Returns the unique device ID string. More...
 
virtual ColorMode getColorMode () const
 
virtual void getInfo (JsonObject json)
 
bool operator== (const Device &dev) const
 Two devices are considered equal if they have the same ID. More...
 
bool operator== (const String &name) const
 
bool operator== (ID id) const
 

Member Typedef Documentation

◆ Attributes

◆ Callback

using Hue::Device::Callback = Delegate<void(Status status, int errorCode)>

Callback invoked when setAttribute() has completed.

Parameters
statusResult of the operation
errorCodeApplication-specific error code
Note
Any status other than success is considered a failure

◆ ID

using Hue::Device::ID = uint32_t

Member Enumeration Documentation

◆ Attribute

Enumerator
XX 

◆ ColorMode

Enumerator
XX 

Constructor & Destructor Documentation

◆ ~Device()

virtual Hue::Device::~Device ( )
inlinevirtual

Member Function Documentation

◆ getAttribute()

virtual bool Hue::Device::getAttribute ( Attribute  attr,
unsigned &  value 
) const
pure virtual

Get the (cached) device attribute value.

Parameters
attr
value
Return values
booltrue on success, false if attribute not supported or value unknown

Implemented in Hue::OnOffDevice, Hue::ColourDevice, and Hue::DimmableDevice.

◆ getColorMode()

virtual ColorMode Hue::Device::getColorMode ( ) const
inlinevirtual

◆ getId()

virtual ID Hue::Device::getId ( ) const
pure virtual

Implemented in Hue::OnOffDevice.

◆ getInfo()

virtual void Hue::Device::getInfo ( JsonObject  json)
virtual

◆ getName()

virtual String Hue::Device::getName ( ) const
pure virtual

Implemented in Hue::OnOffDevice.

◆ getUniqueId()

virtual String Hue::Device::getUniqueId ( ) const
virtual

Returns the unique device ID string.

Return values
StringUnique ID of the form AA:BB:CC:DD:EE:FF:00:11-XX, consisting of a 64-bit Zigbee MAC address plus unique endpoint ID.
Note
Other forms of ID string may be used, however for maximum compatibility the standard format should be used. By default, this method uses the WiFi station MAC address, with 00:11 appended plus the 8-bit device ID.

◆ operator==() [1/3]

bool Hue::Device::operator== ( const Device dev) const
inline

Two devices are considered equal if they have the same ID.

◆ operator==() [2/3]

bool Hue::Device::operator== ( const String name) const
inline

◆ operator==() [3/3]

bool Hue::Device::operator== ( ID  id) const
inline

◆ setAttribute()

virtual Status Hue::Device::setAttribute ( Attribute  attr,
unsigned  value,
Callback  callback 
)
pure virtual

Set a device attribute.

Parameters
attrThe attribute to change
valueValue for the attribute (exact type is attribute-specific)
callbackIf you return Status::pending, invoke this callback when completed
Return values
Status
Note
DO NOT invoke the callback directly: only use it if pended.

Implemented in Hue::OnOffDevice, Hue::ColourDevice, and Hue::DimmableDevice.


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