1 \hypertarget{libhomescreen_8cpp}{}\section{libhomescreen/libhomescreen.cpp File Reference}
2 \label{libhomescreen_8cpp}\index{libhomescreen/libhomescreen.\+cpp@{libhomescreen/libhomescreen.\+cpp}}
3 {\ttfamily \#include $<$stdarg.\+h$>$}\newline
4 {\ttfamily \#include $<$sys/socket.\+h$>$}\newline
5 {\ttfamily \#include $<$iostream$>$}\newline
6 {\ttfamily \#include $<$algorithm$>$}\newline
7 {\ttfamily \#include $<$thread$>$}\newline
8 {\ttfamily \#include $<$errno.\+h$>$}\newline
9 {\ttfamily \#include $<$cassert$>$}\newline
10 {\ttfamily \#include $<$cctype$>$}\newline
11 {\ttfamily \#include $<$cerrno$>$}\newline
12 {\ttfamily \#include $<$cstdio$>$}\newline
13 {\ttfamily \#include $<$cstdlib$>$}\newline
14 {\ttfamily \#include $<$cstring$>$}\newline
15 {\ttfamily \#include $<$libhomescreen/libhomescreen.\+hpp$>$}\newline
17 \begin{DoxyCompactItemize}
19 \#define \hyperlink{libhomescreen_8cpp_a797aa3053bd6a29819d44f8fad8a5eca}{E\+L\+OG}(args, ...)~\hyperlink{libhomescreen_8cpp_af583e7770fe13e35089388a45eaf9d9d}{\+\_\+\+E\+L\+OG}(\+\_\+\+\_\+\+F\+U\+N\+C\+T\+I\+O\+N\+\_\+\+\_\+,\+\_\+\+\_\+\+L\+I\+N\+E\+\_\+\+\_\+,args,\#\#\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)
21 \#define \hyperlink{libhomescreen_8cpp_a4e42b2f5af2174dd24f958351becf63d}{D\+L\+OG}(args, ...)~\hyperlink{libhomescreen_8cpp_a7639744c63851d916fb673963e234124}{\+\_\+\+D\+L\+OG}(\+\_\+\+\_\+\+F\+U\+N\+C\+T\+I\+O\+N\+\_\+\+\_\+,\+\_\+\+\_\+\+L\+I\+N\+E\+\_\+\+\_\+,args,\#\#\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)
22 \end{DoxyCompactItemize}
23 \subsection*{Functions}
24 \begin{DoxyCompactItemize}
26 static void \hyperlink{libhomescreen_8cpp_a7639744c63851d916fb673963e234124}{\+\_\+\+D\+L\+OG} (const char $\ast$func, const int line, const char $\ast$log,...)
28 static void \hyperlink{libhomescreen_8cpp_af583e7770fe13e35089388a45eaf9d9d}{\+\_\+\+E\+L\+OG} (const char $\ast$func, const int line, const char $\ast$log,...)
30 static bool \hyperlink{libhomescreen_8cpp_a7a2176c3d71fec0f09dcb2aa0866b17e}{has\+\_\+verb} (const string \&verb)
32 static void \hyperlink{libhomescreen_8cpp_a73c05b96c151e5e46c28585ccb143c1c}{\+\_\+on\+\_\+hangup\+\_\+static} (void $\ast$closure, struct afb\+\_\+wsj1 $\ast$wsj)
34 static void \hyperlink{libhomescreen_8cpp_a782a05fde0f1c17e0c4c8f972a3f53c8}{\+\_\+on\+\_\+call\+\_\+static} (void $\ast$closure, const char $\ast$api, const char $\ast$verb, struct afb\+\_\+wsj1\+\_\+msg $\ast$msg)
36 static void \hyperlink{libhomescreen_8cpp_a3df86185aa9453726556da201d95a6f9}{\+\_\+on\+\_\+event\+\_\+static} (void $\ast$closure, const char $\ast$\hyperlink{structevent}{event}, struct afb\+\_\+wsj1\+\_\+msg $\ast$msg)
38 static void \hyperlink{libhomescreen_8cpp_a7778933bffa862c63fa0a1b8219faa8b}{\+\_\+on\+\_\+reply\+\_\+static} (void $\ast$closure, struct afb\+\_\+wsj1\+\_\+msg $\ast$msg)
40 static void $\ast$ \hyperlink{libhomescreen_8cpp_aa73353e1bf62c68b6b0aba7a1e4e275e}{event\+\_\+loop\+\_\+run} (void $\ast$args)
41 \end{DoxyCompactItemize}
42 \subsection*{Variables}
43 \begin{DoxyCompactItemize}
45 static const char \hyperlink{libhomescreen_8cpp_a1e2d6e77dd8f0162f830058579eab42f}{A\+PI} \mbox{[}$\,$\mbox{]} = \char`\"{}homescreen\char`\"{}
46 \end{DoxyCompactItemize}
49 \subsection{Macro Definition Documentation}
50 \mbox{\Hypertarget{libhomescreen_8cpp_a4e42b2f5af2174dd24f958351becf63d}\label{libhomescreen_8cpp_a4e42b2f5af2174dd24f958351becf63d}}
51 \index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!D\+L\+OG@{D\+L\+OG}}
52 \index{D\+L\+OG@{D\+L\+OG}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
53 \subsubsection{\texorpdfstring{D\+L\+OG}{DLOG}}
54 {\footnotesize\ttfamily \#define D\+L\+OG(\begin{DoxyParamCaption}\item[{}]{args, }\item[{}]{... }\end{DoxyParamCaption})~\hyperlink{libhomescreen_8cpp_a7639744c63851d916fb673963e234124}{\+\_\+\+D\+L\+OG}(\+\_\+\+\_\+\+F\+U\+N\+C\+T\+I\+O\+N\+\_\+\+\_\+,\+\_\+\+\_\+\+L\+I\+N\+E\+\_\+\+\_\+,args,\#\#\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)}
58 Definition at line 33 of file libhomescreen.\+cpp.
60 \mbox{\Hypertarget{libhomescreen_8cpp_a797aa3053bd6a29819d44f8fad8a5eca}\label{libhomescreen_8cpp_a797aa3053bd6a29819d44f8fad8a5eca}}
61 \index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!E\+L\+OG@{E\+L\+OG}}
62 \index{E\+L\+OG@{E\+L\+OG}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
63 \subsubsection{\texorpdfstring{E\+L\+OG}{ELOG}}
64 {\footnotesize\ttfamily \#define E\+L\+OG(\begin{DoxyParamCaption}\item[{}]{args, }\item[{}]{... }\end{DoxyParamCaption})~\hyperlink{libhomescreen_8cpp_af583e7770fe13e35089388a45eaf9d9d}{\+\_\+\+E\+L\+OG}(\+\_\+\+\_\+\+F\+U\+N\+C\+T\+I\+O\+N\+\_\+\+\_\+,\+\_\+\+\_\+\+L\+I\+N\+E\+\_\+\+\_\+,args,\#\#\+\_\+\+\_\+\+V\+A\+\_\+\+A\+R\+G\+S\+\_\+\+\_\+)}
68 Definition at line 32 of file libhomescreen.\+cpp.
72 \subsection{Function Documentation}
73 \mbox{\Hypertarget{libhomescreen_8cpp_a7639744c63851d916fb673963e234124}\label{libhomescreen_8cpp_a7639744c63851d916fb673963e234124}}
74 \index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!\+\_\+\+D\+L\+OG@{\+\_\+\+D\+L\+OG}}
75 \index{\+\_\+\+D\+L\+OG@{\+\_\+\+D\+L\+OG}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
76 \subsubsection{\texorpdfstring{\+\_\+\+D\+L\+O\+G()}{\_DLOG()}}
77 {\footnotesize\ttfamily static void \+\_\+\+D\+L\+OG (\begin{DoxyParamCaption}\item[{const char $\ast$}]{func, }\item[{const int}]{line, }\item[{const char $\ast$}]{log, }\item[{}]{... }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}
81 Definition at line 545 of file libhomescreen.\+cpp.
86 547 \textcolor{keywordtype}{char} *message;
88 549 va\_start(args, log);
89 550 \textcolor{keywordflow}{if} (log == NULL || vasprintf(&message, log, args) < 0)
91 552 cout << \textcolor{stringliteral}{"[libhomescreen DEBUG]"} << func << \textcolor{stringliteral}{"("} << line << \textcolor{stringliteral}{"):"} << message << endl;
96 \mbox{\Hypertarget{libhomescreen_8cpp_af583e7770fe13e35089388a45eaf9d9d}\label{libhomescreen_8cpp_af583e7770fe13e35089388a45eaf9d9d}}
97 \index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!\+\_\+\+E\+L\+OG@{\+\_\+\+E\+L\+OG}}
98 \index{\+\_\+\+E\+L\+OG@{\+\_\+\+E\+L\+OG}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
99 \subsubsection{\texorpdfstring{\+\_\+\+E\+L\+O\+G()}{\_ELOG()}}
100 {\footnotesize\ttfamily static void \+\_\+\+E\+L\+OG (\begin{DoxyParamCaption}\item[{const char $\ast$}]{func, }\item[{const int}]{line, }\item[{const char $\ast$}]{log, }\item[{}]{... }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}
104 Definition at line 533 of file libhomescreen.\+cpp.
109 535 \textcolor{keywordtype}{char} *message;
111 537 va\_start(args, log);
112 538 \textcolor{keywordflow}{if} (log == NULL || vasprintf(&message, log, args) < 0)
114 540 cout << \textcolor{stringliteral}{"[libhomescreen ERROR]"} << func << \textcolor{stringliteral}{"("} << line << \textcolor{stringliteral}{"):"} << message << endl;
119 \mbox{\Hypertarget{libhomescreen_8cpp_a782a05fde0f1c17e0c4c8f972a3f53c8}\label{libhomescreen_8cpp_a782a05fde0f1c17e0c4c8f972a3f53c8}}
120 \index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!\+\_\+on\+\_\+call\+\_\+static@{\+\_\+on\+\_\+call\+\_\+static}}
121 \index{\+\_\+on\+\_\+call\+\_\+static@{\+\_\+on\+\_\+call\+\_\+static}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
122 \subsubsection{\texorpdfstring{\+\_\+on\+\_\+call\+\_\+static()}{\_on\_call\_static()}}
123 {\footnotesize\ttfamily static void \+\_\+on\+\_\+call\+\_\+static (\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})\hspace{0.3cm}{\ttfamily [static]}}
127 Definition at line 66 of file libhomescreen.\+cpp.
132 68 \textcolor{comment}{/* LibHomeScreen is not called from other process */}
135 \mbox{\Hypertarget{libhomescreen_8cpp_a3df86185aa9453726556da201d95a6f9}\label{libhomescreen_8cpp_a3df86185aa9453726556da201d95a6f9}}
136 \index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!\+\_\+on\+\_\+event\+\_\+static@{\+\_\+on\+\_\+event\+\_\+static}}
137 \index{\+\_\+on\+\_\+event\+\_\+static@{\+\_\+on\+\_\+event\+\_\+static}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
138 \subsubsection{\texorpdfstring{\+\_\+on\+\_\+event\+\_\+static()}{\_on\_event\_static()}}
139 {\footnotesize\ttfamily static void \+\_\+on\+\_\+event\+\_\+static (\begin{DoxyParamCaption}\item[{void $\ast$}]{closure, }\item[{const char $\ast$}]{event, }\item[{struct afb\+\_\+wsj1\+\_\+msg $\ast$}]{msg }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}
143 Definition at line 71 of file libhomescreen.\+cpp.
148 73 \textcolor{keyword}{static\_cast<}\hyperlink{class_lib_home_screen}{LibHomeScreen}*\textcolor{keyword}{>}(closure)->on\_event(NULL,\hyperlink{structevent}{event},msg);
151 \mbox{\Hypertarget{libhomescreen_8cpp_a73c05b96c151e5e46c28585ccb143c1c}\label{libhomescreen_8cpp_a73c05b96c151e5e46c28585ccb143c1c}}
152 \index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!\+\_\+on\+\_\+hangup\+\_\+static@{\+\_\+on\+\_\+hangup\+\_\+static}}
153 \index{\+\_\+on\+\_\+hangup\+\_\+static@{\+\_\+on\+\_\+hangup\+\_\+static}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
154 \subsubsection{\texorpdfstring{\+\_\+on\+\_\+hangup\+\_\+static()}{\_on\_hangup\_static()}}
155 {\footnotesize\ttfamily static void \+\_\+on\+\_\+hangup\+\_\+static (\begin{DoxyParamCaption}\item[{void $\ast$}]{closure, }\item[{struct afb\+\_\+wsj1 $\ast$}]{wsj }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}
159 Definition at line 61 of file libhomescreen.\+cpp.
164 63 \textcolor{keyword}{static\_cast<}\hyperlink{class_lib_home_screen}{LibHomeScreen}*\textcolor{keyword}{>}(closure)->on\_hangup(NULL,wsj);
167 \mbox{\Hypertarget{libhomescreen_8cpp_a7778933bffa862c63fa0a1b8219faa8b}\label{libhomescreen_8cpp_a7778933bffa862c63fa0a1b8219faa8b}}
168 \index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!\+\_\+on\+\_\+reply\+\_\+static@{\+\_\+on\+\_\+reply\+\_\+static}}
169 \index{\+\_\+on\+\_\+reply\+\_\+static@{\+\_\+on\+\_\+reply\+\_\+static}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
170 \subsubsection{\texorpdfstring{\+\_\+on\+\_\+reply\+\_\+static()}{\_on\_reply\_static()}}
171 {\footnotesize\ttfamily static void \+\_\+on\+\_\+reply\+\_\+static (\begin{DoxyParamCaption}\item[{void $\ast$}]{closure, }\item[{struct afb\+\_\+wsj1\+\_\+msg $\ast$}]{msg }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}
175 Definition at line 76 of file libhomescreen.\+cpp.
180 78 \textcolor{keyword}{static\_cast<}\hyperlink{class_lib_home_screen}{LibHomeScreen}*\textcolor{keyword}{>}(closure)->on\_reply(NULL,msg);
183 \mbox{\Hypertarget{libhomescreen_8cpp_aa73353e1bf62c68b6b0aba7a1e4e275e}\label{libhomescreen_8cpp_aa73353e1bf62c68b6b0aba7a1e4e275e}}
184 \index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!event\+\_\+loop\+\_\+run@{event\+\_\+loop\+\_\+run}}
185 \index{event\+\_\+loop\+\_\+run@{event\+\_\+loop\+\_\+run}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
186 \subsubsection{\texorpdfstring{event\+\_\+loop\+\_\+run()}{event\_loop\_run()}}
187 {\footnotesize\ttfamily static void$\ast$ event\+\_\+loop\+\_\+run (\begin{DoxyParamCaption}\item[{void $\ast$}]{args }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}
191 Definition at line 204 of file libhomescreen.\+cpp.
196 206 \textcolor{keyword}{struct }sd\_event* loop = (\textcolor{keyword}{struct }sd\_event*)(args);
197 207 \hyperlink{libhomescreen_8cpp_a4e42b2f5af2174dd24f958351becf63d}{DLOG}(\textcolor{stringliteral}{"start eventloop"});
198 208 \textcolor{keywordflow}{for}(;;)
199 209 sd\_event\_run(loop, 30000000);
202 \mbox{\Hypertarget{libhomescreen_8cpp_a7a2176c3d71fec0f09dcb2aa0866b17e}\label{libhomescreen_8cpp_a7a2176c3d71fec0f09dcb2aa0866b17e}}
203 \index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!has\+\_\+verb@{has\+\_\+verb}}
204 \index{has\+\_\+verb@{has\+\_\+verb}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
205 \subsubsection{\texorpdfstring{has\+\_\+verb()}{has\_verb()}}
206 {\footnotesize\ttfamily static bool has\+\_\+verb (\begin{DoxyParamCaption}\item[{const string \&}]{verb }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}
210 Definition at line 557 of file libhomescreen.\+cpp.
215 559 \hyperlink{libhomescreen_8cpp_a4e42b2f5af2174dd24f958351becf63d}{DLOG}(\textcolor{stringliteral}{"verb is %s"}, verb.c\_str());
216 560 \textcolor{keywordflow}{if}(find(\hyperlink{class_lib_home_screen_a5593ff5ac78f6495ccb649904cf0ab08}{LibHomeScreen::api\_list}.begin(),
217 \hyperlink{class_lib_home_screen_a5593ff5ac78f6495ccb649904cf0ab08}{LibHomeScreen::api\_list}.end(), verb) !=
218 \hyperlink{class_lib_home_screen_a5593ff5ac78f6495ccb649904cf0ab08}{LibHomeScreen::api\_list}.end())
219 561 \textcolor{keywordflow}{return} \textcolor{keyword}{true};
220 562 \textcolor{keywordflow}{else}
221 563 \textcolor{keywordflow}{return} \textcolor{keyword}{false};
226 \subsection{Variable Documentation}
227 \mbox{\Hypertarget{libhomescreen_8cpp_a1e2d6e77dd8f0162f830058579eab42f}\label{libhomescreen_8cpp_a1e2d6e77dd8f0162f830058579eab42f}}
228 \index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!A\+PI@{A\+PI}}
229 \index{A\+PI@{A\+PI}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
230 \subsubsection{\texorpdfstring{A\+PI}{API}}
231 {\footnotesize\ttfamily const char A\+PI\mbox{[}$\,$\mbox{]} = \char`\"{}homescreen\char`\"{}\hspace{0.3cm}{\ttfamily [static]}}
235 Definition at line 40 of file libhomescreen.\+cpp.