#include <hueplusplus/Bridge.h>
|
static std::string | normalizeMac (std::string input) |
| Normalizes mac address to plain hex number.
|
|
Class to find all Hue bridges on the network and create usernames for them.
- Examples
- BridgeSetup.cpp, LightsOff.cpp, and UsernameConfig.cpp.
◆ BridgeFinder()
hueplusplus::BridgeFinder::BridgeFinder |
( |
std::shared_ptr< const IHttpHandler > |
handler | ) |
|
◆ addClientKey()
void hueplusplus::BridgeFinder::addClientKey |
( |
const std::string & |
mac, |
|
|
const std::string & |
clientkey |
|
) |
| |
Function that adds a client key to the clientkeys map.
The client key is only needed for entertainment mode, otherwise it is optional.
- Parameters
-
mac | MAC address of Hue bridge |
clientkey | Client key that is used to control the Hue bridge in entertainment mode |
◆ addUsername()
void hueplusplus::BridgeFinder::addUsername |
( |
const std::string & |
mac, |
|
|
const std::string & |
username |
|
) |
| |
Function that adds a username to the usernames map.
- Parameters
-
mac | MAC address of Hue bridge |
username | Username that is used to control the Hue bridge |
- Examples
- BridgeSetup.cpp, and LightsOff.cpp.
◆ findBridges()
Finds all bridges in the network and returns them.
The user should be given the opportunity to select the correct one based on the mac address.
- Returns
- vector containing ip and mac of all found bridges
- Exceptions
-
std::system_error | when system or socket operations fail |
HueException | when response contained no body |
- Examples
- BridgeSetup.cpp, and LightsOff.cpp.
◆ getAllUsernames()
const std::map< std::string, std::string > & hueplusplus::BridgeFinder::getAllUsernames |
( |
| ) |
const |
Function that returns a map of mac addresses and usernames.
Note these should be saved at the end and re-loaded with addUsername next time, so only one username is generated per bridge.
- Returns
- A map mapping mac address to username for every bridge
◆ getBridge()
Gets a Hue bridge based on its identification.
- Parameters
-
identification | BridgeIdentification that specifies a bridge |
sharedState | Uses a single, shared cache for all objects on the bridge. |
- Returns
- Bridge class object
- Exceptions
-
std::system_error | when system or socket operations fail |
HueException | when response contained no body or username could not be requested |
HueAPIResponseException | when response contains an error |
nlohmann::json::parse_error | when response could not be parsed |
- Examples
- BridgeSetup.cpp, and LightsOff.cpp.
◆ normalizeMac()
std::string hueplusplus::BridgeFinder::normalizeMac |
( |
std::string |
input | ) |
|
|
static |
Normalizes mac address to plain hex number.
- Returns
input
without separators and whitespace, in lower case.
The documentation for this class was generated from the following files: