hueplusplus
1.0.0
|
#include <hueplusplus/Bridge.h>
Classes | |
struct | BridgeIdentification |
Public Member Functions | |
BridgeFinder (std::shared_ptr< const IHttpHandler > handler) | |
Constructor of BridgeFinder class. More... | |
std::vector< BridgeIdentification > | findBridges () const |
Finds all bridges in the network and returns them. More... | |
Bridge | getBridge (const BridgeIdentification &identification, bool sharedState=false) |
Gets a Hue bridge based on its identification. More... | |
void | addUsername (const std::string &mac, const std::string &username) |
Function that adds a username to the usernames map. More... | |
void | addClientKey (const std::string &mac, const std::string &clientkey) |
Function that adds a client key to the clientkeys map. More... | |
const std::map< std::string, std::string > & | getAllUsernames () const |
Function that returns a map of mac addresses and usernames. More... | |
Static Public Member Functions | |
static std::string | normalizeMac (std::string input) |
Normalizes mac address to plain hex number. More... | |
Class to find all Hue bridges on the network and create usernames for them.
hueplusplus::BridgeFinder::BridgeFinder | ( | std::shared_ptr< const IHttpHandler > | handler | ) |
Constructor of BridgeFinder class.
handler | HttpHandler of type IHttpHandler for communication with the bridge |
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.
mac | MAC address of Hue bridge |
clientkey | Client key that is used to control the Hue bridge in entertainment mode |
void hueplusplus::BridgeFinder::addUsername | ( | const std::string & | mac, |
const std::string & | username | ||
) |
Function that adds a username to the usernames map.
mac | MAC address of Hue bridge |
username | Username that is used to control the Hue bridge |
std::vector< BridgeFinder::BridgeIdentification > hueplusplus::BridgeFinder::findBridges | ( | ) | const |
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.
std::system_error | when system or socket operations fail |
HueException | when response contained no body |
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.
Bridge hueplusplus::BridgeFinder::getBridge | ( | const BridgeIdentification & | identification, |
bool | sharedState = false |
||
) |
Gets a Hue bridge based on its identification.
identification | BridgeIdentification that specifies a bridge |
sharedState | Uses a single, shared cache for all objects on the bridge. |
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 |
|
static |
Normalizes mac address to plain hex number.
input
without separators and whitespace, in lower case.