93a160037d10353aba1de5163e649dca3de7a593
[apps/agl-service-homescreen.git] / doc / api-ref / latex / d0 / d1e / homescreen_8c.tex
1 \hypertarget{homescreen_8c}{}\section{homescreen\+\_\+service/homescreen.c File Reference}
2 \label{homescreen_8c}\index{homescreen\+\_\+service/homescreen.\+c@{homescreen\+\_\+service/homescreen.\+c}}
3 {\ttfamily \#include $<$afb/afb-\/binding.\+h$>$}\newline
4 {\ttfamily \#include $<$stdio.\+h$>$}\newline
5 {\ttfamily \#include $<$string.\+h$>$}\newline
6 {\ttfamily \#include $<$stdlib.\+h$>$}\newline
7 {\ttfamily \#include $<$stdint.\+h$>$}\newline
8 {\ttfamily \#include $<$unistd.\+h$>$}\newline
9 {\ttfamily \#include $<$json-\/c/json.\+h$>$}\newline
10 {\ttfamily \#include $<$glib.\+h$>$}\newline
11 {\ttfamily \#include $<$pthread.\+h$>$}\newline
12 {\ttfamily \#include \char`\"{}hs-\/helper.\+h\char`\"{}}\newline
13 \subsection*{Classes}
14 \begin{DoxyCompactItemize}
15 \item 
16 struct \hyperlink{structevent}{event}
17 \end{DoxyCompactItemize}
18 \subsection*{Macros}
19 \begin{DoxyCompactItemize}
20 \item 
21 \#define \hyperlink{homescreen_8c_a369266c24eacffb87046522897a570d5}{\+\_\+\+G\+N\+U\+\_\+\+S\+O\+U\+R\+CE}
22 \item 
23 \#define \hyperlink{homescreen_8c_ad2c1fbc92ba364fcf83f15e6d0af66f0}{A\+F\+B\+\_\+\+B\+I\+N\+D\+I\+N\+G\+\_\+\+V\+E\+R\+S\+I\+ON}~2
24 \item 
25 \#define \hyperlink{homescreen_8c_a09f43d9e7e1c5d2198c0d66024b4500e}{C\+O\+M\+M\+A\+N\+D\+\_\+\+E\+V\+E\+N\+T\+\_\+\+N\+UM}~3
26 \item 
27 \#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
28 \end{DoxyCompactItemize}
29 \subsection*{Functions}
30 \begin{DoxyCompactItemize}
31 \item 
32 static void \hyperlink{homescreen_8c_af48cab759d4ae0ddbfcdd60f4051ba05}{ping\+Sample} (struct afb\+\_\+req request)
33 \item 
34 static void \hyperlink{homescreen_8c_a096eae5c8f297f9df142a406eea56227}{tap\+\_\+shortcut} (struct afb\+\_\+req request)
35 \item 
36 static void \hyperlink{homescreen_8c_a640cf8ed97d804c5ed1c09a349056338}{on\+\_\+screen\+\_\+message} (struct afb\+\_\+req request)
37 \item 
38 static void \hyperlink{homescreen_8c_a4ff0c8b506669e5622a6ee168134d8f1}{subscribe} (struct afb\+\_\+req request)
39 \item 
40 static void \hyperlink{homescreen_8c_ab92621255d7370c6dd8a0f1a8e376ad3}{unsubscribe} (struct afb\+\_\+req request)
41 \item 
42 static int \hyperlink{homescreen_8c_a83d646edf54a6a082f69121bc89a08de}{preinit} ()
43 \item 
44 static int \hyperlink{homescreen_8c_a00cbbc0f3f4452db078ae511684a6adc}{init} ()
45 \item 
46 static void \hyperlink{homescreen_8c_a1279893c0fe937311a81e0a98fb4cf1c}{onevent} (const char $\ast$\hyperlink{structevent}{event}, struct json\+\_\+object $\ast$object)
47 \end{DoxyCompactItemize}
48 \subsection*{Variables}
49 \begin{DoxyCompactItemize}
50 \item 
51 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{]}
52 \item 
53 static struct afb\+\_\+event \hyperlink{homescreen_8c_a2af1ff5a4cbf03125e61e903832035f5}{ev\+\_\+tap\+\_\+shortcut}
54 \item 
55 static struct afb\+\_\+event \hyperlink{homescreen_8c_af7cfc4f688bb898c09291252c4cb832c}{ev\+\_\+on\+\_\+screen\+\_\+message}
56 \item 
57 static struct afb\+\_\+event \hyperlink{homescreen_8c_a25fbdcc4e5787e3f41d99f4a71e86611}{ev\+\_\+reserved}
58 \item 
59 static const char \hyperlink{homescreen_8c_aed1c5296a2e6d34945507a0fca17a376}{\+\_\+error} \mbox{[}$\,$\mbox{]} = \char`\"{}error\char`\"{}
60 \item 
61 static const char \hyperlink{homescreen_8c_a1f2c79fa6801b63751e270d67994fe81}{\+\_\+application\+\_\+name} \mbox{[}$\,$\mbox{]} = \char`\"{}application\+\_\+name\char`\"{}
62 \item 
63 static const char \hyperlink{homescreen_8c_abfd6c1d6f316fa952b11553f8f275e92}{\+\_\+display\+\_\+message} \mbox{[}$\,$\mbox{]} = \char`\"{}display\+\_\+message\char`\"{}
64 \item 
65 static const struct afb\+\_\+verb\+\_\+v2 \hyperlink{homescreen_8c_acad6dadf60fac3d701e488e4fcd11c89}{verbs} \mbox{[}$\,$\mbox{]}
66 \item 
67 const struct afb\+\_\+binding\+\_\+v2 \hyperlink{homescreen_8c_ae2a62ab481a2922cbfc788193857a12e}{afb\+Binding\+V2}
68 \end{DoxyCompactItemize}
69
70
71 \subsection{Macro Definition Documentation}
72 \mbox{\Hypertarget{homescreen_8c_a369266c24eacffb87046522897a570d5}\label{homescreen_8c_a369266c24eacffb87046522897a570d5}} 
73 \index{homescreen.\+c@{homescreen.\+c}!\+\_\+\+G\+N\+U\+\_\+\+S\+O\+U\+R\+CE@{\+\_\+\+G\+N\+U\+\_\+\+S\+O\+U\+R\+CE}}
74 \index{\+\_\+\+G\+N\+U\+\_\+\+S\+O\+U\+R\+CE@{\+\_\+\+G\+N\+U\+\_\+\+S\+O\+U\+R\+CE}!homescreen.\+c@{homescreen.\+c}}
75 \subsubsection{\texorpdfstring{\+\_\+\+G\+N\+U\+\_\+\+S\+O\+U\+R\+CE}{\_GNU\_SOURCE}}
76 {\footnotesize\ttfamily \#define \+\_\+\+G\+N\+U\+\_\+\+S\+O\+U\+R\+CE}
77
78
79
80 Definition at line 17 of file homescreen.\+c.
81
82 \mbox{\Hypertarget{homescreen_8c_ad2c1fbc92ba364fcf83f15e6d0af66f0}\label{homescreen_8c_ad2c1fbc92ba364fcf83f15e6d0af66f0}} 
83 \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}}
84 \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}}
85 \subsubsection{\texorpdfstring{A\+F\+B\+\_\+\+B\+I\+N\+D\+I\+N\+G\+\_\+\+V\+E\+R\+S\+I\+ON}{AFB\_BINDING\_VERSION}}
86 {\footnotesize\ttfamily \#define A\+F\+B\+\_\+\+B\+I\+N\+D\+I\+N\+G\+\_\+\+V\+E\+R\+S\+I\+ON~2}
87
88
89
90 Definition at line 18 of file homescreen.\+c.
91
92 \mbox{\Hypertarget{homescreen_8c_a09f43d9e7e1c5d2198c0d66024b4500e}\label{homescreen_8c_a09f43d9e7e1c5d2198c0d66024b4500e}} 
93 \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}}
94 \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}}
95 \subsubsection{\texorpdfstring{C\+O\+M\+M\+A\+N\+D\+\_\+\+E\+V\+E\+N\+T\+\_\+\+N\+UM}{COMMAND\_EVENT\_NUM}}
96 {\footnotesize\ttfamily \#define C\+O\+M\+M\+A\+N\+D\+\_\+\+E\+V\+E\+N\+T\+\_\+\+N\+UM~3}
97
98
99
100 Definition at line 31 of file homescreen.\+c.
101
102 \mbox{\Hypertarget{homescreen_8c_a9a68ed04201d9390bb85b2c6ab1d7250}\label{homescreen_8c_a9a68ed04201d9390bb85b2c6ab1d7250}} 
103 \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}}
104 \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}}
105 \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}}
106 {\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}
107
108
109
110 Definition at line 32 of file homescreen.\+c.
111
112
113
114 \subsection{Function Documentation}
115 \mbox{\Hypertarget{homescreen_8c_a00cbbc0f3f4452db078ae511684a6adc}\label{homescreen_8c_a00cbbc0f3f4452db078ae511684a6adc}} 
116 \index{homescreen.\+c@{homescreen.\+c}!init@{init}}
117 \index{init@{init}!homescreen.\+c@{homescreen.\+c}}
118 \subsubsection{\texorpdfstring{init()}{init()}}
119 {\footnotesize\ttfamily static int init (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}
120
121
122
123 Definition at line 238 of file homescreen.\+c.
124
125
126 \begin{DoxyCode}
127 239 \{
128 240    AFB\_NOTICE(\textcolor{stringliteral}{"binding init"});
129 241 
130 242    \hyperlink{homescreen_8c_a2af1ff5a4cbf03125e61e903832035f5}{ev\_tap\_shortcut} = afb\_daemon\_make\_event(\hyperlink{hs-helper_8h_a0cd84b1a2184c9b84d1b7bf24582f28e}{evlist}[0]);
131 243    \hyperlink{homescreen_8c_af7cfc4f688bb898c09291252c4cb832c}{ev\_on\_screen\_message} = afb\_daemon\_make\_event(\hyperlink{hs-helper_8h_a0cd84b1a2184c9b84d1b7bf24582f28e}{evlist}[1]);
132 244    \hyperlink{homescreen_8c_a25fbdcc4e5787e3f41d99f4a71e86611}{ev\_reserved} = afb\_daemon\_make\_event(\hyperlink{hs-helper_8h_a0cd84b1a2184c9b84d1b7bf24582f28e}{evlist}[2]);
133 245 
134 246    \hyperlink{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}{event\_list}[0].\hyperlink{structevent_a45c6cfb7961a21a3366db067e4cc59ab}{name} = \hyperlink{hs-helper_8h_a0cd84b1a2184c9b84d1b7bf24582f28e}{evlist}[0];
135 247    \hyperlink{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}{event\_list}[0].\hyperlink{structevent_a58726ebc551d36562ac3f9e1fe293214}{event} = &\hyperlink{homescreen_8c_a2af1ff5a4cbf03125e61e903832035f5}{ev\_tap\_shortcut};
136 248 
137 249    \hyperlink{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}{event\_list}[1].\hyperlink{structevent_a45c6cfb7961a21a3366db067e4cc59ab}{name} = \hyperlink{hs-helper_8h_a0cd84b1a2184c9b84d1b7bf24582f28e}{evlist}[1];
138 250    \hyperlink{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}{event\_list}[1].\hyperlink{structevent_a58726ebc551d36562ac3f9e1fe293214}{event} = &\hyperlink{homescreen_8c_af7cfc4f688bb898c09291252c4cb832c}{ev\_on\_screen\_message};
139 251 
140 252    \hyperlink{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}{event\_list}[2].\hyperlink{structevent_a45c6cfb7961a21a3366db067e4cc59ab}{name} = \hyperlink{hs-helper_8h_a0cd84b1a2184c9b84d1b7bf24582f28e}{evlist}[2];
141 253    \hyperlink{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}{event\_list}[2].\hyperlink{structevent_a58726ebc551d36562ac3f9e1fe293214}{event} = &\hyperlink{homescreen_8c_a25fbdcc4e5787e3f41d99f4a71e86611}{ev\_reserved};
142 254 
143 255    \textcolor{keywordflow}{return} 0;
144 256 \}
145 \end{DoxyCode}
146 \mbox{\Hypertarget{homescreen_8c_a640cf8ed97d804c5ed1c09a349056338}\label{homescreen_8c_a640cf8ed97d804c5ed1c09a349056338}} 
147 \index{homescreen.\+c@{homescreen.\+c}!on\+\_\+screen\+\_\+message@{on\+\_\+screen\+\_\+message}}
148 \index{on\+\_\+screen\+\_\+message@{on\+\_\+screen\+\_\+message}!homescreen.\+c@{homescreen.\+c}}
149 \subsubsection{\texorpdfstring{on\+\_\+screen\+\_\+message()}{on\_screen\_message()}}
150 {\footnotesize\ttfamily static void on\+\_\+screen\+\_\+message (\begin{DoxyParamCaption}\item[{struct afb\+\_\+req}]{request }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}
151
152 Home\+Screenの\+On\+Screenを表示する
153
154 \subparagraph*{Parameters}
155
156 Request key
157 \begin{DoxyItemize}
158 \item display\+\_\+message \+: 表示したい文字列
159 \end{DoxyItemize}
160
161 \subparagraph*{Return}
162
163 Nothing 
164
165 Definition at line 113 of file homescreen.\+c.
166
167
168 \begin{DoxyCode}
169 114 \{
170 115     AFB\_NOTICE(\textcolor{stringliteral}{"%s is called."}, \_\_FUNCTION\_\_);
171 116 
172 117     \textcolor{keywordtype}{int} ret = 0;
173 118     \textcolor{keyword}{const} \textcolor{keywordtype}{char}* value = afb\_req\_value(request, \hyperlink{homescreen_8c_abfd6c1d6f316fa952b11553f8f275e92}{\_display\_message});
174 119     \textcolor{keywordflow}{if} (value) \{
175 120 
176 121       AFB\_NOTICE(\textcolor{stringliteral}{"request params = %s."}, value);
177 122 
178 123       \textcolor{keyword}{struct }json\_object* push\_obj = json\_object\_new\_object();
179 124       \hyperlink{hs-helper_8c_a8777c53f1d4d5412f19b134ad85ffedf}{hs\_add\_object\_to\_json\_object\_str}( push\_obj, 2,
180 125       \hyperlink{homescreen_8c_abfd6c1d6f316fa952b11553f8f275e92}{\_display\_message}, value);
181 126       afb\_event\_push(\hyperlink{homescreen_8c_af7cfc4f688bb898c09291252c4cb832c}{ev\_on\_screen\_message}, push\_obj);
182 127     \} \textcolor{keywordflow}{else} \{
183 128       afb\_req\_fail\_f(request, \textcolor{stringliteral}{"failed"}, \textcolor{stringliteral}{"called %s, Unknown palameter"}, \_\_FUNCTION\_\_);
184 129       \textcolor{keywordflow}{return};
185 130     \}
186 131 
187 132   \textcolor{comment}{// HomeScreenに返すレスポンス}
188 133     \textcolor{keyword}{struct }json\_object *res = json\_object\_new\_object();
189 134     \hyperlink{hs-helper_8c_ae83604a37134e7bdee3ce4f10bb0b47a}{hs\_add\_object\_to\_json\_object\_func}(res, \_\_FUNCTION\_\_, 2,
190 135       \hyperlink{homescreen_8c_aed1c5296a2e6d34945507a0fca17a376}{\_error},  ret);
191 136     afb\_req\_success(request, res, \textcolor{stringliteral}{"afb\_event\_push event [on\_screen\_message]"});
192 137 \}
193 \end{DoxyCode}
194 \mbox{\Hypertarget{homescreen_8c_a1279893c0fe937311a81e0a98fb4cf1c}\label{homescreen_8c_a1279893c0fe937311a81e0a98fb4cf1c}} 
195 \index{homescreen.\+c@{homescreen.\+c}!onevent@{onevent}}
196 \index{onevent@{onevent}!homescreen.\+c@{homescreen.\+c}}
197 \subsubsection{\texorpdfstring{onevent()}{onevent()}}
198 {\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]}}
199
200
201
202 Definition at line 258 of file homescreen.\+c.
203
204
205 \begin{DoxyCode}
206 259 \{
207 260    AFB\_NOTICE(\textcolor{stringliteral}{"on\_event %s"}, \hyperlink{structevent}{event});
208 261 \}
209 \end{DoxyCode}
210 \mbox{\Hypertarget{homescreen_8c_af48cab759d4ae0ddbfcdd60f4051ba05}\label{homescreen_8c_af48cab759d4ae0ddbfcdd60f4051ba05}} 
211 \index{homescreen.\+c@{homescreen.\+c}!ping\+Sample@{ping\+Sample}}
212 \index{ping\+Sample@{ping\+Sample}!homescreen.\+c@{homescreen.\+c}}
213 \subsubsection{\texorpdfstring{ping\+Sample()}{pingSample()}}
214 {\footnotesize\ttfamily static void ping\+Sample (\begin{DoxyParamCaption}\item[{struct afb\+\_\+req}]{request }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}
215
216
217
218 Definition at line 55 of file homescreen.\+c.
219
220
221 \begin{DoxyCode}
222 56 \{
223 57    \textcolor{keyword}{static} \textcolor{keywordtype}{int} pingcount = 0;
224 58    afb\_req\_success\_f(request, json\_object\_new\_int(pingcount), \textcolor{stringliteral}{"Ping count = %d"}, pingcount);
225 59    AFB\_NOTICE(\textcolor{stringliteral}{"Verbosity macro at level notice invoked at ping invocation count = %d"}, pingcount);
226 60    pingcount++;
227 61 \}
228 \end{DoxyCode}
229 \mbox{\Hypertarget{homescreen_8c_a83d646edf54a6a082f69121bc89a08de}\label{homescreen_8c_a83d646edf54a6a082f69121bc89a08de}} 
230 \index{homescreen.\+c@{homescreen.\+c}!preinit@{preinit}}
231 \index{preinit@{preinit}!homescreen.\+c@{homescreen.\+c}}
232 \subsubsection{\texorpdfstring{preinit()}{preinit()}}
233 {\footnotesize\ttfamily static int preinit (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}
234
235
236
237 Definition at line 232 of file homescreen.\+c.
238
239
240 \begin{DoxyCode}
241 233 \{
242 234    AFB\_NOTICE(\textcolor{stringliteral}{"binding preinit (was register)"});
243 235    \textcolor{keywordflow}{return} 0;
244 236 \}
245 \end{DoxyCode}
246 \mbox{\Hypertarget{homescreen_8c_a4ff0c8b506669e5622a6ee168134d8f1}\label{homescreen_8c_a4ff0c8b506669e5622a6ee168134d8f1}} 
247 \index{homescreen.\+c@{homescreen.\+c}!subscribe@{subscribe}}
248 \index{subscribe@{subscribe}!homescreen.\+c@{homescreen.\+c}}
249 \subsubsection{\texorpdfstring{subscribe()}{subscribe()}}
250 {\footnotesize\ttfamily static void subscribe (\begin{DoxyParamCaption}\item[{struct afb\+\_\+req}]{request }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}
251
252 Subscribe event
253
254 \subparagraph*{Parameters}
255
256
257 \begin{DoxyItemize}
258 \item event \+: Event name. Event list is written in \hyperlink{libhomescreen_8cpp}{libhomescreen.\+cpp}
259 \end{DoxyItemize}
260
261 \subparagraph*{Return}
262
263 Nothing
264
265 \subparagraph*{Note}
266
267 Definition at line 151 of file homescreen.\+c.
268
269
270 \begin{DoxyCode}
271 152 \{
272 153     \textcolor{keyword}{const} \textcolor{keywordtype}{char} *value = afb\_req\_value(request, \textcolor{stringliteral}{"event"});
273 154     AFB\_NOTICE(\textcolor{stringliteral}{"value is %s"}, value);
274 155     \textcolor{keywordtype}{int} ret = 0;
275 156     \textcolor{keywordflow}{if}(value) \{
276 157         \textcolor{keywordtype}{int} index = \hyperlink{hs-helper_8c_a2ff1b894941c3b461ca8119079c4146a}{hs\_search\_event\_name\_index}(value);
277 158         \textcolor{keywordflow}{if}(index < 0)
278 159         \{
279 160             AFB\_NOTICE(\textcolor{stringliteral}{"dedicated event doesn't exist"});
280 161             ret = \hyperlink{homescreen_8c_a9a68ed04201d9390bb85b2c6ab1d7250}{EVENT\_SUBSCRIBE\_ERROR\_CODE};
281 162         \}
282 163         \textcolor{keywordflow}{else}
283 164         \{
284 165             afb\_req\_subscribe(request, *\hyperlink{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}{event\_list}[index].\hyperlink{structevent}{event});
285 166         \}
286 167     \}
287 168     \textcolor{keywordflow}{else}\{
288 169         AFB\_NOTICE(\textcolor{stringliteral}{"Please input event name"});
289 170         ret = \hyperlink{homescreen_8c_a9a68ed04201d9390bb85b2c6ab1d7250}{EVENT\_SUBSCRIBE\_ERROR\_CODE};
290 171     \}
291 172     \textcolor{comment}{/*create response json object*/}
292 173     \textcolor{keyword}{struct }json\_object *res = json\_object\_new\_object();
293 174     \hyperlink{hs-helper_8c_ae83604a37134e7bdee3ce4f10bb0b47a}{hs\_add\_object\_to\_json\_object\_func}(res, \_\_FUNCTION\_\_, 2,
294 175         \hyperlink{homescreen_8c_aed1c5296a2e6d34945507a0fca17a376}{\_error}, ret);
295 176     afb\_req\_success\_f(request, res, \textcolor{stringliteral}{"homescreen binder subscribe event name [%s]"}, value);
296 177 \}
297 \end{DoxyCode}
298 \mbox{\Hypertarget{homescreen_8c_a096eae5c8f297f9df142a406eea56227}\label{homescreen_8c_a096eae5c8f297f9df142a406eea56227}} 
299 \index{homescreen.\+c@{homescreen.\+c}!tap\+\_\+shortcut@{tap\+\_\+shortcut}}
300 \index{tap\+\_\+shortcut@{tap\+\_\+shortcut}!homescreen.\+c@{homescreen.\+c}}
301 \subsubsection{\texorpdfstring{tap\+\_\+shortcut()}{tap\_shortcut()}}
302 {\footnotesize\ttfamily static void tap\+\_\+shortcut (\begin{DoxyParamCaption}\item[{struct afb\+\_\+req}]{request }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}
303
304 Home\+Screenから呼ばれる ショートカットがタップされたことをアプリケーションに通知するために使用する アプリケーションからは使用されない
305
306 \subparagraph*{Parameters}
307
308 Request key
309 \begin{DoxyItemize}
310 \item application\+\_\+name \+: アプリケーション名
311 \end{DoxyItemize}
312
313 \subparagraph*{Return}
314
315 Nothing 
316
317 Definition at line 76 of file homescreen.\+c.
318
319
320 \begin{DoxyCode}
321 77 \{
322 78     AFB\_NOTICE(\textcolor{stringliteral}{"%s is called."}, \_\_FUNCTION\_\_);
323 79 
324 80     \textcolor{keywordtype}{int} ret = 0;
325 81     \textcolor{keyword}{const} \textcolor{keywordtype}{char}* value = afb\_req\_value(request, \hyperlink{homescreen_8c_a1f2c79fa6801b63751e270d67994fe81}{\_application\_name});
326 82     \textcolor{keywordflow}{if} (value) \{
327 83 
328 84       AFB\_NOTICE(\textcolor{stringliteral}{"request params = %s."}, value);
329 85 
330 86       \textcolor{keyword}{struct }json\_object* push\_obj = json\_object\_new\_object();
331 87       \hyperlink{hs-helper_8c_a8777c53f1d4d5412f19b134ad85ffedf}{hs\_add\_object\_to\_json\_object\_str}( push\_obj, 2,
332 88       \hyperlink{homescreen_8c_a1f2c79fa6801b63751e270d67994fe81}{\_application\_name}, value);
333 89       afb\_event\_push(\hyperlink{homescreen_8c_a2af1ff5a4cbf03125e61e903832035f5}{ev\_tap\_shortcut}, push\_obj);
334 90     \} \textcolor{keywordflow}{else} \{
335 91       afb\_req\_fail\_f(request, \textcolor{stringliteral}{"failed"}, \textcolor{stringliteral}{"called %s, Unknown palameter"}, \_\_FUNCTION\_\_);
336 92       \textcolor{keywordflow}{return};
337 93     \}
338 94 
339 95   \textcolor{comment}{// HomeScreenに返すレスポンス}
340 96     \textcolor{keyword}{struct }json\_object *res = json\_object\_new\_object();
341 97     \hyperlink{hs-helper_8c_ae83604a37134e7bdee3ce4f10bb0b47a}{hs\_add\_object\_to\_json\_object\_func}(res, \_\_FUNCTION\_\_, 2,
342 98       \hyperlink{homescreen_8c_aed1c5296a2e6d34945507a0fca17a376}{\_error},  ret);
343 99     afb\_req\_success(request, res, \textcolor{stringliteral}{"afb\_event\_push event [tap\_shortcut]"});
344 100 \}
345 \end{DoxyCode}
346 \mbox{\Hypertarget{homescreen_8c_ab92621255d7370c6dd8a0f1a8e376ad3}\label{homescreen_8c_ab92621255d7370c6dd8a0f1a8e376ad3}} 
347 \index{homescreen.\+c@{homescreen.\+c}!unsubscribe@{unsubscribe}}
348 \index{unsubscribe@{unsubscribe}!homescreen.\+c@{homescreen.\+c}}
349 \subsubsection{\texorpdfstring{unsubscribe()}{unsubscribe()}}
350 {\footnotesize\ttfamily static void unsubscribe (\begin{DoxyParamCaption}\item[{struct afb\+\_\+req}]{request }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}
351
352 Unsubscribe event
353
354 \subparagraph*{Parameters}
355
356
357 \begin{DoxyItemize}
358 \item event \+: Event name. Event list is written in \hyperlink{libhomescreen_8cpp}{libhomescreen.\+cpp}
359 \end{DoxyItemize}
360
361 \subparagraph*{Return}
362
363 Nothing
364
365 \subparagraph*{Note}
366
367 Definition at line 191 of file homescreen.\+c.
368
369
370 \begin{DoxyCode}
371 192 \{
372 193     \textcolor{keyword}{const} \textcolor{keywordtype}{char} *value = afb\_req\_value(request, \textcolor{stringliteral}{"event"});
373 194     AFB\_NOTICE(\textcolor{stringliteral}{"value is %s"}, value);
374 195     \textcolor{keywordtype}{int} ret = 0;
375 196     \textcolor{keywordflow}{if}(value) \{
376 197         \textcolor{keywordtype}{int} index = \hyperlink{hs-helper_8c_a2ff1b894941c3b461ca8119079c4146a}{hs\_search\_event\_name\_index}(value);
377 198         \textcolor{keywordflow}{if}(index < 0)
378 199         \{
379 200             AFB\_NOTICE(\textcolor{stringliteral}{"dedicated event doesn't exist"});
380 201             ret = \hyperlink{homescreen_8c_a9a68ed04201d9390bb85b2c6ab1d7250}{EVENT\_SUBSCRIBE\_ERROR\_CODE};
381 202         \}
382 203         \textcolor{keywordflow}{else}
383 204         \{
384 205             afb\_req\_unsubscribe(request, *\hyperlink{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}{event\_list}[index].\hyperlink{structevent}{event});
385 206         \}
386 207     \}
387 208     \textcolor{keywordflow}{else}\{
388 209         AFB\_NOTICE(\textcolor{stringliteral}{"Please input event name"});
389 210         ret = \hyperlink{homescreen_8c_a9a68ed04201d9390bb85b2c6ab1d7250}{EVENT\_SUBSCRIBE\_ERROR\_CODE};
390 211     \}
391 212     \textcolor{comment}{/*create response json object*/}
392 213     \textcolor{keyword}{struct }json\_object *res = json\_object\_new\_object();
393 214     \hyperlink{hs-helper_8c_ae83604a37134e7bdee3ce4f10bb0b47a}{hs\_add\_object\_to\_json\_object\_func}(res, \_\_FUNCTION\_\_, 2,
394 215         \hyperlink{homescreen_8c_aed1c5296a2e6d34945507a0fca17a376}{\_error}, ret);
395 216     afb\_req\_success\_f(request, res, \textcolor{stringliteral}{"homescreen binder unsubscribe event name [%s]"}, value);
396 217 \}
397 \end{DoxyCode}
398
399
400 \subsection{Variable Documentation}
401 \mbox{\Hypertarget{homescreen_8c_a1f2c79fa6801b63751e270d67994fe81}\label{homescreen_8c_a1f2c79fa6801b63751e270d67994fe81}} 
402 \index{homescreen.\+c@{homescreen.\+c}!\+\_\+application\+\_\+name@{\+\_\+application\+\_\+name}}
403 \index{\+\_\+application\+\_\+name@{\+\_\+application\+\_\+name}!homescreen.\+c@{homescreen.\+c}}
404 \subsubsection{\texorpdfstring{\+\_\+application\+\_\+name}{\_application\_name}}
405 {\footnotesize\ttfamily const char \+\_\+application\+\_\+name\mbox{[}$\,$\mbox{]} = \char`\"{}application\+\_\+name\char`\"{}\hspace{0.3cm}{\ttfamily [static]}}
406
407
408
409 Definition at line 48 of file homescreen.\+c.
410
411 \mbox{\Hypertarget{homescreen_8c_abfd6c1d6f316fa952b11553f8f275e92}\label{homescreen_8c_abfd6c1d6f316fa952b11553f8f275e92}} 
412 \index{homescreen.\+c@{homescreen.\+c}!\+\_\+display\+\_\+message@{\+\_\+display\+\_\+message}}
413 \index{\+\_\+display\+\_\+message@{\+\_\+display\+\_\+message}!homescreen.\+c@{homescreen.\+c}}
414 \subsubsection{\texorpdfstring{\+\_\+display\+\_\+message}{\_display\_message}}
415 {\footnotesize\ttfamily const char \+\_\+display\+\_\+message\mbox{[}$\,$\mbox{]} = \char`\"{}display\+\_\+message\char`\"{}\hspace{0.3cm}{\ttfamily [static]}}
416
417
418
419 Definition at line 49 of file homescreen.\+c.
420
421 \mbox{\Hypertarget{homescreen_8c_aed1c5296a2e6d34945507a0fca17a376}\label{homescreen_8c_aed1c5296a2e6d34945507a0fca17a376}} 
422 \index{homescreen.\+c@{homescreen.\+c}!\+\_\+error@{\+\_\+error}}
423 \index{\+\_\+error@{\+\_\+error}!homescreen.\+c@{homescreen.\+c}}
424 \subsubsection{\texorpdfstring{\+\_\+error}{\_error}}
425 {\footnotesize\ttfamily const char \+\_\+error\mbox{[}$\,$\mbox{]} = \char`\"{}error\char`\"{}\hspace{0.3cm}{\ttfamily [static]}}
426
427
428
429 Definition at line 46 of file homescreen.\+c.
430
431 \mbox{\Hypertarget{homescreen_8c_ae2a62ab481a2922cbfc788193857a12e}\label{homescreen_8c_ae2a62ab481a2922cbfc788193857a12e}} 
432 \index{homescreen.\+c@{homescreen.\+c}!afb\+Binding\+V2@{afb\+Binding\+V2}}
433 \index{afb\+Binding\+V2@{afb\+Binding\+V2}!homescreen.\+c@{homescreen.\+c}}
434 \subsubsection{\texorpdfstring{afb\+Binding\+V2}{afbBindingV2}}
435 {\footnotesize\ttfamily const struct afb\+\_\+binding\+\_\+v2 afb\+Binding\+V2}
436
437 {\bfseries Initial value\+:}
438 \begin{DoxyCode}
439 = \{
440     .api = \textcolor{stringliteral}{"homescreen"},
441     .specification = NULL,
442     .verbs = \hyperlink{homescreen_8c_acad6dadf60fac3d701e488e4fcd11c89}{verbs},
443     .preinit = \hyperlink{homescreen_8c_a83d646edf54a6a082f69121bc89a08de}{preinit},
444     .init = \hyperlink{homescreen_8c_a00cbbc0f3f4452db078ae511684a6adc}{init},
445     .onevent = \hyperlink{homescreen_8c_a1279893c0fe937311a81e0a98fb4cf1c}{onevent}
446 \}
447 \end{DoxyCode}
448
449
450 Definition at line 263 of file homescreen.\+c.
451
452 \mbox{\Hypertarget{homescreen_8c_af7cfc4f688bb898c09291252c4cb832c}\label{homescreen_8c_af7cfc4f688bb898c09291252c4cb832c}} 
453 \index{homescreen.\+c@{homescreen.\+c}!ev\+\_\+on\+\_\+screen\+\_\+message@{ev\+\_\+on\+\_\+screen\+\_\+message}}
454 \index{ev\+\_\+on\+\_\+screen\+\_\+message@{ev\+\_\+on\+\_\+screen\+\_\+message}!homescreen.\+c@{homescreen.\+c}}
455 \subsubsection{\texorpdfstring{ev\+\_\+on\+\_\+screen\+\_\+message}{ev\_on\_screen\_message}}
456 {\footnotesize\ttfamily struct afb\+\_\+event ev\+\_\+on\+\_\+screen\+\_\+message\hspace{0.3cm}{\ttfamily [static]}}
457
458
459
460 Definition at line 43 of file homescreen.\+c.
461
462 \mbox{\Hypertarget{homescreen_8c_a25fbdcc4e5787e3f41d99f4a71e86611}\label{homescreen_8c_a25fbdcc4e5787e3f41d99f4a71e86611}} 
463 \index{homescreen.\+c@{homescreen.\+c}!ev\+\_\+reserved@{ev\+\_\+reserved}}
464 \index{ev\+\_\+reserved@{ev\+\_\+reserved}!homescreen.\+c@{homescreen.\+c}}
465 \subsubsection{\texorpdfstring{ev\+\_\+reserved}{ev\_reserved}}
466 {\footnotesize\ttfamily struct afb\+\_\+event ev\+\_\+reserved\hspace{0.3cm}{\ttfamily [static]}}
467
468
469
470 Definition at line 44 of file homescreen.\+c.
471
472 \mbox{\Hypertarget{homescreen_8c_a2af1ff5a4cbf03125e61e903832035f5}\label{homescreen_8c_a2af1ff5a4cbf03125e61e903832035f5}} 
473 \index{homescreen.\+c@{homescreen.\+c}!ev\+\_\+tap\+\_\+shortcut@{ev\+\_\+tap\+\_\+shortcut}}
474 \index{ev\+\_\+tap\+\_\+shortcut@{ev\+\_\+tap\+\_\+shortcut}!homescreen.\+c@{homescreen.\+c}}
475 \subsubsection{\texorpdfstring{ev\+\_\+tap\+\_\+shortcut}{ev\_tap\_shortcut}}
476 {\footnotesize\ttfamily struct afb\+\_\+event ev\+\_\+tap\+\_\+shortcut\hspace{0.3cm}{\ttfamily [static]}}
477
478
479
480 Definition at line 42 of file homescreen.\+c.
481
482 \mbox{\Hypertarget{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}\label{homescreen_8c_a1c3c5bfa861dcb58d9e9d216d893864c}} 
483 \index{homescreen.\+c@{homescreen.\+c}!event\+\_\+list@{event\+\_\+list}}
484 \index{event\+\_\+list@{event\+\_\+list}!homescreen.\+c@{homescreen.\+c}}
485 \subsubsection{\texorpdfstring{event\+\_\+list}{event\_list}}
486 {\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]}}
487
488
489
490 Definition at line 40 of file homescreen.\+c.
491
492 \mbox{\Hypertarget{homescreen_8c_acad6dadf60fac3d701e488e4fcd11c89}\label{homescreen_8c_acad6dadf60fac3d701e488e4fcd11c89}} 
493 \index{homescreen.\+c@{homescreen.\+c}!verbs@{verbs}}
494 \index{verbs@{verbs}!homescreen.\+c@{homescreen.\+c}}
495 \subsubsection{\texorpdfstring{verbs}{verbs}}
496 {\footnotesize\ttfamily const struct afb\+\_\+verb\+\_\+v2 verbs\mbox{[}$\,$\mbox{]}\hspace{0.3cm}{\ttfamily [static]}}
497
498 {\bfseries Initial value\+:}
499 \begin{DoxyCode}
500 = \{
501     
502     \{ .verb = \textcolor{stringliteral}{"ping"},              .session = AFB\_SESSION\_NONE,    .callback = 
503       \hyperlink{homescreen_8c_af48cab759d4ae0ddbfcdd60f4051ba05}{pingSample},        .auth = NULL \},
504     \{ .verb = \textcolor{stringliteral}{"tap\_shortcut"},      .session = AFB\_SESSION\_NONE,    .callback = 
505       \hyperlink{homescreen_8c_a096eae5c8f297f9df142a406eea56227}{tap\_shortcut},      .auth = NULL \},
506     \{ .verb = \textcolor{stringliteral}{"on\_screen\_message"}, .session = AFB\_SESSION\_NONE,    .callback = 
507       \hyperlink{homescreen_8c_a640cf8ed97d804c5ed1c09a349056338}{on\_screen\_message}, .auth = NULL \},
508     \{ .verb = \textcolor{stringliteral}{"subscribe"},         .session = AFB\_SESSION\_NONE,    .callback = 
509       \hyperlink{homescreen_8c_a4ff0c8b506669e5622a6ee168134d8f1}{subscribe},         .auth = NULL \},
510     \{ .verb = \textcolor{stringliteral}{"unsubscribe"},       .session = AFB\_SESSION\_NONE,    .callback = 
511       \hyperlink{homescreen_8c_ab92621255d7370c6dd8a0f1a8e376ad3}{unsubscribe},       .auth = NULL \},
512     \{NULL \} 
513 \}
514 \end{DoxyCode}
515
516
517 Definition at line 222 of file homescreen.\+c.
518