hueplusplus
1.0.0
|
Utility functions used in multiple places. More...
Functions | |
bool | validatePUTReply (const std::string &path, const nlohmann::json &request, const nlohmann::json &reply) |
Function for validating that a request was executed correctly. More... | |
bool | validateReplyForLight (const nlohmann::json &request, const nlohmann::json &reply, int lightId) |
bool | floatEquals (float lhs, float rhs) |
Checks equality to 4 decimal places. More... | |
template<typename... Paths> | |
nlohmann::json | safeGetMember (const nlohmann::json &json, Paths &&... paths) |
Returns the object/array member or null if it does not exist. More... | |
Utility functions used in multiple places.
|
inline |
Checks equality to 4 decimal places.
Floats in Hue json responses are rounded to 4 decimal places.
nlohmann::json hueplusplus::utils::safeGetMember | ( | const nlohmann::json & | json, |
Paths &&... | paths | ||
) |
Returns the object/array member or null if it does not exist.
json | The base json value |
paths | Any number of child accesses (e.g. 0, "key" would access json[0]["key"]) |
bool hueplusplus::utils::validatePUTReply | ( | const std::string & | path, |
const nlohmann::json & | request, | ||
const nlohmann::json & | reply | ||
) |
Function for validating that a request was executed correctly.
path | The path the PUT request was made to |
request | The request that was sent initially |
reply | The reply that was received |
bool hueplusplus::utils::validateReplyForLight | ( | const nlohmann::json & | request, |
const nlohmann::json & | reply, | ||
int | lightId | ||
) |