_base_device_8h_source.html
21.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!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: include/hueplusplus/BaseDevice.h Source File</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
 <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="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_e05b4b7707bd5f9fd045e8be02b17d0a.html">hueplusplus</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">BaseDevice.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="_base_device_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> </div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#ifndef INCLUDE_HUEPLUSPLUS_HUE_THING_H</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#define INCLUDE_HUEPLUSPLUS_HUE_THING_H</span></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> </div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#include <memory></span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> </div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#include "<a class="code" href="_a_p_i_cache_8h.html">APICache.h</a>"</span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> </div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="preprocessor">#include "json/json.hpp"</span></div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> </div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="keyword">namespace </span><a class="code" href="namespacehueplusplus.html">hueplusplus</a></div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> {</div><div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="classhueplusplus_1_1_base_device.html"> 35</a></span> <span class="keyword">class </span><a class="code" href="classhueplusplus_1_1_base_device.html">BaseDevice</a></div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span> {</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> <span class="keyword">public</span>:</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  <span class="keyword">virtual</span> <a class="code" href="classhueplusplus_1_1_base_device.html#ab08c354ca3eef24240f98267df4ae01a">~BaseDevice</a>() = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span> </div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classhueplusplus_1_1_base_device.html#a21122992819e6155867c02578773d0cd">getId</a>() <span class="keyword">const</span>;</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span> </div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <span class="keyword">virtual</span> std::string <a class="code" href="classhueplusplus_1_1_base_device.html#a6741ba9ec72108ca0101d41c0b02c568">getType</a>() <span class="keyword">const</span>;</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span> </div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  <span class="keyword">virtual</span> std::string <a class="code" href="classhueplusplus_1_1_base_device.html#a5331ce38f4e6c9def7bafc23112ccd34">getName</a>();</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span> </div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <span class="keyword">virtual</span> std::string <a class="code" href="classhueplusplus_1_1_base_device.html#a5331ce38f4e6c9def7bafc23112ccd34">getName</a>() <span class="keyword">const</span>;</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span> </div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  <span class="keyword">virtual</span> std::string <a class="code" href="classhueplusplus_1_1_base_device.html#aa7572be90ab966033ad8b9c7e83598ce">getModelId</a>() <span class="keyword">const</span>;</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span> </div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="keyword">virtual</span> std::string <a class="code" href="classhueplusplus_1_1_base_device.html#a821dc52df6472b2604f56579dac4ac04">getUId</a>() <span class="keyword">const</span>;</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span> </div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  <span class="keyword">virtual</span> std::string <a class="code" href="classhueplusplus_1_1_base_device.html#ad6e1af663e4f14afc6293aacdd5130c0">getManufacturername</a>() <span class="keyword">const</span>;</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span> </div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <span class="keyword">virtual</span> std::string <a class="code" href="classhueplusplus_1_1_base_device.html#a53f675db31058c574fbf55baea8bd556">getProductname</a>() <span class="keyword">const</span>;</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span> </div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  <span class="keyword">virtual</span> std::string <a class="code" href="classhueplusplus_1_1_base_device.html#aebc5484b45b833491385a5381e3234bb">getSwVersion</a>();</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span> </div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  <span class="keyword">virtual</span> std::string <a class="code" href="classhueplusplus_1_1_base_device.html#aebc5484b45b833491385a5381e3234bb">getSwVersion</a>() <span class="keyword">const</span>;</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span> </div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classhueplusplus_1_1_base_device.html#ab7554114eee573ab784c44d53f439028">setName</a>(<span class="keyword">const</span> std::string& name);</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span> </div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhueplusplus_1_1_base_device.html#aa6ac28ae3879a41ace1cd6806ca9a2f1">refresh</a>(<span class="keywordtype">bool</span> force = <span class="keyword">false</span>);</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span> </div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classhueplusplus_1_1_base_device.html#a5dd630da2c99842700d555788c0b75b1">setRefreshDuration</a>(std::chrono::steady_clock::duration refreshDuration);</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span> </div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span> <span class="keyword">protected</span>:</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  <a class="code" href="classhueplusplus_1_1_base_device.html#a48bf88e758fd7191c599a46751755c97">BaseDevice</a>(<span class="keywordtype">int</span> <span class="keywordtype">id</span>, <span class="keyword">const</span> std::shared_ptr<APICache>& baseCache);</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  <a class="code" href="classhueplusplus_1_1_base_device.html#a48bf88e758fd7191c599a46751755c97">BaseDevice</a>(<span class="keywordtype">int</span> <span class="keywordtype">id</span>, <span class="keyword">const</span> <a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html">HueCommandAPI</a>& commands, <span class="keyword">const</span> std::string& path,</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  std::chrono::steady_clock::duration refreshDuration, <span class="keyword">const</span> nlohmann::json& currentState);</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span> </div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  <span class="keyword">virtual</span> nlohmann::json <a class="code" href="classhueplusplus_1_1_base_device.html#ac8089e8f00d426427ed2fc7f6b817082">sendPutRequest</a>(<span class="keyword">const</span> std::string& subPath, <span class="keyword">const</span> nlohmann::json& request, <a class="code" href="structhueplusplus_1_1_file_info.html">FileInfo</a> fileInfo);</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span> </div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span> <span class="keyword">protected</span>:</div><div class="line"><a name="l00154"></a><span class="lineno"><a class="line" href="classhueplusplus_1_1_base_device.html#aa65a31223cfa2a054c28148c35c8b3cf"> 154</a></span>  <span class="keywordtype">int</span> <a class="code" href="classhueplusplus_1_1_base_device.html#aa65a31223cfa2a054c28148c35c8b3cf">id</a>; </div><div class="line"><a name="l00155"></a><span class="lineno"><a class="line" href="classhueplusplus_1_1_base_device.html#a526b63fa6eb1c9dc9a7b1926ad0be27a"> 155</a></span>  <a class="code" href="classhueplusplus_1_1_a_p_i_cache.html">APICache</a> <a class="code" href="classhueplusplus_1_1_base_device.html#a526b63fa6eb1c9dc9a7b1926ad0be27a">state</a>; </div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span> };</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span> } <span class="comment">// namespace hueplusplus</span></div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span> </div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span> <span class="preprocessor">#endif</span></div><div class="ttc" id="classhueplusplus_1_1_hue_command_a_p_i_html"><div class="ttname"><a href="classhueplusplus_1_1_hue_command_a_p_i.html">hueplusplus::HueCommandAPI</a></div><div class="ttdef"><b>Definition:</b> HueCommandAPI.h:37</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_device_html_aa65a31223cfa2a054c28148c35c8b3cf"><div class="ttname"><a href="classhueplusplus_1_1_base_device.html#aa65a31223cfa2a054c28148c35c8b3cf">hueplusplus::BaseDevice::id</a></div><div class="ttdeci">int id</div><div class="ttdoc">holds the id of the device </div><div class="ttdef"><b>Definition:</b> BaseDevice.h:154</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_device_html_a21122992819e6155867c02578773d0cd"><div class="ttname"><a href="classhueplusplus_1_1_base_device.html#a21122992819e6155867c02578773d0cd">hueplusplus::BaseDevice::getId</a></div><div class="ttdeci">virtual int getId() const</div><div class="ttdoc">Const function that returns the id of this device. </div><div class="ttdef"><b>Definition:</b> BaseDevice.cpp:34</div></div>
