Loading...
Searching...
No Matches
hueplusplus::LightFactory Class Reference

`#include <hueplusplus/HueDeviceTypes.h>`

## Public Member Functions

| LightFactory (const HueCommandAPI &commands, std::chrono::steady_clock::duration refreshDuration)
| Create a factory for Lights.
Light | createLight (const nlohmann::json &lightState, int id, const std::shared_ptr< APICache > &baseCache={})
| Create a Light with the correct type from the JSON state.

## Constructor & Destructor Documentation

## LightFactory()

hueplusplus::LightFactory::LightFactory | ( | const HueCommandAPI & | commands,
|  | std::chrono::steady_clock::duration | refreshDuration
| ) |  |

Create a factory for Lights.

Parameters

  commands | HueCommandAPI for communication with the bridge
  refreshDuration | Time between refreshing the cached light state.

## Member Function Documentation

## createLight()

Light hueplusplus::LightFactory::createLight | ( | const nlohmann::json & | lightState,
|  | int | id,
|  | const std::shared_ptr< APICache > & | baseCache = `{}`
| ) |  |

Create a Light with the correct type from the JSON state.

Parameters

  lightState | Light JSON as returned from the bridge (not only the "state" part of it).
  id | Light id.
  baseCache | Optional shared cache for the light.

Returns
  Light with matching id, strategies and ColorType.

Exceptions

  std::system_error | when system or socket operations fail
  HueException | when light type is unknown
  HueAPIResponseException | when response contains an error
  nlohmann::json::parse_error | when response could not be parsed

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

- include/hueplusplus/HueDeviceTypes.h
- src/HueDeviceTypes.cpp