aboutsummaryrefslogtreecommitdiffstats
path: root/doc/api-ref/latex/d0/d1e/homescreen_8c.tex
blob: 93a160037d10353aba1de5163e649dca3de7a593 (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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
\hypertarget{homescreen_8c}{}\section{homescreen\+\_\+service/homescreen.c File Reference}
\label{homescreen_8c}\index{homescreen\+\_\+service/homescreen.\+c@{homescreen\+\_\+service/homescreen.\+c}}
{\ttfamily \#include $<$afb/afb-\/binding.\+h$>$}\newline
{\ttfamily \#include $<$stdio.\+h$>$}\newline
{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include $<$stdlib.\+h$>$}\newline
{\ttfamily \#include $<$stdint.\+h$>$}\newline
{\ttfamily \#include $<$unistd.\+h$>$}\newline
{\ttfamily \#include $<$json-\/c/json.\+h$>$}\newline
{\ttfamily \#include $<$glib.\+h$>$}\newline
{\ttfamily \#include $<$pthread.\+h$>$}\newline
{\ttfamily \#include \char`\"{}hs-\/helper.\+h\char`\"{}}\newline
\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structevent}{event}
\end{DoxyCompactItemize}
\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{homescreen_8c_a369266c24eacffb87046522897a570d5}{\+\_\+\+G\+N\+U\+\_\+\+S\+O\+U\+R\+CE}
\item 
\#define \hyperlink{homescreen_8c_ad2c1fbc92ba364fcf83f15e6d0af66f0}{A\+F\+B\+\_\+\+B\+I\+N\+D\+I\+N\+G\+\_\+\+V\+E\+R\+S\+I\+ON}~2
\item 
\#define \hyperlink{homescreen_8c_a09f43d9e7e1c5d2198c0d66024b4500e}{C\+O\+M\+M\+A\+N\+D\+\_\+\+E\+V\+E\+N\+T\+\_\+\+N\+UM}~3
\item 
\#define \hyperlink{homescreen_8c_a9a68ed04201d9390bb85b2c6ab1d7250}{E\+V\+E\+N\+T\+\_\+\+S\+U\+B\+S\+C\+R\+I\+B\+E\+\_\+\+E\+R\+R\+O\+R\+\_\+\+C\+O\+DE}~100
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static void \hyperlink{homescreen_8c_af48cab759d4ae0ddbfcdd60f4051ba05}{ping\+Sample} (struct afb\+\_\+req request)
\item 
static void \hyperlink{homescreen_8c_a096eae5c8f297f9df142a406eea56227}{tap\+\_\+shortcut} (struct afb\+\_\+req request)
\item 
static void \hyperlink{homescreen_8c_a640cf8ed97d804c5ed1c09a349056338}{on\+\_\+screen\+\_\+message} (struct afb\+\_\+req request)
\item 
static void \hyperlink{homescreen_8c_a4ff0c8b506669e5622a6ee168134d8f1}{subscribe} (struct afb\+\_\+req request)
\item 
static void \hyperlink{homescreen_8c_ab92621255d7370c6dd8a0f1a8e376ad3}{unsubscribe} (struct afb\+\_\+req request)
\item 
static int \hyperlink{homescreen_8c_a83d646edf54a6a082f69121bc89a08de}{preinit} ()
\item 
static int \hyperlink{homescreen_8c_a00cbbc0f3f4452db078ae511684a6adc}{init} ()
\item 
static void \hyperlink{homescreen_8c_a1279893c0fe937311a81e0a98fb4cf1c}{onevent} (const char $\ast$\hyperlink{structevent}{event}, struct json\+\_\+object $\ast$object)
\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
static struct \hyperlink{structevent}{event} \hyperlink{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}{event\+\_\+list} \mbox{[}\hyperlink{homescreen_8c_a09f43d9e7e1c5d2198c0d66024b4500e}{C\+O\+M\+M\+A\+N\+D\+\_\+\+E\+V\+E\+N\+T\+\_\+\+N\+UM}\mbox{]}
\item 
static struct afb\+\_\+event \hyperlink{homescreen_8c_a2af1ff5a4cbf03125e61e903832035f5}{ev\+\_\+tap\+\_\+shortcut}
\item 
static struct afb\+\_\+event \hyperlink{homescreen_8c_af7cfc4f688bb898c09291252c4cb832c}{ev\+\_\+on\+\_\+screen\+\_\+message}
\item 
static struct afb\+\_\+event \hyperlink{homescreen_8c_a25fbdcc4e5787e3f41d99f4a71e86611}{ev\+\_\+reserved}
\item 
static const char \hyperlink{homescreen_8c_aed1c5296a2e6d34945507a0fca17a376}{\+\_\+error} \mbox{[}$\,$\mbox{]} = \char`\"{}error\char`\"{}
\item 
static const char \hyperlink{homescreen_8c_a1f2c79fa6801b63751e270d67994fe81}{\+\_\+application\+\_\+name} \mbox{[}$\,$\mbox{]} = \char`\"{}application\+\_\+name\char`\"{}
\item 
static const char \hyperlink{homescreen_8c_abfd6c1d6f316fa952b11553f8f275e92}{\+\_\+display\+\_\+message} \mbox{[}$\,$\mbox{]} = \char`\"{}display\+\_\+message\char`\"{}
\item 
static const struct afb\+\_\+verb\+\_\+v2 \hyperlink{homescreen_8c_acad6dadf60fac3d701e488e4fcd11c89}{verbs} \mbox{[}$\,$\mbox{]}
\item 
const struct afb\+\_\+binding\+\_\+v2 \hyperlink{homescreen_8c_ae2a62ab481a2922cbfc788193857a12e}{afb\+Binding\+V2}
\end{DoxyCompactItemize}


\subsection{Macro Definition Documentation}
\mbox{\Hypertarget{homescreen_8c_a369266c24eacffb87046522897a570d5}\label{homescreen_8c_a369266c24eacffb87046522897a570d5}} 
\index{homescreen.\+c@{homescreen.\+c}!\+\_\+\+G\+N\+U\+\_\+\+S\+O\+U\+R\+CE@{\+\_\+\+G\+N\+U\+\_\+\+S\+O\+U\+R\+CE}}
\index{\+\_\+\+G\+N\+U\+\_\+\+S\+O\+U\+R\+CE@{\+\_\+\+G\+N\+U\+\_\+\+S\+O\+U\+R\+CE}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{\+\_\+\+G\+N\+U\+\_\+\+S\+O\+U\+R\+CE}{\_GNU\_SOURCE}}
{\footnotesize\ttfamily \#define \+\_\+\+G\+N\+U\+\_\+\+S\+O\+U\+R\+CE}



Definition at line 17 of file homescreen.\+c.

\mbox{\Hypertarget{homescreen_8c_ad2c1fbc92ba364fcf83f15e6d0af66f0}\label{homescreen_8c_ad2c1fbc92ba364fcf83f15e6d0af66f0}} 
\index{homescreen.\+c@{homescreen.\+c}!A\+F\+B\+\_\+\+B\+I\+N\+D\+I\+N\+G\+\_\+\+V\+E\+R\+S\+I\+ON@{A\+F\+B\+\_\+\+B\+I\+N\+D\+I\+N\+G\+\_\+\+V\+E\+R\+S\+I\+ON}}
\index{A\+F\+B\+\_\+\+B\+I\+N\+D\+I\+N\+G\+\_\+\+V\+E\+R\+S\+I\+ON@{A\+F\+B\+\_\+\+B\+I\+N\+D\+I\+N\+G\+\_\+\+V\+E\+R\+S\+I\+ON}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{A\+F\+B\+\_\+\+B\+I\+N\+D\+I\+N\+G\+\_\+\+V\+E\+R\+S\+I\+ON}{AFB\_BINDING\_VERSION}}
{\footnotesize\ttfamily \#define A\+F\+B\+\_\+\+B\+I\+N\+D\+I\+N\+G\+\_\+\+V\+E\+R\+S\+I\+ON~2}



Definition at line 18 of file homescreen.\+c.

\mbox{\Hypertarget{homescreen_8c_a09f43d9e7e1c5d2198c0d66024b4500e}\label{homescreen_8c_a09f43d9e7e1c5d2198c0d66024b4500e}} 
\index{homescreen.\+c@{homescreen.\+c}!C\+O\+M\+M\+A\+N\+D\+\_\+\+E\+V\+E\+N\+T\+\_\+\+N\+UM@{C\+O\+M\+M\+A\+N\+D\+\_\+\+E\+V\+E\+N\+T\+\_\+\+N\+UM}}
\index{C\+O\+M\+M\+A\+N\+D\+\_\+\+E\+V\+E\+N\+T\+\_\+\+N\+UM@{C\+O\+M\+M\+A\+N\+D\+\_\+\+E\+V\+E\+N\+T\+\_\+\+N\+UM}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{C\+O\+M\+M\+A\+N\+D\+\_\+\+E\+V\+E\+N\+T\+\_\+\+N\+UM}{COMMAND\_EVENT\_NUM}}
{\footnotesize\ttfamily \#define C\+O\+M\+M\+A\+N\+D\+\_\+\+E\+V\+E\+N\+T\+\_\+\+N\+UM~3}



Definition at line 31 of file homescreen.\+c.

\mbox{\Hypertarget{homescreen_8c_a9a68ed04201d9390bb85b2c6ab1d7250}\label{homescreen_8c_a9a68ed04201d9390bb85b2c6ab1d7250}} 
\index{homescreen.\+c@{homescreen.\+c}!E\+V\+E\+N\+T\+\_\+\+S\+U\+B\+S\+C\+R\+I\+B\+E\+\_\+\+E\+R\+R\+O\+R\+\_\+\+C\+O\+DE@{E\+V\+E\+N\+T\+\_\+\+S\+U\+B\+S\+C\+R\+I\+B\+E\+\_\+\+E\+R\+R\+O\+R\+\_\+\+C\+O\+DE}}
\index{E\+V\+E\+N\+T\+\_\+\+S\+U\+B\+S\+C\+R\+I\+B\+E\+\_\+\+E\+R\+R\+O\+R\+\_\+\+C\+O\+DE@{E\+V\+E\+N\+T\+\_\+\+S\+U\+B\+S\+C\+R\+I\+B\+E\+\_\+\+E\+R\+R\+O\+R\+\_\+\+C\+O\+DE}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{E\+V\+E\+N\+T\+\_\+\+S\+U\+B\+S\+C\+R\+I\+B\+E\+\_\+\+E\+R\+R\+O\+R\+\_\+\+C\+O\+DE}{EVENT\_SUBSCRIBE\_ERROR\_CODE}}
{\footnotesize\ttfamily \#define E\+V\+E\+N\+T\+\_\+\+S\+U\+B\+S\+C\+R\+I\+B\+E\+\_\+\+E\+R\+R\+O\+R\+\_\+\+C\+O\+DE~100}



Definition at line 32 of file homescreen.\+c.



\subsection{Function Documentation}
\mbox{\Hypertarget{homescreen_8c_a00cbbc0f3f4452db078ae511684a6adc}\label{homescreen_8c_a00cbbc0f3f4452db078ae511684a6adc}} 
\index{homescreen.\+c@{homescreen.\+c}!init@{init}}
\index{init@{init}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{init()}{init()}}
{\footnotesize\ttfamily static int init (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Definition at line 238 of file homescreen.\+c.


\begin{DoxyCode}
239 \{
240    AFB\_NOTICE(\textcolor{stringliteral}{"binding init"});
241 
242    \hyperlink{homescreen_8c_a2af1ff5a4cbf03125e61e903832035f5}{ev\_tap\_shortcut} = afb\_daemon\_make\_event(\hyperlink{hs-helper_8h_a0cd84b1a2184c9b84d1b7bf24582f28e}{evlist}[0]);
243    \hyperlink{homescreen_8c_af7cfc4f688bb898c09291252c4cb832c}{ev\_on\_screen\_message} = afb\_daemon\_make\_event(\hyperlink{hs-helper_8h_a0cd84b1a2184c9b84d1b7bf24582f28e}{evlist}[1]);
244    \hyperlink{homescreen_8c_a25fbdcc4e5787e3f41d99f4a71e86611}{ev\_reserved} = afb\_daemon\_make\_event(\hyperlink{hs-helper_8h_a0cd84b1a2184c9b84d1b7bf24582f28e}{evlist}[2]);
245 
246    \hyperlink{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}{event\_list}[0].\hyperlink{structevent_a45c6cfb7961a21a3366db067e4cc59ab}{name} = \hyperlink{hs-helper_8h_a0cd84b1a2184c9b84d1b7bf24582f28e}{evlist}[0];
247    \hyperlink{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}{event\_list}[0].\hyperlink{structevent_a58726ebc551d36562ac3f9e1fe293214}{event} = &\hyperlink{homescreen_8c_a2af1ff5a4cbf03125e61e903832035f5}{ev\_tap\_shortcut};
248 
249    \hyperlink{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}{event\_list}[1].\hyperlink{structevent_a45c6cfb7961a21a3366db067e4cc59ab}{name} = \hyperlink{hs-helper_8h_a0cd84b1a2184c9b84d1b7bf24582f28e}{evlist}[1];
250    \hyperlink{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}{event\_list}[1].\hyperlink{structevent_a58726ebc551d36562ac3f9e1fe293214}{event} = &\hyperlink{homescreen_8c_af7cfc4f688bb898c09291252c4cb832c}{ev\_on\_screen\_message};
251 
252    \hyperlink{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}{event\_list}[2].\hyperlink{structevent_a45c6cfb7961a21a3366db067e4cc59ab}{name} = \hyperlink{hs-helper_8h_a0cd84b1a2184c9b84d1b7bf24582f28e}{evlist}[2];
253    \hyperlink{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}{event\_list}[2].\hyperlink{structevent_a58726ebc551d36562ac3f9e1fe293214}{event} = &\hyperlink{homescreen_8c_a25fbdcc4e5787e3f41d99f4a71e86611}{ev\_reserved};
254 
255    \textcolor{keywordflow}{return} 0;
256 \}
\end{DoxyCode}
\mbox{\Hypertarget{homescreen_8c_a640cf8ed97d804c5ed1c09a349056338}\label{homescreen_8c_a640cf8ed97d804c5ed1c09a349056338}} 
\index{homescreen.\+c@{homescreen.\+c}!on\+\_\+screen\+\_\+message@{on\+\_\+screen\+\_\+message}}
\index{on\+\_\+screen\+\_\+message@{on\+\_\+screen\+\_\+message}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{on\+\_\+screen\+\_\+message()}{on\_screen\_message()}}
{\footnotesize\ttfamily static void on\+\_\+screen\+\_\+message (\begin{DoxyParamCaption}\item[{struct afb\+\_\+req}]{request }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}

Home\+Screenの\+On\+Screenを表示する

\subparagraph*{Parameters}

Request key
\begin{DoxyItemize}
\item display\+\_\+message \+: 表示したい文字列
\end{DoxyItemize}

\subparagraph*{Return}

Nothing 

Definition at line 113 of file homescreen.\+c.


\begin{DoxyCode}
114 \{
115     AFB\_NOTICE(\textcolor{stringliteral}{"%s is called."}, \_\_FUNCTION\_\_);
116 
117     \textcolor{keywordtype}{int} ret = 0;
118     \textcolor{keyword}{const} \textcolor{keywordtype}{char}* value = afb\_req\_value(request, \hyperlink{homescreen_8c_abfd6c1d6f316fa952b11553f8f275e92}{\_display\_message});
119     \textcolor{keywordflow}{if} (value) \{
120 
121       AFB\_NOTICE(\textcolor{stringliteral}{"request params = %s."}, value);
122 
123       \textcolor{keyword}{struct }json\_object* push\_obj = json\_object\_new\_object();
124       \hyperlink{hs-helper_8c_a8777c53f1d4d5412f19b134ad85ffedf}{hs\_add\_object\_to\_json\_object\_str}( push\_obj, 2,
125       \hyperlink{homescreen_8c_abfd6c1d6f316fa952b11553f8f275e92}{\_display\_message}, value);
126       afb\_event\_push(\hyperlink{homescreen_8c_af7cfc4f688bb898c09291252c4cb832c}{ev\_on\_screen\_message}, push\_obj);
127     \} \textcolor{keywordflow}{else} \{
128       afb\_req\_fail\_f(request, \textcolor{stringliteral}{"failed"}, \textcolor{stringliteral}{"called %s, Unknown palameter"}, \_\_FUNCTION\_\_);
129       \textcolor{keywordflow}{return};
130     \}
131 
132   \textcolor{comment}{// HomeScreenに返すレスポンス}
133     \textcolor{keyword}{struct }json\_object *res = json\_object\_new\_object();
134     \hyperlink{hs-helper_8c_ae83604a37134e7bdee3ce4f10bb0b47a}{hs\_add\_object\_to\_json\_object\_func}(res, \_\_FUNCTION\_\_, 2,
135       \hyperlink{homescreen_8c_aed1c5296a2e6d34945507a0fca17a376}{\_error},  ret);
136     afb\_req\_success(request, res, \textcolor{stringliteral}{"afb\_event\_push event [on\_screen\_message]"});
137 \}
\end{DoxyCode}
\mbox{\Hypertarget{homescreen_8c_a1279893c0fe937311a81e0a98fb4cf1c}\label{homescreen_8c_a1279893c0fe937311a81e0a98fb4cf1c}} 
\index{homescreen.\+c@{homescreen.\+c}!onevent@{onevent}}
\index{onevent@{onevent}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{onevent()}{onevent()}}
{\footnotesize\ttfamily static void onevent (\begin{DoxyParamCaption}\item[{const char $\ast$}]{event,  }\item[{struct json\+\_\+object $\ast$}]{object }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Definition at line 258 of file homescreen.\+c.


\begin{DoxyCode}
259 \{
260    AFB\_NOTICE(\textcolor{stringliteral}{"on\_event %s"}, \hyperlink{structevent}{event});
261 \}
\end{DoxyCode}
\mbox{\Hypertarget{homescreen_8c_af48cab759d4ae0ddbfcdd60f4051ba05}\label{homescreen_8c_af48cab759d4ae0ddbfcdd60f4051ba05}} 
\index{homescreen.\+c@{homescreen.\+c}!ping\+Sample@{ping\+Sample}}
\index{ping\+Sample@{ping\+Sample}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{ping\+Sample()}{pingSample()}}
{\footnotesize\ttfamily static void ping\+Sample (\begin{DoxyParamCaption}\item[{struct afb\+\_\+req}]{request }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Definition at line 55 of file homescreen.\+c.


\begin{DoxyCode}
56 \{
57    \textcolor{keyword}{static} \textcolor{keywordtype}{int} pingcount = 0;
58    afb\_req\_success\_f(request, json\_object\_new\_int(pingcount), \textcolor{stringliteral}{"Ping count = %d"}, pingcount);
59    AFB\_NOTICE(\textcolor{stringliteral}{"Verbosity macro at level notice invoked at ping invocation count = %d"}, pingcount);
60    pingcount++;
61 \}
\end{DoxyCode}
\mbox{\Hypertarget{homescreen_8c_a83d646edf54a6a082f69121bc89a08de}\label{homescreen_8c_a83d646edf54a6a082f69121bc89a08de}} 
\index{homescreen.\+c@{homescreen.\+c}!preinit@{preinit}}
\index{preinit@{preinit}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{preinit()}{preinit()}}
{\footnotesize\ttfamily static int preinit (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Definition at line 232 of file homescreen.\+c.


\begin{DoxyCode}
233 \{
234    AFB\_NOTICE(\textcolor{stringliteral}{"binding preinit (was register)"});
235    \textcolor{keywordflow}{return} 0;
236 \}
\end{DoxyCode}
\mbox{\Hypertarget{homescreen_8c_a4ff0c8b506669e5622a6ee168134d8f1}\label{homescreen_8c_a4ff0c8b506669e5622a6ee168134d8f1}} 
\index{homescreen.\+c@{homescreen.\+c}!subscribe@{subscribe}}
\index{subscribe@{subscribe}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{subscribe()}{subscribe()}}
{\footnotesize\ttfamily static void subscribe (\begin{DoxyParamCaption}\item[{struct afb\+\_\+req}]{request }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}

Subscribe event

\subparagraph*{Parameters}


\begin{DoxyItemize}
\item event \+: Event name. Event list is written in \hyperlink{libhomescreen_8cpp}{libhomescreen.\+cpp}
\end{DoxyItemize}

\subparagraph*{Return}

Nothing

\subparagraph*{Note}

Definition at line 151 of file homescreen.\+c.


\begin{DoxyCode}
152 \{
153     \textcolor{keyword}{const} \textcolor{keywordtype}{char} *value = afb\_req\_value(request, \textcolor{stringliteral}{"event"});
154     AFB\_NOTICE(\textcolor{stringliteral}{"value is %s"}, value);
155     \textcolor{keywordtype}{int} ret = 0;
156     \textcolor{keywordflow}{if}(value) \{
157         \textcolor{keywordtype}{int} index = \hyperlink{hs-helper_8c_a2ff1b894941c3b461ca8119079c4146a}{hs\_search\_event\_name\_index}(value);
158         \textcolor{keywordflow}{if}(index < 0)
159         \{
160             AFB\_NOTICE(\textcolor{stringliteral}{"dedicated event doesn't exist"});
161             ret = \hyperlink{homescreen_8c_a9a68ed04201d9390bb85b2c6ab1d7250}{EVENT\_SUBSCRIBE\_ERROR\_CODE};
162         \}
163         \textcolor{keywordflow}{else}
164         \{
165             afb\_req\_subscribe(request, *\hyperlink{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}{event\_list}[index].\hyperlink{structevent}{event});
166         \}
167     \}
168     \textcolor{keywordflow}{else}\{
169         AFB\_NOTICE(\textcolor{stringliteral}{"Please input event name"});
170         ret = \hyperlink{homescreen_8c_a9a68ed04201d9390bb85b2c6ab1d7250}{EVENT\_SUBSCRIBE\_ERROR\_CODE};
171     \}
172     \textcolor{comment}{/*create response json object*/}
173     \textcolor{keyword}{struct }json\_object *res = json\_object\_new\_object();
174     \hyperlink{hs-helper_8c_ae83604a37134e7bdee3ce4f10bb0b47a}{hs\_add\_object\_to\_json\_object\_func}(res, \_\_FUNCTION\_\_, 2,
175         \hyperlink{homescreen_8c_aed1c5296a2e6d34945507a0fca17a376}{\_error}, ret);
176     afb\_req\_success\_f(request, res, \textcolor{stringliteral}{"homescreen binder subscribe event name [%s]"}, value);
177 \}
\end{DoxyCode}
\mbox{\Hypertarget{homescreen_8c_a096eae5c8f297f9df142a406eea56227}\label{homescreen_8c_a096eae5c8f297f9df142a406eea56227}} 
\index{homescreen.\+c@{homescreen.\+c}!tap\+\_\+shortcut@{tap\+\_\+shortcut}}
\index{tap\+\_\+shortcut@{tap\+\_\+shortcut}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{tap\+\_\+shortcut()}{tap\_shortcut()}}
{\footnotesize\ttfamily static void tap\+\_\+shortcut (\begin{DoxyParamCaption}\item[{struct afb\+\_\+req}]{request }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}

Home\+Screenから呼ばれる ショートカットがタップされたことをアプリケーションに通知するために使用する アプリケーションからは使用されない

\subparagraph*{Parameters}

Request key
\begin{DoxyItemize}
\item application\+\_\+name \+: アプリケーション名
\end{DoxyItemize}

\subparagraph*{Return}

Nothing 

Definition at line 76 of file homescreen.\+c.


\begin{DoxyCode}
77 \{
78     AFB\_NOTICE(\textcolor{stringliteral}{"%s is called."}, \_\_FUNCTION\_\_);
79 
80     \textcolor{keywordtype}{int} ret = 0;
81     \textcolor{keyword}{const} \textcolor{keywordtype}{char}* value = afb\_req\_value(request, \hyperlink{homescreen_8c_a1f2c79fa6801b63751e270d67994fe81}{\_application\_name});
82     \textcolor{keywordflow}{if} (value) \{
83 
84       AFB\_NOTICE(\textcolor{stringliteral}{"request params = %s."}, value);
85 
86       \textcolor{keyword}{struct }json\_object* push\_obj = json\_object\_new\_object();
87       \hyperlink{hs-helper_8c_a8777c53f1d4d5412f19b134ad85ffedf}{hs\_add\_object\_to\_json\_object\_str}( push\_obj, 2,
88       \hyperlink{homescreen_8c_a1f2c79fa6801b63751e270d67994fe81}{\_application\_name}, value);
89       afb\_event\_push(\hyperlink{homescreen_8c_a2af1ff5a4cbf03125e61e903832035f5}{ev\_tap\_shortcut}, push\_obj);
90     \} \textcolor{keywordflow}{else} \{
91       afb\_req\_fail\_f(request, \textcolor{stringliteral}{"failed"}, \textcolor{stringliteral}{"called %s, Unknown palameter"}, \_\_FUNCTION\_\_);
92       \textcolor{keywordflow}{return};
93     \}
94 
95   \textcolor{comment}{// HomeScreenに返すレスポンス}
96     \textcolor{keyword}{struct }json\_object *res = json\_object\_new\_object();
97     \hyperlink{hs-helper_8c_ae83604a37134e7bdee3ce4f10bb0b47a}{hs\_add\_object\_to\_json\_object\_func}(res, \_\_FUNCTION\_\_, 2,
98       \hyperlink{homescreen_8c_aed1c5296a2e6d34945507a0fca17a376}{\_error},  ret);
99     afb\_req\_success(request, res, \textcolor{stringliteral}{"afb\_event\_push event [tap\_shortcut]"});
100 \}
\end{DoxyCode}
\mbox{\Hypertarget{homescreen_8c_ab92621255d7370c6dd8a0f1a8e376ad3}\label{homescreen_8c_ab92621255d7370c6dd8a0f1a8e376ad3}} 
\index{homescreen.\+c@{homescreen.\+c}!unsubscribe@{unsubscribe}}
\index{unsubscribe@{unsubscribe}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{unsubscribe()}{unsubscribe()}}
{\footnotesize\ttfamily static void unsubscribe (\begin{DoxyParamCaption}\item[{struct afb\+\_\+req}]{request }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}

Unsubscribe event

\subparagraph*{Parameters}


\begin{DoxyItemize}
\item event \+: Event name. Event list is written in \hyperlink{libhomescreen_8cpp}{libhomescreen.\+cpp}
\end{DoxyItemize}

\subparagraph*{Return}

Nothing

\subparagraph*{Note}

Definition at line 191 of file homescreen.\+c.


\begin{DoxyCode}
192 \{
193     \textcolor{keyword}{const} \textcolor{keywordtype}{char} *value = afb\_req\_value(request, \textcolor{stringliteral}{"event"});
194     AFB\_NOTICE(\textcolor{stringliteral}{"value is %s"}, value);
195     \textcolor{keywordtype}{int} ret = 0;
196     \textcolor{keywordflow}{if}(value) \{
197         \textcolor{keywordtype}{int} index = \hyperlink{hs-helper_8c_a2ff1b894941c3b461ca8119079c4146a}{hs\_search\_event\_name\_index}(value);
198         \textcolor{keywordflow}{if}(index < 0)
199         \{
200             AFB\_NOTICE(\textcolor{stringliteral}{"dedicated event doesn't exist"});
201             ret = \hyperlink{homescreen_8c_a9a68ed04201d9390bb85b2c6ab1d7250}{EVENT\_SUBSCRIBE\_ERROR\_CODE};
202         \}
203         \textcolor{keywordflow}{else}
204         \{
205             afb\_req\_unsubscribe(request, *\hyperlink{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}{event\_list}[index].\hyperlink{structevent}{event});
206         \}
207     \}
208     \textcolor{keywordflow}{else}\{
209         AFB\_NOTICE(\textcolor{stringliteral}{"Please input event name"});
210         ret = \hyperlink{homescreen_8c_a9a68ed04201d9390bb85b2c6ab1d7250}{EVENT\_SUBSCRIBE\_ERROR\_CODE};
211     \}
212     \textcolor{comment}{/*create response json object*/}
213     \textcolor{keyword}{struct }json\_object *res = json\_object\_new\_object();
214     \hyperlink{hs-helper_8c_ae83604a37134e7bdee3ce4f10bb0b47a}{hs\_add\_object\_to\_json\_object\_func}(res, \_\_FUNCTION\_\_, 2,
215         \hyperlink{homescreen_8c_aed1c5296a2e6d34945507a0fca17a376}{\_error}, ret);
216     afb\_req\_success\_f(request, res, \textcolor{stringliteral}{"homescreen binder unsubscribe event name [%s]"}, value);
217 \}
\end{DoxyCode}


\subsection{Variable Documentation}
\mbox{\Hypertarget{homescreen_8c_a1f2c79fa6801b63751e270d67994fe81}\label{homescreen_8c_a1f2c79fa6801b63751e270d67994fe81}} 
\index{homescreen.\+c@{homescreen.\+c}!\+\_\+application\+\_\+name@{\+\_\+application\+\_\+name}}
\index{\+\_\+application\+\_\+name@{\+\_\+application\+\_\+name}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{\+\_\+application\+\_\+name}{\_application\_name}}
{\footnotesize\ttfamily const char \+\_\+application\+\_\+name\mbox{[}$\,$\mbox{]} = \char`\"{}application\+\_\+name\char`\"{}\hspace{0.3cm}{\ttfamily [static]}}



Definition at line 48 of file homescreen.\+c.

\mbox{\Hypertarget{homescreen_8c_abfd6c1d6f316fa952b11553f8f275e92}\label{homescreen_8c_abfd6c1d6f316fa952b11553f8f275e92}} 
\index{homescreen.\+c@{homescreen.\+c}!\+\_\+display\+\_\+message@{\+\_\+display\+\_\+message}}
\index{\+\_\+display\+\_\+message@{\+\_\+display\+\_\+message}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{\+\_\+display\+\_\+message}{\_display\_message}}
{\footnotesize\ttfamily const char \+\_\+display\+\_\+message\mbox{[}$\,$\mbox{]} = \char`\"{}display\+\_\+message\char`\"{}\hspace{0.3cm}{\ttfamily [static]}}



Definition at line 49 of file homescreen.\+c.

\mbox{\Hypertarget{homescreen_8c_aed1c5296a2e6d34945507a0fca17a376}\label{homescreen_8c_aed1c5296a2e6d34945507a0fca17a376}} 
\index{homescreen.\+c@{homescreen.\+c}!\+\_\+error@{\+\_\+error}}
\index{\+\_\+error@{\+\_\+error}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{\+\_\+error}{\_error}}
{\footnotesize\ttfamily const char \+\_\+error\mbox{[}$\,$\mbox{]} = \char`\"{}error\char`\"{}\hspace{0.3cm}{\ttfamily [static]}}



Definition at line 46 of file homescreen.\+c.

\mbox{\Hypertarget{homescreen_8c_ae2a62ab481a2922cbfc788193857a12e}\label{homescreen_8c_ae2a62ab481a2922cbfc788193857a12e}} 
\index{homescreen.\+c@{homescreen.\+c}!afb\+Binding\+V2@{afb\+Binding\+V2}}
\index{afb\+Binding\+V2@{afb\+Binding\+V2}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{afb\+Binding\+V2}{afbBindingV2}}
{\footnotesize\ttfamily const struct afb\+\_\+binding\+\_\+v2 afb\+Binding\+V2}

{\bfseries Initial value\+:}
\begin{DoxyCode}
= \{
    .api = \textcolor{stringliteral}{"homescreen"},
    .specification = NULL,
    .verbs = \hyperlink{homescreen_8c_acad6dadf60fac3d701e488e4fcd11c89}{verbs},
    .preinit = \hyperlink{homescreen_8c_a83d646edf54a6a082f69121bc89a08de}{preinit},
    .init = \hyperlink{homescreen_8c_a00cbbc0f3f4452db078ae511684a6adc}{init},
    .onevent = \hyperlink{homescreen_8c_a1279893c0fe937311a81e0a98fb4cf1c}{onevent}
\}
\end{DoxyCode}


Definition at line 263 of file homescreen.\+c.

\mbox{\Hypertarget{homescreen_8c_af7cfc4f688bb898c09291252c4cb832c}\label{homescreen_8c_af7cfc4f688bb898c09291252c4cb832c}} 
\index{homescreen.\+c@{homescreen.\+c}!ev\+\_\+on\+\_\+screen\+\_\+message@{ev\+\_\+on\+\_\+screen\+\_\+message}}
\index{ev\+\_\+on\+\_\+screen\+\_\+message@{ev\+\_\+on\+\_\+screen\+\_\+message}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{ev\+\_\+on\+\_\+screen\+\_\+message}{ev\_on\_screen\_message}}
{\footnotesize\ttfamily struct afb\+\_\+event ev\+\_\+on\+\_\+screen\+\_\+message\hspace{0.3cm}{\ttfamily [static]}}



Definition at line 43 of file homescreen.\+c.

\mbox{\Hypertarget{homescreen_8c_a25fbdcc4e5787e3f41d99f4a71e86611}\label{homescreen_8c_a25fbdcc4e5787e3f41d99f4a71e86611}} 
\index{homescreen.\+c@{homescreen.\+c}!ev\+\_\+reserved@{ev\+\_\+reserved}}
\index{ev\+\_\+reserved@{ev\+\_\+reserved}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{ev\+\_\+reserved}{ev\_reserved}}
{\footnotesize\ttfamily struct afb\+\_\+event ev\+\_\+reserved\hspace{0.3cm}{\ttfamily [static]}}



Definition at line 44 of file homescreen.\+c.

\mbox{\Hypertarget{homescreen_8c_a2af1ff5a4cbf03125e61e903832035f5}\label{homescreen_8c_a2af1ff5a4cbf03125e61e903832035f5}} 
\index{homescreen.\+c@{homescreen.\+c}!ev\+\_\+tap\+\_\+shortcut@{ev\+\_\+tap\+\_\+shortcut}}
\index{ev\+\_\+tap\+\_\+shortcut@{ev\+\_\+tap\+\_\+shortcut}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{ev\+\_\+tap\+\_\+shortcut}{ev\_tap\_shortcut}}
{\footnotesize\ttfamily struct afb\+\_\+event ev\+\_\+tap\+\_\+shortcut\hspace{0.3cm}{\ttfamily [static]}}



Definition at line 42 of file homescreen.\+c.

\mbox{\Hypertarget{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}\label{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}} 
\index{homescreen.\+c@{homescreen.\+c}!event\+\_\+list@{event\+\_\+list}}
\index{event\+\_\+list@{event\+\_\+list}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{event\+\_\+list}{event\_list}}
{\footnotesize\ttfamily struct \hyperlink{structevent}{event} event\+\_\+list\mbox{[}\hyperlink{homescreen_8c_a09f43d9e7e1c5d2198c0d66024b4500e}{C\+O\+M\+M\+A\+N\+D\+\_\+\+E\+V\+E\+N\+T\+\_\+\+N\+UM}\mbox{]}\hspace{0.3cm}{\ttfamily [static]}}



Definition at line 40 of file homescreen.\+c.

\mbox{\Hypertarget{homescreen_8c_acad6dadf60fac3d701e488e4fcd11c89}\label{homescreen_8c_acad6dadf60fac3d701e488e4fcd11c89}} 
\index{homescreen.\+c@{homescreen.\+c}!verbs@{verbs}}
\index{verbs@{verbs}!homescreen.\+c@{homescreen.\+c}}
\subsubsection{\texorpdfstring{verbs}{verbs}}
{\footnotesize\ttfamily const struct afb\+\_\+verb\+\_\+v2 verbs\mbox{[}$\,$\mbox{]}\hspace{0.3cm}{\ttfamily [static]}}

{\bfseries Initial value\+:}
\begin{DoxyCode}
= \{
    
    \{ .verb = \textcolor{stringliteral}{"ping"},              .session = AFB\_SESSION\_NONE,    .callback = 
      \hyperlink{homescreen_8c_af48cab759d4ae0ddbfcdd60f4051ba05}{pingSample},        .auth = NULL \},
    \{ .verb = \textcolor{stringliteral}{"tap\_shortcut"},      .session = AFB\_SESSION\_NONE,    .callback = 
      \hyperlink{homescreen_8c_a096eae5c8f297f9df142a406eea56227}{tap\_shortcut},      .auth = NULL \},
    \{ .verb = \textcolor{stringliteral}{"on\_screen\_message"}, .session = AFB\_SESSION\_NONE,    .callback = 
      \hyperlink{homescreen_8c_a640cf8ed97d804c5ed1c09a349056338}{on\_screen\_message}, .auth = NULL \},
    \{ .verb = \textcolor{stringliteral}{"subscribe"},         .session = AFB\_SESSION\_NONE,    .callback = 
      \hyperlink{homescreen_8c_a4ff0c8b506669e5622a6ee168134d8f1}{subscribe},         .auth = NULL \},
    \{ .verb = \textcolor{stringliteral}{"unsubscribe"},       .session = AFB\_SESSION\_NONE,    .callback = 
      \hyperlink{homescreen_8c_ab92621255d7370c6dd8a0f1a8e376ad3}{unsubscribe},       .auth = NULL \},
    \{NULL \} 
\}
\end{DoxyCode}


Definition at line 222 of file homescreen.\+c.