classhueplusplus_1_1_light_factory.html 9.95 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>hueplusplus: hueplusplus::LightFactory Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">hueplusplus
   &#160;<span id="projectnumber">1.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacehueplusplus.html">hueplusplus</a></li><li class="navelem"><a class="el" href="classhueplusplus_1_1_light_factory.html">LightFactory</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classhueplusplus_1_1_light_factory-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">hueplusplus::LightFactory Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="_hue_device_types_8h_source.html">hueplusplus/HueDeviceTypes.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ab0e1e524020e036b72ab5f583001bb0c"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhueplusplus_1_1_light_factory.html#ab0e1e524020e036b72ab5f583001bb0c">LightFactory</a> (const <a class="el" href="classhueplusplus_1_1_hue_command_a_p_i.html">HueCommandAPI</a> &amp;commands, std::chrono::steady_clock::duration refreshDuration)</td></tr>
<tr class="memdesc:ab0e1e524020e036b72ab5f583001bb0c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a factory for <a class="el" href="classhueplusplus_1_1_light.html" title="Class for Hue Light fixtures. ">Light</a>s.  <a href="#ab0e1e524020e036b72ab5f583001bb0c">More...</a><br /></td></tr>
<tr class="separator:ab0e1e524020e036b72ab5f583001bb0c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5109ceb53e042dc5b3126fba1e307618"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classhueplusplus_1_1_light.html">Light</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhueplusplus_1_1_light_factory.html#a5109ceb53e042dc5b3126fba1e307618">createLight</a> (const nlohmann::json &amp;lightState, int id, const std::shared_ptr&lt; <a class="el" href="classhueplusplus_1_1_a_p_i_cache.html">APICache</a> &gt; &amp;baseCache={})</td></tr>
<tr class="memdesc:a5109ceb53e042dc5b3126fba1e307618"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a <a class="el" href="classhueplusplus_1_1_light.html" title="Class for Hue Light fixtures. ">Light</a> with the correct type from the JSON state.  <a href="#a5109ceb53e042dc5b3126fba1e307618">More...</a><br /></td></tr>
<tr class="separator:a5109ceb53e042dc5b3126fba1e307618"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="ab0e1e524020e036b72ab5f583001bb0c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab0e1e524020e036b72ab5f583001bb0c">&#9670;&nbsp;</a></span>LightFactory()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">hueplusplus::LightFactory::LightFactory </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classhueplusplus_1_1_hue_command_a_p_i.html">HueCommandAPI</a> &amp;&#160;</td>
          <td class="paramname"><em>commands</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::chrono::steady_clock::duration&#160;</td>
          <td class="paramname"><em>refreshDuration</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a factory for <a class="el" href="classhueplusplus_1_1_light.html" title="Class for Hue Light fixtures. ">Light</a>s. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">commands</td><td><a class="el" href="classhueplusplus_1_1_hue_command_a_p_i.html">HueCommandAPI</a> for communication with the bridge </td></tr>
    <tr><td class="paramname">refreshDuration</td><td>Time between refreshing the cached light state. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a5109ceb53e042dc5b3126fba1e307618"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5109ceb53e042dc5b3126fba1e307618">&#9670;&nbsp;</a></span>createLight()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classhueplusplus_1_1_light.html">Light</a> hueplusplus::LightFactory::createLight </td>
          <td>(</td>
          <td class="paramtype">const nlohmann::json &amp;&#160;</td>
          <td class="paramname"><em>lightState</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::shared_ptr&lt; <a class="el" href="classhueplusplus_1_1_a_p_i_cache.html">APICache</a> &gt; &amp;&#160;</td>
          <td class="paramname"><em>baseCache</em> = <code>{}</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a <a class="el" href="classhueplusplus_1_1_light.html" title="Class for Hue Light fixtures. ">Light</a> with the correct type from the JSON state. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">lightState</td><td><a class="el" href="classhueplusplus_1_1_light.html" title="Class for Hue Light fixtures. ">Light</a> JSON as returned from the bridge (not only the "state" part of it). </td></tr>
    <tr><td class="paramname">id</td><td><a class="el" href="classhueplusplus_1_1_light.html" title="Class for Hue Light fixtures. ">Light</a> id. </td></tr>
    <tr><td class="paramname">baseCache</td><td>Optional shared cache for the light. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="classhueplusplus_1_1_light.html" title="Class for Hue Light fixtures. ">Light</a> with matching id, strategies and <a class="el" href="namespacehueplusplus.html#aa4ee261126f0bc8edc07e67bc811dc43">ColorType</a>. </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">std::system_error</td><td>when system or socket operations fail </td></tr>
    <tr><td class="paramname"><a class="el" href="classhueplusplus_1_1_hue_exception.html" title="Exception class with file information. Base class of all custom exception classes. ">HueException</a></td><td>when light type is unknown </td></tr>
    <tr><td class="paramname"><a class="el" href="classhueplusplus_1_1_hue_a_p_i_response_exception.html" title="Exception caused by a Hue API &quot;error&quot; response with additional information. ">HueAPIResponseException</a></td><td>when response contains an error </td></tr>
    <tr><td class="paramname">nlohmann::json::parse_error</td><td>when response could not be parsed </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>include/hueplusplus/<a class="el" href="_hue_device_types_8h_source.html">HueDeviceTypes.h</a></li>
<li>src/<a class="el" href="_hue_device_types_8cpp.html">HueDeviceTypes.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>