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

Parameters for creating a new Sensor. More...

`#include <hueplusplus/Sensor.h>`

## Public Member Functions

| CreateSensor (const std::string &name, const std::string &modelid, const std::string &swversion, const std::string &type, const std::string &uniqueid, const std::string &manufacturername)
| Construct with necessary parameters.
CreateSensor & | setState (const nlohmann::json &state)
| Set state object.
CreateSensor & | setConfig (const nlohmann::json &config)
| Set config object.
CreateSensor & | setRecycle (bool recycle)
| Enable recycling, delete automatically when not referenced.
nlohmann::json | getRequest () const
| Get request to create the sensor.

## Protected Attributes

nlohmann::json | request

## Detailed Description

Parameters for creating a new Sensor.

Can be used like a builder object with chained calls.

## Constructor & Destructor Documentation

## CreateSensor()

hueplusplus::CreateSensor::CreateSensor | ( | const std::string & | name,
|  | const std::string & | modelid,
|  | const std::string & | swversion,
|  | const std::string & | type,
|  | const std::string & | uniqueid,
|  | const std::string & | manufacturername )

Construct with necessary parameters.

Parameters

  name | Human readable name
  modelid | Model id of the sensor
  swversion | Software version, may be empty
  type | Sensor type name (see types in Sensors)
  uniqueid | Globally unique ID (MAC address of the device, extended with a unique endpoint id)
  manufacturername | Name of the device manufacturer

## Member Function Documentation

## getRequest()

nlohmann::json hueplusplus::CreateSensor::getRequest | ( |  | ) | const

Get request to create the sensor.

Returns
  JSON request for a POST to create the new sensor

## setConfig()

CreateSensor & hueplusplus::CreateSensor::setConfig | ( | const nlohmann::json & | config | ) |

Set config object.

Parameters

  config | Sensor config, configs depend on the type. See getters in Sensor for examples.

Returns
  this object for chaining calls

## setRecycle()

CreateSensor & hueplusplus::CreateSensor::setRecycle | ( | bool | recycle | ) |

Enable recycling, delete automatically when not referenced.

Returns
  this object for chaining calls

## setState()

CreateSensor & hueplusplus::CreateSensor::setState | ( | const nlohmann::json & | state | ) |

Set state object.

Parameters

  state | Sensor state, contents depend on the type.

Returns
  this object for chaining calls

## Member Data Documentation

## request

nlohmann::json hueplusplus::CreateSensor::request

protected

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

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