aboutsummaryrefslogtreecommitdiffstats
path: root/doc/api-ref/html/df/dac/test_8cpp.html
blob: 00f95150e9176c735216b46942eaf82bcd12ac2b (plain)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
<!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>HomeScreenBinding: libhomescreen/test.cpp File 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">HomeScreenBinding
   </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_65f76d62445e9e84c0450b12bf77c3bc.html">libhomescreen</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">test.cpp File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;<a class="el" href="../../df/d43/libhomescreen_8hpp_source.html">libhomescreen.hpp</a>&gt;</code><br />
<code>#include &lt;iostream&gt;</code><br />
<code>#include &lt;glib-2.0/glib.h&gt;</code><br />
<code>#include &lt;fcntl.h&gt;</code><br />
<code>#include &lt;string&gt;</code><br />
<code>#include &lt;sys/types.h&gt;</code><br />
<code>#include &lt;sys/stat.h&gt;</code><br />
<code>#include &lt;thread&gt;</code><br />
<code>#include &lt;exception&gt;</code><br />
<code>#include &lt;vector&gt;</code><br />
<code>#include &lt;sstream&gt;</code><br />
<code>#include &lt;functional&gt;</code><br />
</div>
<p><a href="../../df/dac/test_8cpp_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:aafb7f182b8bb6ba92354dde1658d86a4"><td class="memItemLeft" align="right" valign="top">static vector&lt; string &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/dac/test_8cpp.html#aafb7f182b8bb6ba92354dde1658d86a4">split</a> (const string &amp;str, char sep)</td></tr>
<tr class="separator:aafb7f182b8bb6ba92354dde1658d86a4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a64a6014565bb3e03294ec4a952d5add0"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/dac/test_8cpp.html#a64a6014565bb3e03294ec4a952d5add0">usage</a> ()</td></tr>
<tr class="separator:a64a6014565bb3e03294ec4a952d5add0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa9b3c43c212b49edee82ac30a11aa255"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/dac/test_8cpp.html#aa9b3c43c212b49edee82ac30a11aa255">call_test</a> ()</td></tr>
<tr class="separator:aa9b3c43c212b49edee82ac30a11aa255"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6d3cb4886e7afd45bd56b49800da932d"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/dac/test_8cpp.html#a6d3cb4886e7afd45bd56b49800da932d">onRep</a> (struct json_object *reply_contents)</td></tr>
<tr class="separator:a6d3cb4886e7afd45bd56b49800da932d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6a2874c419fe5936fcccadc7e6cf268e"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/dac/test_8cpp.html#a6a2874c419fe5936fcccadc7e6cf268e">onEv</a> (const string &amp;<a class="el" href="../../df/d7d/structevent.html">event</a>, struct json_object *event_contents)</td></tr>
<tr class="separator:a6a2874c419fe5936fcccadc7e6cf268e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3c04138a5bfe5d72780bb7e82a18e627"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/dac/test_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a> (int argc, char **argv)</td></tr>
<tr class="separator:a3c04138a5bfe5d72780bb7e82a18e627"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a529acbd1fed9d98a587edfa62309fa8d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../de/dd0/class_lib_home_screen.html">LibHomeScreen</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/dac/test_8cpp.html#a529acbd1fed9d98a587edfa62309fa8d">hs</a></td></tr>
<tr class="separator:a529acbd1fed9d98a587edfa62309fa8d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="aa9b3c43c212b49edee82ac30a11aa255"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa9b3c43c212b49edee82ac30a11aa255">&#9670;&nbsp;</a></span>call_test()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void call_test </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="../../df/dac/test_8cpp_source.html#l00051">51</a> of file <a class="el" href="../../df/dac/test_8cpp_source.html">test.cpp</a>.</p>
<div class="fragment"><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;{</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;    <span class="keywordtype">string</span> command;</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;    cout &lt;&lt; <span class="stringliteral">&quot;input verb and argments&quot;</span> &lt;&lt; endl;</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    <span class="comment">/* read the buffer */</span></div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    <span class="keywordflow">for</span>(;;){</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;        <span class="keywordtype">char</span> line[1023];</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;        cin.getline(line, <span class="keyword">sizeof</span>(line));</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;        command = line;</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;        <span class="keywordflow">if</span>(command.empty()){</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;            <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;        }</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;        vector&lt;string&gt; v_command = <a class="code" href="../../df/dac/test_8cpp.html#aafb7f182b8bb6ba92354dde1658d86a4">split</a>(command, <span class="charliteral">&#39; &#39;</span>);</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;        <span class="comment">/*for(auto itr = v_command.begin(); itr != v_command.end(); ++itr)</span></div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;<span class="comment">        {</span></div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;<span class="comment">            cout &lt;&lt; *itr &lt;&lt;endl;</span></div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<span class="comment">        }*/</span></div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;        <span class="keywordtype">size_t</span> num = v_command.size();</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;        <span class="keywordflow">if</span>(num % 2 == 0){</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;            cout &lt;&lt; <span class="stringliteral">&quot;If command contains args, please input &lt;key,value&gt; in argument part&quot;</span> &lt;&lt; endl;</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;            <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;        }</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;        <span class="comment">/* create json object */</span></div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;        <span class="keyword">struct </span>json_object* j_obj = json_object_new_object();</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 1;i &lt; (v_command.size()) ;++i){</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;            <span class="keyword">struct </span>json_object* val     = json_object_new_string(v_command[i+1].c_str());</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;            json_object_object_add(j_obj, v_command[i].c_str(), val);</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;            ++i;</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;        }</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;        <span class="comment">/* call verb via LibHomeScreen */</span></div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;        <a class="code" href="../../df/dac/test_8cpp.html#a529acbd1fed9d98a587edfa62309fa8d">hs</a>-&gt;<a class="code" href="../../de/dd0/class_lib_home_screen.html#a527b49dcfe581be6275d0eb2236ba37f">call</a>(v_command[0], j_obj);</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;        <span class="comment">/* free vector */</span></div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;        vector&lt;string&gt;().swap(v_command);</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;        string().swap(command);</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    }</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;}</div><div class="ttc" id="test_8cpp_html_aafb7f182b8bb6ba92354dde1658d86a4"><div class="ttname"><a href="../../df/dac/test_8cpp.html#aafb7f182b8bb6ba92354dde1658d86a4">split</a></div><div class="ttdeci">static vector&lt; string &gt; split(const string &amp;str, char sep)</div><div class="ttdef"><b>Definition:</b> <a href="../../df/dac/test_8cpp_source.html#l00105">test.cpp:105</a></div></div>
<div class="ttc" id="test_8cpp_html_a529acbd1fed9d98a587edfa62309fa8d"><div class="ttname"><a href="../../df/dac/test_8cpp.html#a529acbd1fed9d98a587edfa62309fa8d">hs</a></div><div class="ttdeci">LibHomeScreen * hs</div><div class="ttdef"><b>Definition:</b> <a href="../../df/dac/test_8cpp_source.html#l00033">test.cpp:33</a></div></div>
<div class="ttc" id="class_lib_home_screen_html_a527b49dcfe581be6275d0eb2236ba37f"><div class="ttname"><a href="../../de/dd0/class_lib_home_screen.html#a527b49dcfe581be6275d0eb2236ba37f">LibHomeScreen::call</a></div><div class="ttdeci">int call(const std::string &amp;verb, struct json_object *arg)</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="a3c04138a5bfe5d72780bb7e82a18e627"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3c04138a5bfe5d72780bb7e82a18e627">&#9670;&nbsp;</a></span>main()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int main </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>argc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char **&#160;</td>
          <td class="paramname"><em>argv</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="../../df/dac/test_8cpp_source.html#l00117">117</a> of file <a class="el" href="../../df/dac/test_8cpp_source.html">test.cpp</a>.</p>
<div class="fragment"><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;{</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;    <span class="keywordtype">int</span> ret;</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    <span class="keywordflow">if</span>(argc == 1)</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;    {</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;        printf(<span class="stringliteral">&quot;Please input port num in first argument, and token in second argument&quot;</span>);</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;        <a class="code" href="../../df/dac/test_8cpp.html#a64a6014565bb3e03294ec4a952d5add0">usage</a>();</div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;        <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;    }</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    <span class="keywordflow">if</span>(argc == 2)</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;    {</div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;        <span class="keywordtype">string</span> av(argv[1]);</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;        <span class="keywordflow">if</span>( (av == <span class="stringliteral">&quot;-h&quot;</span>) || (av == <span class="stringliteral">&quot;--help&quot;</span>))</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;        {</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;            <a class="code" href="../../df/dac/test_8cpp.html#a64a6014565bb3e03294ec4a952d5add0">usage</a>();</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;            <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;        }</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;    }</div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;    <span class="keywordtype">string</span> port_string(argv[1]);</div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;    <span class="keywordtype">string</span> token(argv[2]);</div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;    <span class="keywordtype">char</span>* endptr;</div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;    <span class="keywordtype">long</span> port = strtol(port_string.c_str(),&amp;endptr,10);</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;    <span class="comment">/* error check of range */</span></div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;    <span class="keywordflow">if</span>( (port &gt; 20000) || (port &lt; 0) )</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;    {</div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;        printf(<span class="stringliteral">&quot;input under 20000(temporary number)&quot;</span>);</div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;        <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;    }</div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;    <span class="keywordflow">if</span>(*endptr != <span class="charliteral">&#39;\0&#39;</span>)</div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;    {</div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;        printf(<span class="stringliteral">&quot;not number&quot;</span>);</div><div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;        <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;    }</div><div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;</div><div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;  cout &lt;&lt; <span class="stringliteral">&quot;Call test for LibHomeScreen&quot;</span> &lt;&lt; endl;</div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;    <a class="code" href="../../df/dac/test_8cpp.html#a529acbd1fed9d98a587edfa62309fa8d">hs</a> = <span class="keyword">new</span> <a class="code" href="../../de/dd0/class_lib_home_screen.html">LibHomeScreen</a>();</div><div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;  <a class="code" href="../../df/dac/test_8cpp.html#a529acbd1fed9d98a587edfa62309fa8d">hs</a>-&gt;<a class="code" href="../../de/dd0/class_lib_home_screen.html#a6a57b573cc767725762ba9beab032220">init</a>(port, token);</div><div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;</div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;    <span class="comment">// hs-&gt;registerCallback(&amp;onEv, &amp;onRep);</span></div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;  <span class="comment">//</span></div><div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;  <span class="comment">// hs-&gt;subscribe(event_list[0]); // tap_shortcut event subscribe</span></div><div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;  <span class="comment">// hs-&gt;subscribe(event_list[1]);</span></div><div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;</div><div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;  <a class="code" href="../../df/dac/test_8cpp.html#a529acbd1fed9d98a587edfa62309fa8d">hs</a>-&gt;<a class="code" href="../../de/dd0/class_lib_home_screen.html#ab1b0e08bf35415de9064afed899e9f85">set_event_handler</a>(<a class="code" href="../../de/dd0/class_lib_home_screen.html#a82616c91ac211d2ad08e709b524bf154a4b0a82d501e4db5fbfe25c254c92896f">LibHomeScreen::Event_TapShortcut</a>, [](json_object *<span class="keywordtype">object</span>){</div><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span> *application_name = json_object_get_string(</div><div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;        json_object_object_get(<span class="keywordtype">object</span>, <span class="stringliteral">&quot;application_name&quot;</span>));</div><div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;    cout &lt;&lt; <span class="stringliteral">&quot;set_event_handler Event_TapShortcut application_name = &quot;</span> &lt;&lt; application_name &lt;&lt; endl;</div><div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;  });</div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;</div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;  <a class="code" href="../../df/dac/test_8cpp.html#a529acbd1fed9d98a587edfa62309fa8d">hs</a>-&gt;<a class="code" href="../../de/dd0/class_lib_home_screen.html#ab1b0e08bf35415de9064afed899e9f85">set_event_handler</a>(<a class="code" href="../../de/dd0/class_lib_home_screen.html#a82616c91ac211d2ad08e709b524bf154aea56fa32a124a8ddcbea127755280a1d">LibHomeScreen::Event_OnScreenMessage</a>, [](json_object *<span class="keywordtype">object</span>){</div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span> *display_message = json_object_get_string(</div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;        json_object_object_get(<span class="keywordtype">object</span>, <span class="stringliteral">&quot;display_message&quot;</span>));</div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;    cout &lt;&lt; <span class="stringliteral">&quot;set_event_handler Event_OnScreenMessage display_message = &quot;</span> &lt;&lt; display_message &lt;&lt; endl;</div><div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;  });</div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;</div><div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;  <a class="code" href="../../df/dac/test_8cpp.html#a529acbd1fed9d98a587edfa62309fa8d">hs</a>-&gt;<a class="code" href="../../de/dd0/class_lib_home_screen.html#ab1b0e08bf35415de9064afed899e9f85">set_event_handler</a>(<a class="code" href="../../de/dd0/class_lib_home_screen.html#a82616c91ac211d2ad08e709b524bf154acae91db4efc2394fd701f581d277a3fd">LibHomeScreen::Event_OnScreenReply</a>, [](json_object *<span class="keywordtype">object</span>){</div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span> *reply_message = json_object_get_string(</div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;        json_object_object_get(<span class="keywordtype">object</span>, <span class="stringliteral">&quot;reply_message&quot;</span>));</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;    cout &lt;&lt; <span class="stringliteral">&quot;set_event_handler Event_OnScreenReply reply_message = &quot;</span> &lt;&lt; reply_message &lt;&lt; endl;</div><div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;  });</div><div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;</div><div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;    <span class="keywordflow">if</span> (ret &lt; 0) {</div><div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;        printf(<span class="stringliteral">&quot;failed to create event loop&quot;</span>);</div><div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;        <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;    }</div><div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;</div><div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;    <a class="code" href="../../df/dac/test_8cpp.html#aa9b3c43c212b49edee82ac30a11aa255">call_test</a>();</div><div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;</div><div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;    <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;}</div><div class="ttc" id="test_8cpp_html_a64a6014565bb3e03294ec4a952d5add0"><div class="ttname"><a href="../../df/dac/test_8cpp.html#a64a6014565bb3e03294ec4a952d5add0">usage</a></div><div class="ttdeci">static void usage()</div><div class="ttdef"><b>Definition:</b> <a href="../../df/dac/test_8cpp_source.html#l00035">test.cpp:35</a></div></div>
<div class="ttc" id="test_8cpp_html_a529acbd1fed9d98a587edfa62309fa8d"><div class="ttname"><a href="../../df/dac/test_8cpp.html#a529acbd1fed9d98a587edfa62309fa8d">hs</a></div><div class="ttdeci">LibHomeScreen * hs</div><div class="ttdef"><b>Definition:</b> <a href="../../df/dac/test_8cpp_source.html#l00033">test.cpp:33</a></div></div>
<div class="ttc" id="class_lib_home_screen_html_a82616c91ac211d2ad08e709b524bf154aea56fa32a124a8ddcbea127755280a1d"><div class="ttname"><a href="../../de/dd0/class_lib_home_screen.html#a82616c91ac211d2ad08e709b524bf154aea56fa32a124a8ddcbea127755280a1d">LibHomeScreen::Event_OnScreenMessage</a></div><div class="ttdef"><b>Definition:</b> <a href="../../df/d43/libhomescreen_8hpp_source.html#l00046">libhomescreen.hpp:46</a></div></div>
<div class="ttc" id="class_lib_home_screen_html_a82616c91ac211d2ad08e709b524bf154acae91db4efc2394fd701f581d277a3fd"><div class="ttname"><a href="../../de/dd0/class_lib_home_screen.html#a82616c91ac211d2ad08e709b524bf154acae91db4efc2394fd701f581d277a3fd">LibHomeScreen::Event_OnScreenReply</a></div><div class="ttdef"><b>Definition:</b> <a href="../../df/d43/libhomescreen_8hpp_source.html#l00047">libhomescreen.hpp:47</a></div></div>
<div class="ttc" id="test_8cpp_html_aa9b3c43c212b49edee82ac30a11aa255"><div class="ttname"><a href="../../df/dac/test_8cpp.html#aa9b3c43c212b49edee82ac30a11aa255">call_test</a></div><div class="ttdeci">static void call_test()</div><div class="ttdef"><b>Definition:</b> <a href="../../df/dac/test_8cpp_source.html#l00051">test.cpp:51</a></div></div>
<div class="ttc" id="class_lib_home_screen_html_a6a57b573cc767725762ba9beab032220"><div class="ttname"><a href="../../de/dd0/class_lib_home_screen.html#a6a57b573cc767725762ba9beab032220">LibHomeScreen::init</a></div><div class="ttdeci">int init(const int port, const std::string &amp;token)</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/d8a/libhomescreen_8cpp_source.html#l00116">libhomescreen.cpp:116</a></div></div>
<div class="ttc" id="class_lib_home_screen_html"><div class="ttname"><a href="../../de/dd0/class_lib_home_screen.html">LibHomeScreen</a></div><div class="ttdef"><b>Definition:</b> <a href="../../df/d43/libhomescreen_8hpp_source.html#l00032">libhomescreen.hpp:32</a></div></div>
<div class="ttc" id="class_lib_home_screen_html_ab1b0e08bf35415de9064afed899e9f85"><div class="ttname"><a href="../../de/dd0/class_lib_home_screen.html#ab1b0e08bf35415de9064afed899e9f85">LibHomeScreen::set_event_handler</a></div><div class="ttdeci">void set_event_handler(enum EventType et, handler_func f)</div><div class="ttdef"><b>Definition:</b> <a href="../../d0/d8a/libhomescreen_8cpp_source.html#l00293">libhomescreen.cpp:293</a></div></div>
<div class="ttc" id="class_lib_home_screen_html_a82616c91ac211d2ad08e709b524bf154a4b0a82d501e4db5fbfe25c254c92896f"><div class="ttname"><a href="../../de/dd0/class_lib_home_screen.html#a82616c91ac211d2ad08e709b524bf154a4b0a82d501e4db5fbfe25c254c92896f">LibHomeScreen::Event_TapShortcut</a></div><div class="ttdef"><b>Definition:</b> <a href="../../df/d43/libhomescreen_8hpp_source.html#l00045">libhomescreen.hpp:45</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a id="a6a2874c419fe5936fcccadc7e6cf268e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6a2874c419fe5936fcccadc7e6cf268e">&#9670;&nbsp;</a></span>onEv()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void onEv </td>
          <td>(</td>
          <td class="paramtype">const string &amp;&#160;</td>
          <td class="paramname"><em>event</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct json_object *&#160;</td>
          <td class="paramname"><em>event_contents</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="../../df/dac/test_8cpp_source.html#l00098">98</a> of file <a class="el" href="../../df/dac/test_8cpp_source.html">test.cpp</a>.</p>
<div class="fragment"><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;{</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span>* str = json_object_to_json_string(event_contents);</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    cout &lt;&lt; <span class="stringliteral">&quot;test.cpp [CB onEvent]: event:  &quot;</span> &lt;&lt; <span class="keyword">event</span>.c_str() &lt;&lt; <span class="stringliteral">&quot;  contents: &quot;</span> &lt;&lt; str &lt;&lt; endl;</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;    <span class="comment">//json_object_put(event_contents); do not release!!!</span></div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;}</div></div><!-- fragment -->
</div>
</div>
<a id="a6d3cb4886e7afd45bd56b49800da932d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6d3cb4886e7afd45bd56b49800da932d">&#9670;&nbsp;</a></span>onRep()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void onRep </td>
          <td>(</td>
          <td class="paramtype">struct json_object *&#160;</td>
          <td class="paramname"><em>reply_contents</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="../../df/dac/test_8cpp_source.html#l00091">91</a> of file <a class="el" href="../../df/dac/test_8cpp_source.html">test.cpp</a>.</p>
<div class="fragment"><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;{</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">char</span>* str = json_object_to_json_string(reply_contents);</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;    cout &lt;&lt; <span class="stringliteral">&quot;test.cpp [CB onRep]: &quot;</span> &lt;&lt; str &lt;&lt; endl;</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;    <span class="comment">//json_object_put(reply_contents); do not release!!!</span></div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;}</div></div><!-- fragment -->
</div>
</div>
<a id="aafb7f182b8bb6ba92354dde1658d86a4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aafb7f182b8bb6ba92354dde1658d86a4">&#9670;&nbsp;</a></span>split()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static vector&lt; string &gt; split </td>
          <td>(</td>
          <td class="paramtype">const string &amp;&#160;</td>
          <td class="paramname"><em>str</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char&#160;</td>
          <td class="paramname"><em>sep</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="../../df/dac/test_8cpp_source.html#l00105">105</a> of file <a class="el" href="../../df/dac/test_8cpp_source.html">test.cpp</a>.</p>
<div class="fragment"><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;{</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    vector&lt;string&gt; v;</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;    stringstream ss(str);</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;    <span class="keywordtype">string</span> buffer;</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;    <span class="keywordflow">while</span>( getline(ss, buffer, sep) ) {</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;        <span class="keywordflow">if</span>(!buffer.empty())</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;            v.push_back(buffer);</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;    }</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;    <span class="keywordflow">return</span> v;</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;}</div></div><!-- fragment -->
</div>
</div>
<a id="a64a6014565bb3e03294ec4a952d5add0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a64a6014565bb3e03294ec4a952d5add0">&#9670;&nbsp;</a></span>usage()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void usage </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="../../df/dac/test_8cpp_source.html#l00035">35</a> of file <a class="el" href="../../df/dac/test_8cpp_source.html">test.cpp</a>.</p>
<div class="fragment"><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;{</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    cout &lt;&lt; <span class="stringliteral">&quot;verb &quot;</span>&lt;&lt; <span class="stringliteral">&quot;key:arg&quot;</span> &lt;&lt; endl;</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    cout &lt;&lt; <span class="stringliteral">&quot;example:&quot;</span> &lt;&lt; endl;</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;    cout &lt;&lt; <span class="stringliteral">&quot;ping&quot;</span> &lt;&lt; endl;</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    cout &lt;&lt; <span class="stringliteral">&quot;------- -------- --- &quot;</span> &lt;&lt; endl;</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    cout &lt;&lt; <span class="stringliteral">&quot;  verb    key    value&quot;</span> &lt;&lt; endl;</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    cout &lt;&lt; <span class="stringliteral">&quot;verb list:&quot;</span> &lt;&lt; endl;</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;    <span class="keywordflow">for</span>(<span class="keyword">auto</span> itr = <a class="code" href="../../de/dd0/class_lib_home_screen.html#a5593ff5ac78f6495ccb649904cf0ab08">LibHomeScreen::api_list</a>.begin(); itr != <a class="code" href="../../de/dd0/class_lib_home_screen.html#a5593ff5ac78f6495ccb649904cf0ab08">LibHomeScreen::api_list</a>.end(); ++itr)</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;    {</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;        cout &lt;&lt; <span class="stringliteral">&quot;  &quot;</span> &lt;&lt; *itr &lt;&lt; endl;</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;    }</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    <span class="comment">// Todo output api list</span></div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;    exit(0);</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;}</div><div class="ttc" id="class_lib_home_screen_html_a5593ff5ac78f6495ccb649904cf0ab08"><div class="ttname"><a href="../../de/dd0/class_lib_home_screen.html#a5593ff5ac78f6495ccb649904cf0ab08">LibHomeScreen::api_list</a></div><div class="ttdeci">static const std::vector&lt; std::string &gt; api_list</div><div class="ttdef"><b>Definition:</b> <a href="../../df/d43/libhomescreen_8hpp_source.html#l00050">libhomescreen.hpp:50</a></div></div>
</div><!-- fragment -->
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="a529acbd1fed9d98a587edfa62309fa8d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a529acbd1fed9d98a587edfa62309fa8d">&#9670;&nbsp;</a></span>hs</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="../../de/dd0/class_lib_home_screen.html">LibHomeScreen</a>* hs</td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="../../df/dac/test_8cpp_source.html#l00033">33</a> of file <a class="el" href="../../df/dac/test_8cpp_source.html">test.cpp</a>.</p>

</div>
</div>
</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>