hueplusplus  1.0.0
Public Member Functions | Protected Member Functions | List of all members
hueplusplus::BridgeConfig Class Reference

General bridge configuration properties. More...

#include <hueplusplus/BridgeConfig.h>

+ Inheritance diagram for hueplusplus::BridgeConfig:

Public Member Functions

 BridgeConfig (std::shared_ptr< APICache > baseCache, std::chrono::steady_clock::duration refreshDuration)
 Construct BridgeConfig. More...
 
void refresh (bool force=false)
 Refreshes internal cached state. More...
 
void setRefreshDuration (std::chrono::steady_clock::duration refreshDuration)
 Sets custom refresh interval for the config. More...
 
std::vector< WhitelistedUsergetWhitelistedUsers () const
 Get the list of whitelisted users. More...
 
void removeUser (const std::string &userKey)
 Remove user from the whitelist. More...
 
bool getLinkButton () const
 Get link button state. More...
 
void pressLinkButton ()
 Set the link button state to pressed. More...
 
void touchLink ()
 Add the closest lamp to the network. More...
 
std::string getMACAddress () const
 Get bridge MAC address. More...
 
time::AbsoluteTime getUTCTime () const
 Get current (of last refresh) UTC time of the bridge. More...
 
std::string getTimezone () const
 Get configured timezone for the bridge. More...
 

Protected Member Functions

 BridgeConfig (const BridgeConfig &)=default
 
 BridgeConfig (BridgeConfig &&)=default
 
BridgeConfigoperator= (const BridgeConfig &)=default
 
BridgeConfigoperator= (BridgeConfig &&)=default
 

Detailed Description

General bridge configuration properties.

Constructor & Destructor Documentation

◆ BridgeConfig() [1/3]

hueplusplus::BridgeConfig::BridgeConfig ( std::shared_ptr< APICache baseCache,
std::chrono::steady_clock::duration  refreshDuration 
)

Construct BridgeConfig.

◆ BridgeConfig() [2/3]

hueplusplus::BridgeConfig::BridgeConfig ( const BridgeConfig )
protecteddefault

◆ BridgeConfig() [3/3]

hueplusplus::BridgeConfig::BridgeConfig ( BridgeConfig &&  )
protecteddefault

Member Function Documentation

◆ getLinkButton()

bool hueplusplus::BridgeConfig::getLinkButton ( ) const

Get link button state.

Returns
true when link button was pressed in the last 30 seconds.

Indicates whether new users can be added currently.

◆ getMACAddress()

std::string hueplusplus::BridgeConfig::getMACAddress ( ) const

Get bridge MAC address.

◆ getTimezone()

std::string hueplusplus::BridgeConfig::getTimezone ( ) const

Get configured timezone for the bridge.

Note
For times not in UTC, the timezone of the program and the bridge are assumed to be identical.

◆ getUTCTime()

time::AbsoluteTime hueplusplus::BridgeConfig::getUTCTime ( ) const

Get current (of last refresh) UTC time of the bridge.

◆ getWhitelistedUsers()

std::vector< WhitelistedUser > hueplusplus::BridgeConfig::getWhitelistedUsers ( ) const

Get the list of whitelisted users.

Returns
All users authorized for API access

◆ operator=() [1/2]

BridgeConfig& hueplusplus::BridgeConfig::operator= ( const BridgeConfig )
protecteddefault

◆ operator=() [2/2]

BridgeConfig& hueplusplus::BridgeConfig::operator= ( BridgeConfig &&  )
protecteddefault

◆ pressLinkButton()

void hueplusplus::BridgeConfig::pressLinkButton ( )

Set the link button state to pressed.

◆ refresh()

void hueplusplus::BridgeConfig::refresh ( bool  force = false)

Refreshes internal cached state.

Parameters
forcetrue forces a refresh, regardless of how long the last refresh was ago. false to only refresh when enough time has passed (needed e.g. when calling only const methods).
Exceptions
std::system_errorwhen system or socket operations fail
HueExceptionwhen response contained no body
HueAPIResponseExceptionwhen response contains an error
nlohmann::json::parse_errorwhen response could not be parsed

◆ removeUser()

void hueplusplus::BridgeConfig::removeUser ( const std::string &  userKey)

Remove user from the whitelist.

Parameters
userKeyThe API username of the user to remove
Exceptions
std::system_errorwhen system or socket operations fail
HueExceptionwhen response contained no body
HueAPIResponseExceptionwhen response contains an error
nlohmann::json::parse_errorwhen response could not be parsed

◆ setRefreshDuration()

void hueplusplus::BridgeConfig::setRefreshDuration ( std::chrono::steady_clock::duration  refreshDuration)

Sets custom refresh interval for the config.

Parameters
refreshDurationThe new minimum duration between refreshes. May be 0 or c_refreshNever.

◆ touchLink()

void hueplusplus::BridgeConfig::touchLink ( )

Add the closest lamp to the network.


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