Loading...
Searching...
No Matches
hueplusplus::SearchableResourceList< Resource > Class Template Reference

Handles a ResourceList of physical devices which can be searched for. More...

`#include <hueplusplus/ResourceList.h>`

Inheritance diagram for hueplusplus::SearchableResourceList< Resource >:
[legend]
Collaboration diagram for hueplusplus::SearchableResourceList< Resource >:
[legend]

## Public Member Functions

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, int >
| 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 & | 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 | remove (const IdType &id)
| Removes the resource.

## Protected Member Functions

| SearchableResourceList (SearchableResourceList &&)=default
| Protected defaulted move constructor.
SearchableResourceList & | operator= (SearchableResourceList &&)=default
| Protected defaulted move assignment.
Protected Member Functions inherited from hueplusplus::ResourceList< Resource, int >
Resource | construct (const IdType &id, const nlohmann::json &state)
| Constructs resource using factory or constructor, if available.

## Additional Inherited Members

Public Types inherited from hueplusplus::ResourceList< Resource, int >
using | ResourceType
using | IdType
Static Protected Member Functions inherited from hueplusplus::ResourceList< Resource, int >
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, int >
std::shared_ptr< APICache > | stateCache
std::function< Resource(IdType, const nlohmann::json &, const std::shared_ptr< APICache > &)> | factory
std::string | path
bool | sharedState

## Detailed Description

template<typename Resource>
class hueplusplus::SearchableResourceList< Resource >

Handles a ResourceList of physical devices which can be searched for.

Template Parameters

  Resource | Resource type that is in the list

## Constructor & Destructor Documentation

## SearchableResourceList()

template<typename Resource>

hueplusplus::SearchableResourceList< Resource >::SearchableResourceList | ( | SearchableResourceList< Resource > && |  | ) |

protected default

Protected defaulted move constructor.

## Member Function Documentation

## getNewDevices()

template<typename Resource>

NewDeviceList hueplusplus::SearchableResourceList< Resource >::getNewDevices | ( |  | ) | const

inline

Get devices found in last search.

## operator=()

template<typename Resource>

SearchableResourceList & hueplusplus::SearchableResourceList< Resource >::operator= | ( | SearchableResourceList< Resource > && |  | ) |

protected default

Protected defaulted move assignment.

## search()

template<typename Resource>

void hueplusplus::SearchableResourceList< Resource >::search | ( | const std::vector< std::string > & | deviceIds = {} | ) |

inline

Start search for new devices.

Parameters

  deviceIds | Serial numbers of the devices to search for (max. 10)

Takes more than 40s. If many devices were found a second search command might be necessary.

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

- include/hueplusplus/ResourceList.h