_hue_command_a_p_i_8h_source.html
18.3 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
<!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/HueCommandAPI.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">HueCommandAPI.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="_hue_command_a_p_i_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_HUECOMMANDAPI_H</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#define INCLUDE_HUEPLUSPLUS_HUECOMMANDAPI_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 <atomic></span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="preprocessor">#include <chrono></span></div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#include <mutex></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 "<a class="code" href="_hue_exception_8h.html">HueException.h</a>"</span></div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="preprocessor">#include "<a class="code" href="_i_http_handler_8h.html">IHttpHandler.h</a>"</span></div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> </div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="keyword">namespace </span><a class="code" href="namespacehueplusplus.html">hueplusplus</a></div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> {</div><div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="classhueplusplus_1_1_hue_command_a_p_i.html"> 37</a></span> <span class="keyword">class </span><a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html">HueCommandAPI</a></div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> {</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="keyword">public</span>:</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  <a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html#ad6cd1f84660055f622cf730a251fa0ec">HueCommandAPI</a>(</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <span class="keyword">const</span> std::string& ip, <span class="keywordtype">int</span> port, <span class="keyword">const</span> std::string& username, std::shared_ptr<const IHttpHandler> httpHandler);</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span> </div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html#ad6cd1f84660055f622cf730a251fa0ec">HueCommandAPI</a>(<span class="keyword">const</span> <a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html">HueCommandAPI</a>&) = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html#ad6cd1f84660055f622cf730a251fa0ec">HueCommandAPI</a>(<a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html">HueCommandAPI</a>&&) = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span> </div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  <a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html">HueCommandAPI</a>& <a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html#a85cedc2afdbb37e56870f10313afdcac">operator=</a>(<span class="keyword">const</span> <a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html">HueCommandAPI</a>&) = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html">HueCommandAPI</a>& <a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html#a85cedc2afdbb37e56870f10313afdcac">operator=</a>(<a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html">HueCommandAPI</a>&&) = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span> </div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  nlohmann::json <a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html#ae321474c3562a25d5bd04f50fcefe7b0">PUTRequest</a>(<span class="keyword">const</span> std::string& path, <span class="keyword">const</span> nlohmann::json& request, <a class="code" href="structhueplusplus_1_1_file_info.html">FileInfo</a> fileInfo) <span class="keyword">const</span>;</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  nlohmann::json <a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html#ae321474c3562a25d5bd04f50fcefe7b0">PUTRequest</a>(<span class="keyword">const</span> std::string& path, <span class="keyword">const</span> nlohmann::json& request) <span class="keyword">const</span>;</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span> </div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  nlohmann::json <a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html#a075e958c9cf465c8c955d725a2037b88">GETRequest</a>(<span class="keyword">const</span> std::string& path, <span class="keyword">const</span> nlohmann::json& request, <a class="code" href="structhueplusplus_1_1_file_info.html">FileInfo</a> fileInfo) <span class="keyword">const</span>;</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  nlohmann::json <a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html#a075e958c9cf465c8c955d725a2037b88">GETRequest</a>(<span class="keyword">const</span> std::string& path, <span class="keyword">const</span> nlohmann::json& request) <span class="keyword">const</span>;</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span> </div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  nlohmann::json <a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html#ac7417f064a171a2f8990841f173db722">DELETERequest</a>(<span class="keyword">const</span> std::string& path, <span class="keyword">const</span> nlohmann::json& request, <a class="code" href="structhueplusplus_1_1_file_info.html">FileInfo</a> fileInfo) <span class="keyword">const</span>;</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  nlohmann::json <a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html#ac7417f064a171a2f8990841f173db722">DELETERequest</a>(<span class="keyword">const</span> std::string& path, <span class="keyword">const</span> nlohmann::json& request) <span class="keyword">const</span>;</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span> </div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  nlohmann::json <a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html#a81a50ebaa5c468e2facd9be26d6049c3">POSTRequest</a>(<span class="keyword">const</span> std::string& path, <span class="keyword">const</span> nlohmann::json& request, <a class="code" href="structhueplusplus_1_1_file_info.html">FileInfo</a> fileInfo) <span class="keyword">const</span>;</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  nlohmann::json <a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html#a81a50ebaa5c468e2facd9be26d6049c3">POSTRequest</a>(<span class="keyword">const</span> std::string& path, <span class="keyword">const</span> nlohmann::json& request) <span class="keyword">const</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>  std::string <a class="code" href="classhueplusplus_1_1_hue_command_a_p_i.html#ad50f6a232f2cc542da4813051f3778f0">combinedPath</a>(<span class="keyword">const</span> std::string& path) <span class="keyword">const</span>;</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span> <span class="keyword">private</span>:</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <span class="keyword">struct </span>TimeoutData</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  {</div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  std::chrono::steady_clock::time_point timeout;</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  std::mutex mutex;</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  };</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span> </div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  nlohmann::json HandleError(<a class="code" href="structhueplusplus_1_1_file_info.html">FileInfo</a> fileInfo, <span class="keyword">const</span> nlohmann::json& response) <span class="keyword">const</span>;</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span> </div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span> <span class="keyword">private</span>:</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  std::string ip;</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  <span class="keywordtype">int</span> port;</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  std::string username;</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  std::shared_ptr<const IHttpHandler> httpHandler;</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  std::shared_ptr<TimeoutData> timeout;</div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span> };</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span> } <span class="comment">// namespace hueplusplus</span></div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span> </div><div class="line"><a name="l00146"></a><span class="lineno"> 146</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="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_hue_command_a_p_i_html_ae321474c3562a25d5bd04f50fcefe7b0"><div class="ttname"><a href="classhueplusplus_1_1_hue_command_a_p_i.html#ae321474c3562a25d5bd04f50fcefe7b0">hueplusplus::HueCommandAPI::PUTRequest</a></div><div class="ttdeci">nlohmann::json PUTRequest(const std::string &path, const nlohmann::json &request, FileInfo fileInfo) const</div><div class="ttdoc">Sends a HTTP PUT request to the bridge and returns the response. </div><div class="ttdef"><b>Definition:</b> HueCommandAPI.cpp:80</div></div>
<div class="ttc" id="classhueplusplus_1_1_hue_command_a_p_i_html_a85cedc2afdbb37e56870f10313afdcac"><div class="ttname"><a href="classhueplusplus_1_1_hue_command_a_p_i.html#a85cedc2afdbb37e56870f10313afdcac">hueplusplus::HueCommandAPI::operator=</a></div><div class="ttdeci">HueCommandAPI & operator=(const HueCommandAPI &)=default</div><div class="ttdoc">Copy assign from other HueCommandAPI. </div></div>
<div class="ttc" id="_hue_exception_8h_html"><div class="ttname"><a href="_hue_exception_8h.html">HueException.h</a></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="_i_http_handler_8h_html"><div class="ttname"><a href="_i_http_handler_8h.html">IHttpHandler.h</a></div></div>
<div class="ttc" id="classhueplusplus_1_1_hue_command_a_p_i_html_ad50f6a232f2cc542da4813051f3778f0"><div class="ttname"><a href="classhueplusplus_1_1_hue_command_a_p_i.html#ad50f6a232f2cc542da4813051f3778f0">hueplusplus::HueCommandAPI::combinedPath</a></div><div class="ttdeci">std::string combinedPath(const std::string &path) const</div><div class="ttdoc">Combines path with api prefix and username. </div><div class="ttdef"><b>Definition:</b> HueCommandAPI.cpp:146</div></div>
<div class="ttc" id="classhueplusplus_1_1_hue_command_a_p_i_html_a81a50ebaa5c468e2facd9be26d6049c3"><div class="ttname"><a href="classhueplusplus_1_1_hue_command_a_p_i.html#a81a50ebaa5c468e2facd9be26d6049c3">hueplusplus::HueCommandAPI::POSTRequest</a></div><div class="ttdeci">nlohmann::json POSTRequest(const std::string &path, const nlohmann::json &request, FileInfo fileInfo) const</div><div class="ttdoc">Sends a HTTP POST request to the bridge and returns the response. </div><div class="ttdef"><b>Definition:</b> HueCommandAPI.cpp:119</div></div>
<div class="ttc" id="classhueplusplus_1_1_hue_command_a_p_i_html_ad6cd1f84660055f622cf730a251fa0ec"><div class="ttname"><a href="classhueplusplus_1_1_hue_command_a_p_i.html#ad6cd1f84660055f622cf730a251fa0ec">hueplusplus::HueCommandAPI::HueCommandAPI</a></div><div class="ttdeci">HueCommandAPI(const std::string &ip, int port, const std::string &username, std::shared_ptr< const IHttpHandler > httpHandler)</div><div class="ttdoc">Construct from ip, username and HttpHandler. </div><div class="ttdef"><b>Definition:</b> HueCommandAPI.cpp:66</div></div>
<div class="ttc" id="classhueplusplus_1_1_hue_command_a_p_i_html_ac7417f064a171a2f8990841f173db722"><div class="ttname"><a href="classhueplusplus_1_1_hue_command_a_p_i.html#ac7417f064a171a2f8990841f173db722">hueplusplus::HueCommandAPI::DELETERequest</a></div><div class="ttdeci">nlohmann::json DELETERequest(const std::string &path, const nlohmann::json &request, FileInfo fileInfo) const</div><div class="ttdoc">Sends a HTTP DELETE request to the bridge and returns the response. </div><div class="ttdef"><b>Definition:</b> HueCommandAPI.cpp:106</div></div>
<div class="ttc" id="classhueplusplus_1_1_hue_command_a_p_i_html_a075e958c9cf465c8c955d725a2037b88"><div class="ttname"><a href="classhueplusplus_1_1_hue_command_a_p_i.html#a075e958c9cf465c8c955d725a2037b88">hueplusplus::HueCommandAPI::GETRequest</a></div><div class="ttdeci">nlohmann::json GETRequest(const std::string &path, const nlohmann::json &request, FileInfo fileInfo) const</div><div class="ttdoc">Sends a HTTP GET request to the bridge and returns the response. </div><div class="ttdef"><b>Definition:</b> HueCommandAPI.cpp:93</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>