1 \hypertarget{class_lib_home_screen}{}\section{Lib\+Home\+Screen Class Reference}
2 \label{class_lib_home_screen}\index{Lib\+Home\+Screen@{Lib\+Home\+Screen}}
5 {\ttfamily \#include $<$libhomescreen.\+hpp$>$}
7 \subsection*{Public Types}
8 \begin{DoxyCompactItemize}
10 enum \hyperlink{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154}{Event\+Type} \{ \hyperlink{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154a4b0a82d501e4db5fbfe25c254c92896f}{Event\+\_\+\+Tap\+Shortcut} = 1,
11 \hyperlink{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154aea56fa32a124a8ddcbea127755280a1d}{Event\+\_\+\+On\+Screen\+Message},
12 \hyperlink{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154acae91db4efc2394fd701f581d277a3fd}{Event\+\_\+\+On\+Screen\+Reply}
15 using \hyperlink{class_lib_home_screen_a334f11f81c84c98d18284215dcaada3a}{handler\+\_\+func} = std\+::function$<$ void(json\+\_\+object $\ast$)$>$
16 \end{DoxyCompactItemize}
17 \subsection*{Public Member Functions}
18 \begin{DoxyCompactItemize}
20 \hyperlink{class_lib_home_screen_a724bd949c4154fad041f96a15ef0f5dc}{Lib\+Home\+Screen} ()
22 \hyperlink{class_lib_home_screen_a249902aebf71a5383ca8ec6ae558d095}{$\sim$\+Lib\+Home\+Screen} ()
24 \hyperlink{class_lib_home_screen_a0fff2f703c8ce184eb9edd133e0f4137}{Lib\+Home\+Screen} (const \hyperlink{class_lib_home_screen}{Lib\+Home\+Screen} \&)=delete
26 \hyperlink{class_lib_home_screen}{Lib\+Home\+Screen} \& \hyperlink{class_lib_home_screen_a23bc17798453cfca50904562736f6b25}{operator=} (const \hyperlink{class_lib_home_screen}{Lib\+Home\+Screen} \&)=delete
28 int \hyperlink{class_lib_home_screen_a6a57b573cc767725762ba9beab032220}{init} (const int port, const std\+::string \&token)
30 int \hyperlink{class_lib_home_screen_afb571c9577087b47065eb23e7fdbc903}{tap\+Shortcut} (const char $\ast$application\+\_\+name)
32 int \hyperlink{class_lib_home_screen_ac336482036a72b51a822725f1929523c}{on\+Screen\+Message} (const char $\ast$display\+\_\+message)
34 int \hyperlink{class_lib_home_screen_a6c065f41f2c5d1f58d2763bfb4da9c37}{on\+Screen\+Reply} (const char $\ast$reply\+\_\+message)
36 void \hyperlink{class_lib_home_screen_ab1b0e08bf35415de9064afed899e9f85}{set\+\_\+event\+\_\+handler} (enum \hyperlink{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154}{Event\+Type} et, \hyperlink{class_lib_home_screen_a334f11f81c84c98d18284215dcaada3a}{handler\+\_\+func} f)
38 void \hyperlink{class_lib_home_screen_a2789e8a5372202cc36f48e71dbb9b7cf}{register\+Callback} (void($\ast$event\+\_\+cb)(const std\+::string \&\hyperlink{structevent}{event}, struct json\+\_\+object $\ast$event\+\_\+contents), void($\ast$reply\+\_\+cb)(struct json\+\_\+object $\ast$reply\+\_\+contents), void($\ast$hangup\+\_\+cb)(void)=nullptr)
40 int \hyperlink{class_lib_home_screen_a527b49dcfe581be6275d0eb2236ba37f}{call} (const std\+::string \&verb, struct json\+\_\+object $\ast$arg)
42 int \hyperlink{class_lib_home_screen_ab5e8e8ab7d53e0f114e9e907fcbb7643}{call} (const char $\ast$verb, struct json\+\_\+object $\ast$arg)
44 int \hyperlink{class_lib_home_screen_aa4c189807b75d070f567967f0d690738}{subscribe} (const std\+::string \&event\+\_\+name)
46 int \hyperlink{class_lib_home_screen_aac03a45cbd453ba69ddb00c1016930a6}{unsubscribe} (const std\+::string \&event\+\_\+name)
48 void \hyperlink{class_lib_home_screen_ab1c1fa69f24b981e824dd9fb810c4b74}{on\+\_\+hangup} (void $\ast$closure, struct afb\+\_\+wsj1 $\ast$wsj)
50 void \hyperlink{class_lib_home_screen_a608638eb87b2772a3dcc92d8ca8f3596}{on\+\_\+call} (void $\ast$closure, const char $\ast$api, const char $\ast$verb, struct afb\+\_\+wsj1\+\_\+msg $\ast$msg)
52 void \hyperlink{class_lib_home_screen_a9c4885b51b43ab24a548d49fb3ab2de3}{on\+\_\+event} (void $\ast$closure, const char $\ast$\hyperlink{structevent}{event}, struct afb\+\_\+wsj1\+\_\+msg $\ast$msg)
54 void \hyperlink{class_lib_home_screen_a248d9648c6186287a7632ec1c75fc9c5}{on\+\_\+reply} (void $\ast$closure, struct afb\+\_\+wsj1\+\_\+msg $\ast$msg)
55 \end{DoxyCompactItemize}
56 \subsection*{Static Public Attributes}
57 \begin{DoxyCompactItemize}
59 static const std\+::vector$<$ std\+::string $>$ \hyperlink{class_lib_home_screen_a5593ff5ac78f6495ccb649904cf0ab08}{api\+\_\+list}
61 static const std\+::vector$<$ std\+::string $>$ \hyperlink{class_lib_home_screen_a6a6d8a4d33a006a08652e7377a4c29e9}{event\+\_\+list}
62 \end{DoxyCompactItemize}
65 \subsection{Detailed Description}
68 Definition at line 32 of file libhomescreen.\+hpp.
72 \subsection{Member Typedef Documentation}
73 \mbox{\Hypertarget{class_lib_home_screen_a334f11f81c84c98d18284215dcaada3a}\label{class_lib_home_screen_a334f11f81c84c98d18284215dcaada3a}}
74 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!handler\+\_\+func@{handler\+\_\+func}}
75 \index{handler\+\_\+func@{handler\+\_\+func}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
76 \subsubsection{\texorpdfstring{handler\+\_\+func}{handler\_func}}
77 {\footnotesize\ttfamily using \hyperlink{class_lib_home_screen_a334f11f81c84c98d18284215dcaada3a}{Lib\+Home\+Screen\+::handler\+\_\+func} = std\+::function$<$void(json\+\_\+object$\ast$)$>$}
81 Definition at line 42 of file libhomescreen.\+hpp.
85 \subsection{Member Enumeration Documentation}
86 \mbox{\Hypertarget{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154}\label{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154}}
87 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!Event\+Type@{Event\+Type}}
88 \index{Event\+Type@{Event\+Type}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
89 \subsubsection{\texorpdfstring{Event\+Type}{EventType}}
90 {\footnotesize\ttfamily enum \hyperlink{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154}{Lib\+Home\+Screen\+::\+Event\+Type}}
92 \begin{DoxyEnumFields}{Enumerator}
93 \raisebox{\heightof{T}}[0pt][0pt]{\index{Event\+\_\+\+Tap\+Shortcut@{Event\+\_\+\+Tap\+Shortcut}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}\index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!Event\+\_\+\+Tap\+Shortcut@{Event\+\_\+\+Tap\+Shortcut}}}\mbox{\Hypertarget{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154a4b0a82d501e4db5fbfe25c254c92896f}\label{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154a4b0a82d501e4db5fbfe25c254c92896f}}
94 Event\+\_\+\+Tap\+Shortcut&\\
97 \raisebox{\heightof{T}}[0pt][0pt]{\index{Event\+\_\+\+On\+Screen\+Message@{Event\+\_\+\+On\+Screen\+Message}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}\index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!Event\+\_\+\+On\+Screen\+Message@{Event\+\_\+\+On\+Screen\+Message}}}\mbox{\Hypertarget{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154aea56fa32a124a8ddcbea127755280a1d}\label{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154aea56fa32a124a8ddcbea127755280a1d}}
98 Event\+\_\+\+On\+Screen\+Message&\\
101 \raisebox{\heightof{T}}[0pt][0pt]{\index{Event\+\_\+\+On\+Screen\+Reply@{Event\+\_\+\+On\+Screen\+Reply}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}\index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!Event\+\_\+\+On\+Screen\+Reply@{Event\+\_\+\+On\+Screen\+Reply}}}\mbox{\Hypertarget{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154acae91db4efc2394fd701f581d277a3fd}\label{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154acae91db4efc2394fd701f581d277a3fd}}
102 Event\+\_\+\+On\+Screen\+Reply&\\
108 Definition at line 44 of file libhomescreen.\+hpp.
113 45 \hyperlink{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154a4b0a82d501e4db5fbfe25c254c92896f}{Event\_TapShortcut} = 1,
114 46 \hyperlink{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154aea56fa32a124a8ddcbea127755280a1d}{Event\_OnScreenMessage},
115 47 \hyperlink{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154acae91db4efc2394fd701f581d277a3fd}{Event\_OnScreenReply}
120 \subsection{Constructor \& Destructor Documentation}
121 \mbox{\Hypertarget{class_lib_home_screen_a724bd949c4154fad041f96a15ef0f5dc}\label{class_lib_home_screen_a724bd949c4154fad041f96a15ef0f5dc}}
122 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
123 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
124 \subsubsection{\texorpdfstring{Lib\+Home\+Screen()}{LibHomeScreen()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
125 {\footnotesize\ttfamily Lib\+Home\+Screen\+::\+Lib\+Home\+Screen (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
129 Definition at line 83 of file libhomescreen.\+cpp.
136 \mbox{\Hypertarget{class_lib_home_screen_a249902aebf71a5383ca8ec6ae558d095}\label{class_lib_home_screen_a249902aebf71a5383ca8ec6ae558d095}}
137 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!````~Lib\+Home\+Screen@{$\sim$\+Lib\+Home\+Screen}}
138 \index{````~Lib\+Home\+Screen@{$\sim$\+Lib\+Home\+Screen}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
139 \subsubsection{\texorpdfstring{$\sim$\+Lib\+Home\+Screen()}{~LibHomeScreen()}}
140 {\footnotesize\ttfamily Lib\+Home\+Screen\+::$\sim$\+Lib\+Home\+Screen (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
144 Definition at line 90 of file libhomescreen.\+cpp.
149 92 \textcolor{keywordflow}{if}(mploop)
151 94 sd\_event\_unref(mploop);
153 96 \textcolor{keywordflow}{if}(sp\_websock != NULL)
155 98 afb\_wsj1\_unref(sp\_websock);
159 \mbox{\Hypertarget{class_lib_home_screen_a0fff2f703c8ce184eb9edd133e0f4137}\label{class_lib_home_screen_a0fff2f703c8ce184eb9edd133e0f4137}}
160 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
161 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
162 \subsubsection{\texorpdfstring{Lib\+Home\+Screen()}{LibHomeScreen()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
163 {\footnotesize\ttfamily Lib\+Home\+Screen\+::\+Lib\+Home\+Screen (\begin{DoxyParamCaption}\item[{const \hyperlink{class_lib_home_screen}{Lib\+Home\+Screen} \&}]{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [delete]}}
167 \subsection{Member Function Documentation}
168 \mbox{\Hypertarget{class_lib_home_screen_a527b49dcfe581be6275d0eb2236ba37f}\label{class_lib_home_screen_a527b49dcfe581be6275d0eb2236ba37f}}
169 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!call@{call}}
170 \index{call@{call}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
171 \subsubsection{\texorpdfstring{call()}{call()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
172 {\footnotesize\ttfamily int Lib\+Home\+Screen\+::call (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{verb, }\item[{struct json\+\_\+object $\ast$}]{arg }\end{DoxyParamCaption})}
174 \mbox{\Hypertarget{class_lib_home_screen_ab5e8e8ab7d53e0f114e9e907fcbb7643}\label{class_lib_home_screen_ab5e8e8ab7d53e0f114e9e907fcbb7643}}
175 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!call@{call}}
176 \index{call@{call}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
177 \subsubsection{\texorpdfstring{call()}{call()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
178 {\footnotesize\ttfamily int Lib\+Home\+Screen\+::call (\begin{DoxyParamCaption}\item[{const char $\ast$}]{verb, }\item[{struct json\+\_\+object $\ast$}]{arg }\end{DoxyParamCaption})}
180 This function calls the A\+PI of Home\+Screen via Web\+Socket This function is overload function of \char`\"{}call\char`\"{}
182 \subparagraph*{Parameters}
186 \item verb \mbox{[}in\mbox{]} \+: This argument should be specified to the A\+PI name (e.\+g. \char`\"{}tap\+\_\+shortcut\char`\"{})
187 \item arg \mbox{[}in\mbox{]} \+: This argument should be specified to the argument of A\+PI. And this argument expects J\+S\+ON object
190 \subparagraph*{Return}
194 \item Returns 0 on success or -\/1 in case of error.
199 To call Home\+Screen\textquotesingle{}s A\+P\+Is, the application should set its function name, arguments to J\+S\+ON format.
201 Definition at line 360 of file libhomescreen.\+cpp.
206 362 \textcolor{keywordtype}{int} ret;
207 363 \textcolor{keywordflow}{if}(!sp\_websock)
209 365 \textcolor{keywordflow}{return} -1;
211 367 \textcolor{keywordflow}{if} (!\hyperlink{libhomescreen_8cpp_a7a2176c3d71fec0f09dcb2aa0866b17e}{has\_verb}(\textcolor{keywordtype}{string}(verb)))
213 369 \hyperlink{hmi-debug_8h_a65bb6c7cfe38f8a724beab5059d36fb2}{HMI\_ERROR}(\textcolor{stringliteral}{"libhomescreen"},\textcolor{stringliteral}{"verb doesn't exit"});
214 370 \textcolor{keywordflow}{return} -1;
216 372 ret = afb\_wsj1\_call\_j(sp\_websock, \hyperlink{libhomescreen_8cpp_a1e2d6e77dd8f0162f830058579eab42f}{API}, verb, arg, \hyperlink{libhomescreen_8cpp_a7778933bffa862c63fa0a1b8219faa8b}{\_on\_reply\_static}, \textcolor{keyword}{this});
217 373 \textcolor{keywordflow}{if} (ret < 0) \{
218 374 \hyperlink{hmi-debug_8h_a65bb6c7cfe38f8a724beab5059d36fb2}{HMI\_ERROR}(\textcolor{stringliteral}{"libhomescreen"},\textcolor{stringliteral}{"Failed to call verb:%s"},verb);
220 376 \textcolor{keywordflow}{return} ret;
223 \mbox{\Hypertarget{class_lib_home_screen_a6a57b573cc767725762ba9beab032220}\label{class_lib_home_screen_a6a57b573cc767725762ba9beab032220}}
224 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!init@{init}}
225 \index{init@{init}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
226 \subsubsection{\texorpdfstring{init()}{init()}}
227 {\footnotesize\ttfamily int Lib\+Home\+Screen\+::init (\begin{DoxyParamCaption}\item[{const int}]{port, }\item[{const std\+::string \&}]{token }\end{DoxyParamCaption})}
229 This function is initializer
231 \subparagraph*{Parameters}
235 \item port \mbox{[}in\mbox{]} \+: This argument should be specified to the port number to be used for websocket
236 \item token \mbox{[}in\mbox{]} \+: This argument should be specified to the token to be used for websocket
239 \subparagraph*{Return}
247 Definition at line 116 of file libhomescreen.\+cpp.
252 118 \textcolor{keywordtype}{int} ret = 0;
253 119 \textcolor{keywordflow}{if}(port > 0 && token.size() > 0)
258 124 \textcolor{keywordflow}{else}
260 126 \hyperlink{hmi-debug_8h_a65bb6c7cfe38f8a724beab5059d36fb2}{HMI\_ERROR}(\textcolor{stringliteral}{"libhomescreen"},\textcolor{stringliteral}{"port and token should be > 0, Initial port and token uses."});
263 129 ret = initialize\_websocket();
264 130 \textcolor{keywordflow}{if}(ret != 0 )
266 132 \hyperlink{hmi-debug_8h_a65bb6c7cfe38f8a724beab5059d36fb2}{HMI\_ERROR}(\textcolor{stringliteral}{"libhomescreen"},\textcolor{stringliteral}{"Failed to initialize websocket"});
268 134 \textcolor{keywordflow}{else}\{
269 135 \hyperlink{hmi-debug_8h_a0d26d8b8201011dade787236519711c0}{HMI\_DEBUG}(\textcolor{stringliteral}{"libhomescreen"},\textcolor{stringliteral}{"Initialized"});
272 138 \textcolor{keywordflow}{return} ret;
275 \mbox{\Hypertarget{class_lib_home_screen_a608638eb87b2772a3dcc92d8ca8f3596}\label{class_lib_home_screen_a608638eb87b2772a3dcc92d8ca8f3596}}
276 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!on\+\_\+call@{on\+\_\+call}}
277 \index{on\+\_\+call@{on\+\_\+call}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
278 \subsubsection{\texorpdfstring{on\+\_\+call()}{on\_call()}}
279 {\footnotesize\ttfamily void Lib\+Home\+Screen\+::on\+\_\+call (\begin{DoxyParamCaption}\item[{void $\ast$}]{closure, }\item[{const char $\ast$}]{api, }\item[{const char $\ast$}]{verb, }\item[{struct afb\+\_\+wsj1\+\_\+msg $\ast$}]{msg }\end{DoxyParamCaption})}
283 Definition at line 448 of file libhomescreen.\+cpp.
290 \mbox{\Hypertarget{class_lib_home_screen_a9c4885b51b43ab24a548d49fb3ab2de3}\label{class_lib_home_screen_a9c4885b51b43ab24a548d49fb3ab2de3}}
291 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!on\+\_\+event@{on\+\_\+event}}
292 \index{on\+\_\+event@{on\+\_\+event}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
293 \subsubsection{\texorpdfstring{on\+\_\+event()}{on\_event()}}
294 {\footnotesize\ttfamily void Lib\+Home\+Screen\+::on\+\_\+event (\begin{DoxyParamCaption}\item[{void $\ast$}]{closure, }\item[{const char $\ast$}]{event, }\item[{struct afb\+\_\+wsj1\+\_\+msg $\ast$}]{msg }\end{DoxyParamCaption})}
298 Definition at line 458 of file libhomescreen.\+cpp.
303 460 \hyperlink{hmi-debug_8h_a0d26d8b8201011dade787236519711c0}{HMI\_DEBUG}(\textcolor{stringliteral}{"libhomescreen"},\textcolor{stringliteral}{"event: (%s) msg: (%s)."}, \hyperlink{structevent}{event}, afb\_wsj1\_msg\_object\_s(msg));
305 462 \textcolor{keywordflow}{if} (strstr(\hyperlink{structevent}{event}, \hyperlink{libhomescreen_8cpp_a1e2d6e77dd8f0162f830058579eab42f}{API}) == NULL) \{
306 463 \textcolor{keywordflow}{return};
309 466 \textcolor{keyword}{struct }json\_object* ev\_contents = afb\_wsj1\_msg\_object\_j(msg);
310 467 \textcolor{keyword}{struct }json\_object *json\_data = json\_object\_object\_get(ev\_contents, \textcolor{stringliteral}{"data"});
312 469 \textcolor{keywordflow}{if}(onEvent != \textcolor{keyword}{nullptr})
314 471 \textcolor{keyword}{const} \textcolor{keywordtype}{string} ev(\hyperlink{structevent}{event});
315 472 onEvent(ev, ev\_contents);
318 475 \textcolor{keyword}{const} \textcolor{keywordtype}{char}* event\_only = strchr(\hyperlink{structevent}{event}, \textcolor{charliteral}{'/'});
319 476 \textcolor{keywordflow}{if} (event\_only != \textcolor{keyword}{nullptr}) \{
320 477 event\_only = event\_only + 1;
323 480 \textcolor{keywordflow}{if} (strcasecmp(event\_only, \hyperlink{class_lib_home_screen_a6a6d8a4d33a006a08652e7377a4c29e9}{LibHomeScreen::event\_list}[0].c\_str()) == 0) \{
324 481 \textcolor{keyword}{auto} i = this->handlers.find(\hyperlink{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154a4b0a82d501e4db5fbfe25c254c92896f}{Event\_TapShortcut});
325 482 \textcolor{keywordflow}{if} ( i != this->handlers.end() ) \{
326 483 i->second(json\_data);
329 486 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (strcasecmp(event\_only, \hyperlink{class_lib_home_screen_a6a6d8a4d33a006a08652e7377a4c29e9}{LibHomeScreen::event\_list}[1].c\_str()) == 0) \{
330 487 \textcolor{keyword}{auto} i = this->handlers.find(\hyperlink{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154aea56fa32a124a8ddcbea127755280a1d}{Event\_OnScreenMessage});
331 488 \textcolor{keywordflow}{if} ( i != this->handlers.end() ) \{
332 489 i->second(json\_data);
335 492 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (strcasecmp(event\_only, \hyperlink{class_lib_home_screen_a6a6d8a4d33a006a08652e7377a4c29e9}{LibHomeScreen::event\_list}[2].c\_str()) == 0) \{
336 493 \textcolor{keyword}{auto} i = this->handlers.find(\hyperlink{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154acae91db4efc2394fd701f581d277a3fd}{Event\_OnScreenReply});
337 494 \textcolor{keywordflow}{if} ( i != this->handlers.end() ) \{
338 495 i->second(json\_data);
342 499 json\_object\_put(ev\_contents);
345 \mbox{\Hypertarget{class_lib_home_screen_ab1c1fa69f24b981e824dd9fb810c4b74}\label{class_lib_home_screen_ab1c1fa69f24b981e824dd9fb810c4b74}}
346 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!on\+\_\+hangup@{on\+\_\+hangup}}
347 \index{on\+\_\+hangup@{on\+\_\+hangup}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
348 \subsubsection{\texorpdfstring{on\+\_\+hangup()}{on\_hangup()}}
349 {\footnotesize\ttfamily void Lib\+Home\+Screen\+::on\+\_\+hangup (\begin{DoxyParamCaption}\item[{void $\ast$}]{closure, }\item[{struct afb\+\_\+wsj1 $\ast$}]{wsj }\end{DoxyParamCaption})}
353 Definition at line 439 of file libhomescreen.\+cpp.
358 441 \hyperlink{hmi-debug_8h_a0d26d8b8201011dade787236519711c0}{HMI\_DEBUG}(\textcolor{stringliteral}{"libhomescreen"},\textcolor{stringliteral}{"%s called"}, \_\_FUNCTION\_\_);
359 442 \textcolor{keywordflow}{if}(onHangup != \textcolor{keyword}{nullptr})
365 \mbox{\Hypertarget{class_lib_home_screen_a248d9648c6186287a7632ec1c75fc9c5}\label{class_lib_home_screen_a248d9648c6186287a7632ec1c75fc9c5}}
366 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!on\+\_\+reply@{on\+\_\+reply}}
367 \index{on\+\_\+reply@{on\+\_\+reply}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
368 \subsubsection{\texorpdfstring{on\+\_\+reply()}{on\_reply()}}
369 {\footnotesize\ttfamily void Lib\+Home\+Screen\+::on\+\_\+reply (\begin{DoxyParamCaption}\item[{void $\ast$}]{closure, }\item[{struct afb\+\_\+wsj1\+\_\+msg $\ast$}]{msg }\end{DoxyParamCaption})}
371 msg is like (\{\char`\"{}response\char`\"{}\+:\{\char`\"{}verb\char`\"{}\+:\char`\"{}subscribe\char`\"{},\char`\"{}error\char`\"{}\+:0\},\char`\"{}jtype\char`\"{}\+:\char`\"{}afb-\/reply\char`\"{},\char`\"{}request\char`\"{}\+:\{\char`\"{}status\char`\"{}\+:\char`\"{}success\char`\"{},\char`\"{}info\char`\"{}\+:\char`\"{}homescreen binder subscribe event name \mbox{[}on\+\_\+screen\+\_\+message\mbox{]}\char`\"{}\}\}) msg is like (\{\char`\"{}response\char`\"{}\+:\{\char`\"{}verb\char`\"{}\+:\char`\"{}tap\+\_\+shortcut\char`\"{},\char`\"{}error\char`\"{}\+:0\},\char`\"{}jtype\char`\"{}\+:\char`\"{}afb-\/reply\char`\"{},\char`\"{}request\char`\"{}\+:\{\char`\"{}status\char`\"{}\+:\char`\"{}success\char`\"{},\char`\"{}info\char`\"{}\+:\char`\"{}afb\+\_\+event\+\_\+push event \mbox{[}tap\+\_\+shortcut\mbox{]}\char`\"{}\}\})
373 Definition at line 506 of file libhomescreen.\+cpp.
378 508 \hyperlink{hmi-debug_8h_a0d26d8b8201011dade787236519711c0}{HMI\_DEBUG}(\textcolor{stringliteral}{"libhomescreen"},\textcolor{stringliteral}{"msg: (%s)"}, afb\_wsj1\_msg\_object\_s(msg));
379 509 \textcolor{keywordflow}{if}(onReply != \textcolor{keyword}{nullptr})
381 511 \textcolor{keyword}{struct }json\_object* reply = afb\_wsj1\_msg\_object\_j(msg);
384 514 json\_object\_put(reply);
388 \mbox{\Hypertarget{class_lib_home_screen_ac336482036a72b51a822725f1929523c}\label{class_lib_home_screen_ac336482036a72b51a822725f1929523c}}
389 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!on\+Screen\+Message@{on\+Screen\+Message}}
390 \index{on\+Screen\+Message@{on\+Screen\+Message}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
391 \subsubsection{\texorpdfstring{on\+Screen\+Message()}{onScreenMessage()}}
392 {\footnotesize\ttfamily int Lib\+Home\+Screen\+::on\+Screen\+Message (\begin{DoxyParamCaption}\item[{const char $\ast$}]{display\+\_\+message }\end{DoxyParamCaption})}
394 Sending on\+Screen message event
396 Sending On\+Screen message event to Home\+Screen from applications
398 \subparagraph*{Parameters}
402 \item display\+\_\+message \mbox{[}in\mbox{]} \+: message for display
405 \subparagraph*{Return}
409 \item Returns 0 on success or -\/1 in case of error.
412 Definition at line 244 of file libhomescreen.\+cpp.
417 246 \textcolor{keywordflow}{if}(!sp\_websock)
419 248 \textcolor{keywordflow}{return} -1;
422 251 \textcolor{keyword}{struct }json\_object* j\_obj = json\_object\_new\_object();
423 252 \textcolor{keyword}{struct }json\_object* val = json\_object\_new\_string(display\_message);
424 253 json\_object\_object\_add(j\_obj, \textcolor{stringliteral}{"display\_message"}, val);
425 254 \textcolor{keywordflow}{return} this->\hyperlink{class_lib_home_screen_a527b49dcfe581be6275d0eb2236ba37f}{call}(\textcolor{stringliteral}{"on\_screen\_message"}, j\_obj);
428 \mbox{\Hypertarget{class_lib_home_screen_a6c065f41f2c5d1f58d2763bfb4da9c37}\label{class_lib_home_screen_a6c065f41f2c5d1f58d2763bfb4da9c37}}
429 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!on\+Screen\+Reply@{on\+Screen\+Reply}}
430 \index{on\+Screen\+Reply@{on\+Screen\+Reply}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
431 \subsubsection{\texorpdfstring{on\+Screen\+Reply()}{onScreenReply()}}
432 {\footnotesize\ttfamily int Lib\+Home\+Screen\+::on\+Screen\+Reply (\begin{DoxyParamCaption}\item[{const char $\ast$}]{reply\+\_\+message }\end{DoxyParamCaption})}
434 Sending on\+Screen reply event
436 Sending On\+Screen reply event to applications from Home\+Screen
438 \subparagraph*{Parameters}
442 \item reply\+\_\+message \mbox{[}in\mbox{]} \+: message for reply
445 \subparagraph*{Return}
449 \item Returns 0 on success or -\/1 in case of error.
452 Definition at line 268 of file libhomescreen.\+cpp.
457 270 \textcolor{keywordflow}{if}(!sp\_websock)
459 272 \textcolor{keywordflow}{return} -1;
462 275 \textcolor{keyword}{struct }json\_object* j\_obj = json\_object\_new\_object();
463 276 \textcolor{keyword}{struct }json\_object* val = json\_object\_new\_string(reply\_message);
464 277 json\_object\_object\_add(j\_obj, \textcolor{stringliteral}{"reply\_message"}, val);
465 278 \textcolor{keywordflow}{return} this->\hyperlink{class_lib_home_screen_a527b49dcfe581be6275d0eb2236ba37f}{call}(\textcolor{stringliteral}{"on\_screen\_reply"}, j\_obj);
468 \mbox{\Hypertarget{class_lib_home_screen_a23bc17798453cfca50904562736f6b25}\label{class_lib_home_screen_a23bc17798453cfca50904562736f6b25}}
469 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!operator=@{operator=}}
470 \index{operator=@{operator=}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
471 \subsubsection{\texorpdfstring{operator=()}{operator=()}}
472 {\footnotesize\ttfamily \hyperlink{class_lib_home_screen}{Lib\+Home\+Screen}\& Lib\+Home\+Screen\+::operator= (\begin{DoxyParamCaption}\item[{const \hyperlink{class_lib_home_screen}{Lib\+Home\+Screen} \&}]{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [delete]}}
474 \mbox{\Hypertarget{class_lib_home_screen_a2789e8a5372202cc36f48e71dbb9b7cf}\label{class_lib_home_screen_a2789e8a5372202cc36f48e71dbb9b7cf}}
475 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!register\+Callback@{register\+Callback}}
476 \index{register\+Callback@{register\+Callback}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
477 \subsubsection{\texorpdfstring{register\+Callback()}{registerCallback()}}
478 {\footnotesize\ttfamily void Lib\+Home\+Screen\+::register\+Callback (\begin{DoxyParamCaption}\item[{void($\ast$)(const std\+::string \&\hyperlink{structevent}{event}, struct json\+\_\+object $\ast$event\+\_\+contents)}]{event\+\_\+cb, }\item[{void($\ast$)(struct json\+\_\+object $\ast$reply\+\_\+contents)}]{reply\+\_\+cb, }\item[{void($\ast$)(void)}]{hangup\+\_\+cb = {\ttfamily nullptr} }\end{DoxyParamCaption})}
480 This function register callback function for reply/event message from home screen
482 \subparagraph*{Parameters}
486 \item event\+\_\+cb \mbox{[}in\mbox{]} \+: This argument should be specified to the callback for subscribed event
487 \item reply\+\_\+cb \mbox{[}in\mbox{]} \+: This argument should be specified to the reply callback for call function
490 \subparagraph*{Return}
496 Event callback is invoked by home screen for event you subscribed. If you would like to get event, please call subscribe function before/after this function
498 Definition at line 155 of file libhomescreen.\+cpp.
503 160 onEvent = event\_cb;
504 161 onReply = reply\_cb;
505 162 onHangup = hangup\_cb;
508 \mbox{\Hypertarget{class_lib_home_screen_ab1b0e08bf35415de9064afed899e9f85}\label{class_lib_home_screen_ab1b0e08bf35415de9064afed899e9f85}}
509 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!set\+\_\+event\+\_\+handler@{set\+\_\+event\+\_\+handler}}
510 \index{set\+\_\+event\+\_\+handler@{set\+\_\+event\+\_\+handler}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
511 \subsubsection{\texorpdfstring{set\+\_\+event\+\_\+handler()}{set\_event\_handler()}}
512 {\footnotesize\ttfamily void Lib\+Home\+Screen\+::set\+\_\+event\+\_\+handler (\begin{DoxyParamCaption}\item[{enum \hyperlink{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154}{Event\+Type}}]{et, }\item[{\hyperlink{class_lib_home_screen_a334f11f81c84c98d18284215dcaada3a}{handler\+\_\+func}}]{f }\end{DoxyParamCaption})}
514 Setting Event Handler
516 Setting event handler for Homescreen
518 \subparagraph*{Parameters}
522 \item et \mbox{[}in\mbox{]} \+: event name
523 \item f \mbox{[}in\mbox{]} \+: event handler
526 \subparagraph*{Return}
530 Definition at line 293 of file libhomescreen.\+cpp.
535 295 \textcolor{keywordflow}{if} (et >= 1 && et <= 3) \{
536 296 \textcolor{keywordflow}{switch} (et) \{
537 297 \textcolor{keywordflow}{case} \hyperlink{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154a4b0a82d501e4db5fbfe25c254c92896f}{Event\_TapShortcut}:
538 298 this->\hyperlink{class_lib_home_screen_aa4c189807b75d070f567967f0d690738}{subscribe}(\hyperlink{class_lib_home_screen_a6a6d8a4d33a006a08652e7377a4c29e9}{LibHomeScreen::event\_list}[0]);
539 299 \textcolor{keywordflow}{break};
540 300 \textcolor{keywordflow}{case} \hyperlink{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154aea56fa32a124a8ddcbea127755280a1d}{Event\_OnScreenMessage}:
541 301 this->\hyperlink{class_lib_home_screen_aa4c189807b75d070f567967f0d690738}{subscribe}(\hyperlink{class_lib_home_screen_a6a6d8a4d33a006a08652e7377a4c29e9}{LibHomeScreen::event\_list}[1]);
542 302 \textcolor{keywordflow}{break};
543 303 \textcolor{keywordflow}{case} \hyperlink{class_lib_home_screen_a82616c91ac211d2ad08e709b524bf154acae91db4efc2394fd701f581d277a3fd}{Event\_OnScreenReply}:
544 304 this->\hyperlink{class_lib_home_screen_aa4c189807b75d070f567967f0d690738}{subscribe}(\hyperlink{class_lib_home_screen_a6a6d8a4d33a006a08652e7377a4c29e9}{LibHomeScreen::event\_list}[2]);
545 305 \textcolor{keywordflow}{break};
548 308 this->handlers[et] = std::move(f);
552 \mbox{\Hypertarget{class_lib_home_screen_aa4c189807b75d070f567967f0d690738}\label{class_lib_home_screen_aa4c189807b75d070f567967f0d690738}}
553 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!subscribe@{subscribe}}
554 \index{subscribe@{subscribe}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
555 \subsubsection{\texorpdfstring{subscribe()}{subscribe()}}
556 {\footnotesize\ttfamily int Lib\+Home\+Screen\+::subscribe (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{event\+\_\+name }\end{DoxyParamCaption})}
558 Register callback function for each event
560 \subparagraph*{Parameters}
564 \item event\+\_\+name \mbox{[}in\mbox{]} \+: This argument should be specified to the event name
567 \subparagraph*{Return}
571 \item Returns 0 on success or -\/1 in case of error.
576 This function enables to get an event to your callback function.
578 Definition at line 392 of file libhomescreen.\+cpp.
583 394 \textcolor{keywordflow}{if}(!sp\_websock)
585 396 \textcolor{keywordflow}{return} -1;
587 398 \textcolor{keyword}{struct }json\_object* j\_obj = json\_object\_new\_object();
588 399 json\_object\_object\_add(j\_obj, \textcolor{stringliteral}{"event"}, json\_object\_new\_string(event\_name.c\_str()));
590 401 \textcolor{keywordtype}{int} ret = afb\_wsj1\_call\_j(sp\_websock, \hyperlink{libhomescreen_8cpp_a1e2d6e77dd8f0162f830058579eab42f}{API}, \textcolor{stringliteral}{"subscribe"}, j\_obj,
591 \hyperlink{libhomescreen_8cpp_a7778933bffa862c63fa0a1b8219faa8b}{\_on\_reply\_static}, \textcolor{keyword}{this});
592 402 \textcolor{keywordflow}{if} (ret < 0) \{
593 403 \hyperlink{hmi-debug_8h_a65bb6c7cfe38f8a724beab5059d36fb2}{HMI\_ERROR}(\textcolor{stringliteral}{"libhomescreen"},\textcolor{stringliteral}{"Failed to call verb:%s"},\_\_FUNCTION\_\_);
595 405 \textcolor{keywordflow}{return} ret;
598 \mbox{\Hypertarget{class_lib_home_screen_afb571c9577087b47065eb23e7fdbc903}\label{class_lib_home_screen_afb571c9577087b47065eb23e7fdbc903}}
599 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!tap\+Shortcut@{tap\+Shortcut}}
600 \index{tap\+Shortcut@{tap\+Shortcut}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
601 \subsubsection{\texorpdfstring{tap\+Shortcut()}{tapShortcut()}}
602 {\footnotesize\ttfamily int Lib\+Home\+Screen\+::tap\+Shortcut (\begin{DoxyParamCaption}\item[{const char $\ast$}]{application\+\_\+name }\end{DoxyParamCaption})}
604 Sending Short\+Cut Icon tapped event
606 When Home\+Screen shortcut area is tapped, sending a event
608 \subparagraph*{Parameters}
612 \item application\+\_\+name \mbox{[}in\mbox{]} \+: Tapped application name (label)
615 \subparagraph*{Return}
619 \item Returns 0 on success or -\/1 in case of error.
622 Definition at line 220 of file libhomescreen.\+cpp.
627 222 \textcolor{keywordflow}{if}(!sp\_websock)
629 224 \textcolor{keywordflow}{return} -1;
632 227 \textcolor{keyword}{struct }json\_object* j\_obj = json\_object\_new\_object();
633 228 \textcolor{keyword}{struct }json\_object* val = json\_object\_new\_string(application\_name);
634 229 json\_object\_object\_add(j\_obj, \textcolor{stringliteral}{"application\_name"}, val);
635 230 \textcolor{keywordflow}{return} this->\hyperlink{class_lib_home_screen_a527b49dcfe581be6275d0eb2236ba37f}{call}(\textcolor{stringliteral}{"tap\_shortcut"}, j\_obj);
638 \mbox{\Hypertarget{class_lib_home_screen_aac03a45cbd453ba69ddb00c1016930a6}\label{class_lib_home_screen_aac03a45cbd453ba69ddb00c1016930a6}}
639 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!unsubscribe@{unsubscribe}}
640 \index{unsubscribe@{unsubscribe}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
641 \subsubsection{\texorpdfstring{unsubscribe()}{unsubscribe()}}
642 {\footnotesize\ttfamily int Lib\+Home\+Screen\+::unsubscribe (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{event\+\_\+name }\end{DoxyParamCaption})}
644 Unregister callback function for each event
646 \subparagraph*{Parameters}
650 \item event\+\_\+name \mbox{[}in\mbox{]} \+: This argument should be specified to the event name
653 \subparagraph*{Return}
657 \item Returns 0 on success or -\/1 in case of error.
662 This function disables to get an event to your callback function.
664 Definition at line 421 of file libhomescreen.\+cpp.
669 423 \textcolor{keywordflow}{if}(!sp\_websock)
671 425 \textcolor{keywordflow}{return} -1;
673 427 \textcolor{keyword}{struct }json\_object* j\_obj = json\_object\_new\_object();
674 428 json\_object\_object\_add(j\_obj, \textcolor{stringliteral}{"event"}, json\_object\_new\_string(event\_name.c\_str()));
676 430 \textcolor{keywordtype}{int} ret = afb\_wsj1\_call\_j(sp\_websock, \hyperlink{libhomescreen_8cpp_a1e2d6e77dd8f0162f830058579eab42f}{API}, \textcolor{stringliteral}{"unsubscribe"}, j\_obj,
677 \hyperlink{libhomescreen_8cpp_a7778933bffa862c63fa0a1b8219faa8b}{\_on\_reply\_static}, \textcolor{keyword}{this});
678 431 \textcolor{keywordflow}{if} (ret < 0) \{
679 432 \hyperlink{hmi-debug_8h_a65bb6c7cfe38f8a724beab5059d36fb2}{HMI\_ERROR}(\textcolor{stringliteral}{"libhomescreen"},\textcolor{stringliteral}{"Failed to call verb:%s"},\_\_FUNCTION\_\_);
681 434 \textcolor{keywordflow}{return} ret;
686 \subsection{Member Data Documentation}
687 \mbox{\Hypertarget{class_lib_home_screen_a5593ff5ac78f6495ccb649904cf0ab08}\label{class_lib_home_screen_a5593ff5ac78f6495ccb649904cf0ab08}}
688 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!api\+\_\+list@{api\+\_\+list}}
689 \index{api\+\_\+list@{api\+\_\+list}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
690 \subsubsection{\texorpdfstring{api\+\_\+list}{api\_list}}
691 {\footnotesize\ttfamily const std\+::vector$<$ std\+::string $>$ Lib\+Home\+Screen\+::api\+\_\+list\hspace{0.3cm}{\ttfamily [static]}}
693 {\bfseries Initial value\+:}
696 std::string(\textcolor{stringliteral}{"ping"}),
697 std::string(\textcolor{stringliteral}{"tap\_shortcut"}),
698 std::string(\textcolor{stringliteral}{"on\_screen\_message"}),
699 std::string(\textcolor{stringliteral}{"on\_screen\_reply"}),
700 std::string(\textcolor{stringliteral}{"subscribe"}),
701 std::string(\textcolor{stringliteral}{"unsubscribe"})
706 Definition at line 50 of file libhomescreen.\+hpp.
708 \mbox{\Hypertarget{class_lib_home_screen_a6a6d8a4d33a006a08652e7377a4c29e9}\label{class_lib_home_screen_a6a6d8a4d33a006a08652e7377a4c29e9}}
709 \index{Lib\+Home\+Screen@{Lib\+Home\+Screen}!event\+\_\+list@{event\+\_\+list}}
710 \index{event\+\_\+list@{event\+\_\+list}!Lib\+Home\+Screen@{Lib\+Home\+Screen}}
711 \subsubsection{\texorpdfstring{event\+\_\+list}{event\_list}}
712 {\footnotesize\ttfamily const std\+::vector$<$ std\+::string $>$ Lib\+Home\+Screen\+::event\+\_\+list\hspace{0.3cm}{\ttfamily [static]}}
714 {\bfseries Initial value\+:}
717 std::string(\textcolor{stringliteral}{"tap\_shortcut"}),
718 std::string(\textcolor{stringliteral}{"on\_screen\_message"}),
719 std::string(\textcolor{stringliteral}{"on\_screen\_reply"}),
720 std::string(\textcolor{stringliteral}{"none"})
725 Definition at line 51 of file libhomescreen.\+hpp.
729 The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
731 include/\hyperlink{libhomescreen_8hpp}{libhomescreen.\+hpp}\item
732 libhomescreen/\hyperlink{libhomescreen_8cpp}{libhomescreen.\+cpp}\end{DoxyCompactItemize}