#include <Bridge.h>

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

Classes

struct  Config
 

Public Types

using ConfigDelegate = Delegate< void(const Config &config)>
 Called when a new user key is created. More...
 
using StateChangeDelegate = Delegate< void(const Hue::Device &device, Hue::Device::Attributes attr)>
 A global callback may be provided to perform actions when device states change. More...
 

Public Member Functions

 Bridge (Hue::Device::Enumerator &devices)
 Constructor. More...
 
void configure (const Config &config)
 Perform a configuration action. More...
 
void enablePairing (bool enable)
 Enable creation of new users. More...
 
void onConfigChange (ConfigDelegate delegate)
 
void onStateChanged (StateChangeDelegate delegate)
 
void begin ()
 
const StatsgetStats ()
 Get bridge statistics. More...
 
void resetStats ()
 Clear the bridge statistics. More...
 
const UserMapgetUsers () const
 Access the list of users. More...
 
void getStatusInfo (JsonObject json)
 Get bridge status information in JSON format. More...
 
void deviceStateChanged (const Hue::Device &device, Hue::Device::Attributes changed)
 Devices call this method when their state has been updated. More...
 
String getField (Field desc) const override
 
bool formatMessage (SSDP::Message &msg, SSDP::MessageSpec &ms) override
 
bool onHttpRequest (HttpServerConnection &connection) override
 

Member Typedef Documentation

◆ ConfigDelegate

using Hue::Bridge::ConfigDelegate = Delegate<void(const Config& config)>

Called when a new user key is created.

The application should use this to store new users in persistent memory. At startup, these should be passed back via the configure() method.

◆ StateChangeDelegate

A global callback may be provided to perform actions when device states change.

Parameters
deviceThe device which has been updated
attrA set of flags indicating which attributes were changed

The callback is invoked only when all request actions have been completed. The current state may be quereied using device::getAttribute.

Constructor & Destructor Documentation

◆ Bridge()

Hue::Bridge::Bridge ( Hue::Device::Enumerator devices)
inline

Constructor.

Parameters
devicesList of devices to present

Member Function Documentation

◆ begin()

void Hue::Bridge::begin ( )

◆ configure()

void Hue::Bridge::configure ( const Config config)

Perform a configuration action.

Parameters
configThe action to perform

◆ deviceStateChanged()

void Hue::Bridge::deviceStateChanged ( const Hue::Device device,
Hue::Device::Attributes  changed 
)
inline

Devices call this method when their state has been updated.

Note
Applications should not call this method

◆ enablePairing()

void Hue::Bridge::enablePairing ( bool  enable)
inline

Enable creation of new users.

Note
DO NOT leave this permanently enabled!

This could be enabled via web page on local Access Point, or physical push-button. It should also be time limited, so exits pairing mode after maybe 30 seconds. If a user creation request is received then this is disabled automatically.

◆ formatMessage()

bool Hue::Bridge::formatMessage ( SSDP::Message &  msg,
SSDP::MessageSpec &  ms 
)
override

◆ getField()

String Hue::Bridge::getField ( Field  desc) const
override

◆ getStats()

const Stats& Hue::Bridge::getStats ( )
inline

Get bridge statistics.

Return values
constStats&

◆ getStatusInfo()

void Hue::Bridge::getStatusInfo ( JsonObject  json)

Get bridge status information in JSON format.

Parameters
jsonWhere to write information

◆ getUsers()

const UserMap& Hue::Bridge::getUsers ( ) const
inline

Access the list of users.

Return values
constUserMap&

◆ onConfigChange()

void Hue::Bridge::onConfigChange ( ConfigDelegate  delegate)
inline

◆ onHttpRequest()

bool Hue::Bridge::onHttpRequest ( HttpServerConnection connection)
override

◆ onStateChanged()

void Hue::Bridge::onStateChanged ( StateChangeDelegate  delegate)
inline

◆ resetStats()

void Hue::Bridge::resetStats ( )
inline

Clear the bridge statistics.


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