|
hueplusplus 1.2.0
|
Handles a list of Sensors with type specific getters. More...
#include <hueplusplus/SensorList.h>
Inheritance diagram for hueplusplus::SensorList:
Collaboration diagram for hueplusplus::SensorList:Public Member Functions | |
| template<typename T > | |
| T | getAsType (int id) |
Get sensor specified by id, convert to T. | |
| template<typename T > | |
| std::vector< T > | getAllByType () |
Get all sensors of type T. | |
| CreateableResourceList (CreateableResourceList &&)=default | |
| Protected defaulted move constructor. | |
Public Member Functions inherited from hueplusplus::CreateableResourceList< SearchableResourceList< Sensor >, CreateSensor > | |
| BaseResourceList::IdType | create (const CreateSensor ¶ms) |
| Create a new resource. | |
Public Member Functions inherited from hueplusplus::SearchableResourceList< Sensor > | |
| void | search (const std::vector< std::string > &deviceIds={}) |
| Start search for new devices. | |
| NewDeviceList | getNewDevices () const |
| Get devices found in last search. | |
Public Member Functions inherited from hueplusplus::ResourceList< Resource, IdT > | |
| ResourceList (std::shared_ptr< APICache > baseCache, const std::string &cacheEntry, std::chrono::steady_clock::duration refreshDuration, bool sharedState=false, const std::function< Resource(IdType, const nlohmann::json &, const std::shared_ptr< APICache > &)> &factory=nullptr) | |
| Construct ResourceList using a base cache and optional factory function. | |
| ResourceList (const HueCommandAPI &commands, const std::string &path, std::chrono::steady_clock::duration refreshDuration, const std::function< Resource(IdType, const nlohmann::json &, const std::shared_ptr< APICache > &)> &factory=nullptr) | |
| Construct ResourceList with a separate cache and optional factory function. | |
| ResourceList (const ResourceList &)=delete | |
| Deleted copy constructor. | |
| ResourceList & | operator= (const ResourceList &)=delete |
| Deleted copy assignment. | |
| void | refresh () |
| Refreshes internal state now. | |
| void | setRefreshDuration (std::chrono::steady_clock::duration refreshDuration) |
| Sets custom refresh interval for this list and all resources created. | |
| std::vector< Resource > | getAll () |
| Get all resources that exist. | |
| Resource | get (const IdType &id) |
| Get resource specified by id. | |
| bool | exists (const IdType &id) |
| Checks whether resource with id exists. | |
| bool | exists (const IdType &id) const |
| Checks whether resource with id exists. | |
| bool | remove (const IdType &id) |
| Removes the resource. | |
Protected Member Functions | |
| SensorList (SensorList &&)=default | |
| Protected defaulted move constructor. | |
| SensorList & | operator= (SensorList &&)=default |
| Protected defaulted move assignment. | |
Protected Member Functions inherited from hueplusplus::CreateableResourceList< SearchableResourceList< Sensor >, CreateSensor > | |
| CreateableResourceList (CreateableResourceList &&)=default | |
| Protected defaulted move constructor. | |
| CreateableResourceList & | operator= (CreateableResourceList &&)=default |
| Protected defaulted move assignment. | |
Protected Member Functions inherited from hueplusplus::SearchableResourceList< Sensor > | |
| SearchableResourceList (SearchableResourceList &&)=default | |
| Protected defaulted move constructor. | |
| SearchableResourceList & | operator= (SearchableResourceList &&)=default |
| Protected defaulted move assignment. | |
Protected Member Functions inherited from hueplusplus::ResourceList< Resource, IdT > | |
| Resource | construct (const IdType &id, const nlohmann::json &state) |
| Constructs resource using factory or constructor, if available. | |
| ResourceList (ResourceList &&)=default | |
| Protected defaulted move constructor. | |
| ResourceList & | operator= (ResourceList &&)=default |
| Protected defaulted move assignment. | |
Additional Inherited Members | |
Public Types inherited from hueplusplus::ResourceList< Resource, IdT > | |
| using | ResourceType = Resource |
| using | IdType = IdT |
Static Protected Member Functions inherited from hueplusplus::ResourceList< Resource, IdT > | |
| static IdType | maybeStoi (const std::string &key) |
| Calls std::stoi if IdType is int. | |
| static std::string | maybeToString (const IdType &id) |
| Calls std::to_string if IdType is int. | |
Protected Attributes inherited from hueplusplus::ResourceList< Resource, IdT > | |
| std::shared_ptr< APICache > | stateCache |
| std::function< Resource(IdType, const nlohmann::json &, const std::shared_ptr< APICache > &)> | factory |
| std::string | path |
| bool | sharedState |
Handles a list of Sensors with type specific getters.
Allows to directly get the requested sensor type or all sensors of a given type.
|
protecteddefault |
Protected defaulted move constructor.
|
default |
Protected defaulted move constructor.
|
inline |
Get all sensors of type T.
| HueException | when response contains no body |
| std::system_error | when system or socket operations fail |
| HueAPIResponseException | when response contains an error |
| nlohmann::json::parse_error | when response could not be parsed |
|
inline |
Get sensor specified by id, convert to T.
| id | Sensor id |
| HueException | when id does not exist or type does not match |
| std::system_error | when system or socket operations fail |
| HueAPIResponseException | when response contains an error |
| nlohmann::json::parse_error | when response could not be parsed |
|
protecteddefault |
Protected defaulted move assignment.