<div class="ttc" id="namespacehueplusplus_html"><div class="ttname"><a href="namespacehueplusplus.html">hueplusplus</a></div><div class="ttdoc">Namespace for the hueplusplus library. </div><div class="ttdef"><b>Definition:</b> Action.h:27</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_device_html_ad6e1af663e4f14afc6293aacdd5130c0"><div class="ttname"><a href="classhueplusplus_1_1_base_device.html#ad6e1af663e4f14afc6293aacdd5130c0">hueplusplus::BaseDevice::getManufacturername</a></div><div class="ttdeci">virtual std::string getManufacturername() const</div><div class="ttdoc">Const function that returns the manufacturername of the device. </div><div class="ttdef"><b>Definition:</b> BaseDevice.cpp:64</div></div>
<div class="ttc" id="classhueplusplus_1_1_a_p_i_cache_html"><div class="ttname"><a href="classhueplusplus_1_1_a_p_i_cache.html">hueplusplus::APICache</a></div><div class="ttdoc">Caches API GET requests and refreshes regularly. </div><div class="ttdef"><b>Definition:</b> APICache.h:37</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_device_html_a821dc52df6472b2604f56579dac4ac04"><div class="ttname"><a href="classhueplusplus_1_1_base_device.html#a821dc52df6472b2604f56579dac4ac04">hueplusplus::BaseDevice::getUId</a></div><div class="ttdeci">virtual std::string getUId() const</div><div class="ttdoc">Const function that returns the uniqueid of the device. </div><div class="ttdef"><b>Definition:</b> BaseDevice.cpp:59</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_device_html"><div class="ttname"><a href="classhueplusplus_1_1_base_device.html">hueplusplus::BaseDevice</a></div><div class="ttdoc">Base class for physical devices connected to the bridge (sensor or light). </div><div class="ttdef"><b>Definition:</b> BaseDevice.h:35</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_device_html_a53f675db31058c574fbf55baea8bd556"><div class="ttname"><a href="classhueplusplus_1_1_base_device.html#a53f675db31058c574fbf55baea8bd556">hueplusplus::BaseDevice::getProductname</a></div><div class="ttdeci">virtual std::string getProductname() const</div><div class="ttdoc">Const function that returns the productname of the device. </div><div class="ttdef"><b>Definition:</b> BaseDevice.cpp:69</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_device_html_a5331ce38f4e6c9def7bafc23112ccd34"><div class="ttname"><a href="classhueplusplus_1_1_base_device.html#a5331ce38f4e6c9def7bafc23112ccd34">hueplusplus::BaseDevice::getName</a></div><div class="ttdeci">virtual std::string getName()</div><div class="ttdoc">Function that returns the name of the device. </div><div class="ttdef"><b>Definition:</b> BaseDevice.cpp:44</div></div>
<div class="ttc" id="structhueplusplus_1_1_file_info_html"><div class="ttname"><a href="structhueplusplus_1_1_file_info.html">hueplusplus::FileInfo</a></div><div class="ttdoc">Contains information about error location, use CURRENT_FILE_INFO to create. </div><div class="ttdef"><b>Definition:</b> HueException.h:34</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_device_html_a526b63fa6eb1c9dc9a7b1926ad0be27a"><div class="ttname"><a href="classhueplusplus_1_1_base_device.html#a526b63fa6eb1c9dc9a7b1926ad0be27a">hueplusplus::BaseDevice::state</a></div><div class="ttdeci">APICache state</div><div class="ttdoc">holds the current state of the device </div><div class="ttdef"><b>Definition:</b> BaseDevice.h:155</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_device_html_a5dd630da2c99842700d555788c0b75b1"><div class="ttname"><a href="classhueplusplus_1_1_base_device.html#a5dd630da2c99842700d555788c0b75b1">hueplusplus::BaseDevice::setRefreshDuration</a></div><div class="ttdeci">virtual void setRefreshDuration(std::chrono::steady_clock::duration refreshDuration)</div><div class="ttdoc">Sets custom refresh interval for this device. </div><div class="ttdef"><b>Definition:</b> BaseDevice.cpp:123</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_device_html_aebc5484b45b833491385a5381e3234bb"><div class="ttname"><a href="classhueplusplus_1_1_base_device.html#aebc5484b45b833491385a5381e3234bb">hueplusplus::BaseDevice::getSwVersion</a></div><div class="ttdeci">virtual std::string getSwVersion()</div><div class="ttdoc">Function that returns the software version of the device. </div><div class="ttdef"><b>Definition:</b> BaseDevice.cpp:74</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_device_html_a6741ba9ec72108ca0101d41c0b02c568"><div class="ttname"><a href="classhueplusplus_1_1_base_device.html#a6741ba9ec72108ca0101d41c0b02c568">hueplusplus::BaseDevice::getType</a></div><div class="ttdeci">virtual std::string getType() const</div><div class="ttdoc">Const function that returns the device type. </div><div class="ttdef"><b>Definition:</b> BaseDevice.cpp:39</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_device_html_ab08c354ca3eef24240f98267df4ae01a"><div class="ttname"><a href="classhueplusplus_1_1_base_device.html#ab08c354ca3eef24240f98267df4ae01a">hueplusplus::BaseDevice::~BaseDevice</a></div><div class="ttdeci">virtual ~BaseDevice()=default</div><div class="ttdoc">Virtual destructor. </div></div>
<div class="ttc" id="classhueplusplus_1_1_base_device_html_aa6ac28ae3879a41ace1cd6806ca9a2f1"><div class="ttname"><a href="classhueplusplus_1_1_base_device.html#aa6ac28ae3879a41ace1cd6806ca9a2f1">hueplusplus::BaseDevice::refresh</a></div><div class="ttdeci">virtual void refresh(bool force=false)</div><div class="ttdoc">Refreshes internal cached state. </div><div class="ttdef"><b>Definition:</b> BaseDevice.cpp:111</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_device_html_aa7572be90ab966033ad8b9c7e83598ce"><div class="ttname"><a href="classhueplusplus_1_1_base_device.html#aa7572be90ab966033ad8b9c7e83598ce">hueplusplus::BaseDevice::getModelId</a></div><div class="ttdeci">virtual std::string getModelId() const</div><div class="ttdoc">Const function that returns the modelid of the device. </div><div class="ttdef"><b>Definition:</b> BaseDevice.cpp:54</div></div>
<div class="ttc" id="_a_p_i_cache_8h_html"><div class="ttname"><a href="_a_p_i_cache_8h.html">APICache.h</a></div></div>
<div class="ttc" id="classhueplusplus_1_1_base_device_html_ab7554114eee573ab784c44d53f439028"><div class="ttname"><a href="classhueplusplus_1_1_base_device.html#ab7554114eee573ab784c44d53f439028">hueplusplus::BaseDevice::setName</a></div><div class="ttdeci">virtual bool setName(const std::string &name)</div><div class="ttdoc">Function that sets the name of the device. </div><div class="ttdef"><b>Definition:</b> BaseDevice.cpp:84</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_device_html_a48bf88e758fd7191c599a46751755c97"><div class="ttname"><a href="classhueplusplus_1_1_base_device.html#a48bf88e758fd7191c599a46751755c97">hueplusplus::BaseDevice::BaseDevice</a></div><div class="ttdeci">BaseDevice(int id, const std::shared_ptr< APICache > &baseCache)</div><div class="ttdoc">Protected ctor that is used by subclasses, construct with shared cache. </div><div class="ttdef"><b>Definition:</b> BaseDevice.cpp:94</div></div>
<div class="ttc" id="classhueplusplus_1_1_base_device_html_ac8089e8f00d426427ed2fc7f6b817082"><div class="ttname"><a href="classhueplusplus_1_1_base_device.html#ac8089e8f00d426427ed2fc7f6b817082">hueplusplus::BaseDevice::sendPutRequest</a></div><div class="ttdeci">virtual nlohmann::json sendPutRequest(const std::string &subPath, const nlohmann::json &request, FileInfo fileInfo)</div><div class="ttdoc">Utility function to send a put request to the device. </div><div class="ttdef"><b>Definition:</b> BaseDevice.cpp:106</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>