\hypertarget{libhomescreen_8cpp}{}\section{libhomescreen/libhomescreen.cpp File Reference}
\label{libhomescreen_8cpp}\index{libhomescreen/libhomescreen.\+cpp@{libhomescreen/libhomescreen.\+cpp}}
{\ttfamily \#include $<$stdarg.\+h$>$}\newline
{\ttfamily \#include $<$sys/socket.\+h$>$}\newline
{\ttfamily \#include $<$iostream$>$}\newline
{\ttfamily \#include $<$algorithm$>$}\newline
{\ttfamily \#include $<$thread$>$}\newline
{\ttfamily \#include $<$errno.\+h$>$}\newline
{\ttfamily \#include $<$cassert$>$}\newline
{\ttfamily \#include $<$cctype$>$}\newline
{\ttfamily \#include $<$cerrno$>$}\newline
{\ttfamily \#include $<$cstdio$>$}\newline
{\ttfamily \#include $<$cstdlib$>$}\newline
{\ttfamily \#include $<$cstring$>$}\newline
{\ttfamily \#include $<$libhomescreen/libhomescreen.\+hpp$>$}\newline
\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#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\+\_\+\+\_\+)
\item 
\#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\+\_\+\+\_\+)
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static void \hyperlink{libhomescreen_8cpp_a7639744c63851d916fb673963e234124}{\+\_\+\+D\+L\+OG} (const char $\ast$func, const int line, const char $\ast$log,...)
\item 
static void \hyperlink{libhomescreen_8cpp_af583e7770fe13e35089388a45eaf9d9d}{\+\_\+\+E\+L\+OG} (const char $\ast$func, const int line, const char $\ast$log,...)
\item 
static bool \hyperlink{libhomescreen_8cpp_a7a2176c3d71fec0f09dcb2aa0866b17e}{has\+\_\+verb} (const string \&verb)
\item 
static void \hyperlink{libhomescreen_8cpp_a73c05b96c151e5e46c28585ccb143c1c}{\+\_\+on\+\_\+hangup\+\_\+static} (void $\ast$closure, struct afb\+\_\+wsj1 $\ast$wsj)
\item 
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)
\item 
static void \hyperlink{libhomescreen_8cpp_a3df86185aa9453726556da201d95a6f9}{\+\_\+on\+\_\+event\+\_\+static} (void $\ast$closure, const char $\ast$\hyperlink{structevent}{event}, struct afb\+\_\+wsj1\+\_\+msg $\ast$msg)
\item 
static void \hyperlink{libhomescreen_8cpp_a7778933bffa862c63fa0a1b8219faa8b}{\+\_\+on\+\_\+reply\+\_\+static} (void $\ast$closure, struct afb\+\_\+wsj1\+\_\+msg $\ast$msg)
\item 
static void $\ast$ \hyperlink{libhomescreen_8cpp_aa73353e1bf62c68b6b0aba7a1e4e275e}{event\+\_\+loop\+\_\+run} (void $\ast$args)
\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
static const char \hyperlink{libhomescreen_8cpp_a1e2d6e77dd8f0162f830058579eab42f}{A\+PI} \mbox{[}$\,$\mbox{]} = \char`\"{}homescreen\char`\"{}
\end{DoxyCompactItemize}


\subsection{Macro Definition Documentation}
\mbox{\Hypertarget{libhomescreen_8cpp_a4e42b2f5af2174dd24f958351becf63d}\label{libhomescreen_8cpp_a4e42b2f5af2174dd24f958351becf63d}} 
\index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!D\+L\+OG@{D\+L\+OG}}
\index{D\+L\+OG@{D\+L\+OG}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
\subsubsection{\texorpdfstring{D\+L\+OG}{DLOG}}
{\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\+\_\+\+\_\+)}



Definition at line 33 of file libhomescreen.\+cpp.

\mbox{\Hypertarget{libhomescreen_8cpp_a797aa3053bd6a29819d44f8fad8a5eca}\label{libhomescreen_8cpp_a797aa3053bd6a29819d44f8fad8a5eca}} 
\index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!E\+L\+OG@{E\+L\+OG}}
\index{E\+L\+OG@{E\+L\+OG}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
\subsubsection{\texorpdfstring{E\+L\+OG}{ELOG}}
{\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\+\_\+\+\_\+)}



Definition at line 32 of file libhomescreen.\+cpp.



\subsection{Function Documentation}
\mbox{\Hypertarget{libhomescreen_8cpp_a7639744c63851d916fb673963e234124}\label{libhomescreen_8cpp_a7639744c63851d916fb673963e234124}} 
\index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!\+\_\+\+D\+L\+OG@{\+\_\+\+D\+L\+OG}}
\index{\+\_\+\+D\+L\+OG@{\+\_\+\+D\+L\+OG}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
\subsubsection{\texorpdfstring{\+\_\+\+D\+L\+O\+G()}{\_DLOG()}}
{\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]}}



Definition at line 545 of file libhomescreen.\+cpp.


\begin{DoxyCode}
546 \{
547     \textcolor{keywordtype}{char} *message;
548     va\_list args;
549     va\_start(args, log);
550     \textcolor{keywordflow}{if} (log == NULL || vasprintf(&message, log, args) < 0)
551         message = NULL;
552     cout << \textcolor{stringliteral}{"[libhomescreen DEBUG]"} << func << \textcolor{stringliteral}{"("} << line << \textcolor{stringliteral}{"):"} << message << endl;
553     va\_end(args);
554     free(message);
555 \}
\end{DoxyCode}
\mbox{\Hypertarget{libhomescreen_8cpp_af583e7770fe13e35089388a45eaf9d9d}\label{libhomescreen_8cpp_af583e7770fe13e35089388a45eaf9d9d}} 
\index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!\+\_\+\+E\+L\+OG@{\+\_\+\+E\+L\+OG}}
\index{\+\_\+\+E\+L\+OG@{\+\_\+\+E\+L\+OG}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
\subsubsection{\texorpdfstring{\+\_\+\+E\+L\+O\+G()}{\_ELOG()}}
{\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]}}



Definition at line 533 of file libhomescreen.\+cpp.


\begin{DoxyCode}
534 \{
535     \textcolor{keywordtype}{char} *message;
536     va\_list args;
537     va\_start(args, log);
538     \textcolor{keywordflow}{if} (log == NULL || vasprintf(&message, log, args) < 0)
539         message = NULL;
540     cout << \textcolor{stringliteral}{"[libhomescreen ERROR]"} << func << \textcolor{stringliteral}{"("} << line << \textcolor{stringliteral}{"):"} << message << endl;
541     va\_end(args);
542     free(message);
543 \}
\end{DoxyCode}
\mbox{\Hypertarget{libhomescreen_8cpp_a782a05fde0f1c17e0c4c8f972a3f53c8}\label{libhomescreen_8cpp_a782a05fde0f1c17e0c4c8f972a3f53c8}} 
\index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!\+\_\+on\+\_\+call\+\_\+static@{\+\_\+on\+\_\+call\+\_\+static}}
\index{\+\_\+on\+\_\+call\+\_\+static@{\+\_\+on\+\_\+call\+\_\+static}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
\subsubsection{\texorpdfstring{\+\_\+on\+\_\+call\+\_\+static()}{\_on\_call\_static()}}
{\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]}}



Definition at line 66 of file libhomescreen.\+cpp.


\begin{DoxyCode}
67 \{
68     \textcolor{comment}{/* LibHomeScreen is not called from other process */}
69 \}
\end{DoxyCode}
\mbox{\Hypertarget{libhomescreen_8cpp_a3df86185aa9453726556da201d95a6f9}\label{libhomescreen_8cpp_a3df86185aa9453726556da201d95a6f9}} 
\index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!\+\_\+on\+\_\+event\+\_\+static@{\+\_\+on\+\_\+event\+\_\+static}}
\index{\+\_\+on\+\_\+event\+\_\+static@{\+\_\+on\+\_\+event\+\_\+static}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
\subsubsection{\texorpdfstring{\+\_\+on\+\_\+event\+\_\+static()}{\_on\_event\_static()}}
{\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]}}



Definition at line 71 of file libhomescreen.\+cpp.


\begin{DoxyCode}
72 \{
73     \textcolor{keyword}{static\_cast<}\hyperlink{class_lib_home_screen}{LibHomeScreen}*\textcolor{keyword}{>}(closure)->on\_event(NULL,\hyperlink{structevent}{event},msg);
74 \}
\end{DoxyCode}
\mbox{\Hypertarget{libhomescreen_8cpp_a73c05b96c151e5e46c28585ccb143c1c}\label{libhomescreen_8cpp_a73c05b96c151e5e46c28585ccb143c1c}} 
\index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!\+\_\+on\+\_\+hangup\+\_\+static@{\+\_\+on\+\_\+hangup\+\_\+static}}
\index{\+\_\+on\+\_\+hangup\+\_\+static@{\+\_\+on\+\_\+hangup\+\_\+static}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
\subsubsection{\texorpdfstring{\+\_\+on\+\_\+hangup\+\_\+static()}{\_on\_hangup\_static()}}
{\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]}}

websocket 

Definition at line 61 of file libhomescreen.\+cpp.


\begin{DoxyCode}
62 \{
63     \textcolor{keyword}{static\_cast<}\hyperlink{class_lib_home_screen}{LibHomeScreen}*\textcolor{keyword}{>}(closure)->on\_hangup(NULL,wsj);
64 \}
\end{DoxyCode}
\mbox{\Hypertarget{libhomescreen_8cpp_a7778933bffa862c63fa0a1b8219faa8b}\label{libhomescreen_8cpp_a7778933bffa862c63fa0a1b8219faa8b}} 
\index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!\+\_\+on\+\_\+reply\+\_\+static@{\+\_\+on\+\_\+reply\+\_\+static}}
\index{\+\_\+on\+\_\+reply\+\_\+static@{\+\_\+on\+\_\+reply\+\_\+static}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
\subsubsection{\texorpdfstring{\+\_\+on\+\_\+reply\+\_\+static()}{\_on\_reply\_static()}}
{\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]}}



Definition at line 76 of file libhomescreen.\+cpp.


\begin{DoxyCode}
77 \{
78     \textcolor{keyword}{static\_cast<}\hyperlink{class_lib_home_screen}{LibHomeScreen}*\textcolor{keyword}{>}(closure)->on\_reply(NULL,msg);
79 \}
\end{DoxyCode}
\mbox{\Hypertarget{libhomescreen_8cpp_aa73353e1bf62c68b6b0aba7a1e4e275e}\label{libhomescreen_8cpp_aa73353e1bf62c68b6b0aba7a1e4e275e}} 
\index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!event\+\_\+loop\+\_\+run@{event\+\_\+loop\+\_\+run}}
\index{event\+\_\+loop\+\_\+run@{event\+\_\+loop\+\_\+run}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
\subsubsection{\texorpdfstring{event\+\_\+loop\+\_\+run()}{event\_loop\_run()}}
{\footnotesize\ttfamily static void$\ast$ event\+\_\+loop\+\_\+run (\begin{DoxyParamCaption}\item[{void $\ast$}]{args }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Definition at line 204 of file libhomescreen.\+cpp.


\begin{DoxyCode}
205 \{
206     \textcolor{keyword}{struct }sd\_event* loop = (\textcolor{keyword}{struct }sd\_event*)(args);
207     \hyperlink{libhomescreen_8cpp_a4e42b2f5af2174dd24f958351becf63d}{DLOG}(\textcolor{stringliteral}{"start eventloop"});
208     \textcolor{keywordflow}{for}(;;)
209         sd\_event\_run(loop, 30000000);
210 \}
\end{DoxyCode}
\mbox{\Hypertarget{libhomescreen_8cpp_a7a2176c3d71fec0f09dcb2aa0866b17e}\label{libhomescreen_8cpp_a7a2176c3d71fec0f09dcb2aa0866b17e}} 
\index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!has\+\_\+verb@{has\+\_\+verb}}
\index{has\+\_\+verb@{has\+\_\+verb}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
\subsubsection{\texorpdfstring{has\+\_\+verb()}{has\_verb()}}
{\footnotesize\ttfamily static bool has\+\_\+verb (\begin{DoxyParamCaption}\item[{const string \&}]{verb }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Definition at line 557 of file libhomescreen.\+cpp.


\begin{DoxyCode}
558 \{
559     \hyperlink{libhomescreen_8cpp_a4e42b2f5af2174dd24f958351becf63d}{DLOG}(\textcolor{stringliteral}{"verb is %s"}, verb.c\_str());
560     \textcolor{keywordflow}{if}(find(\hyperlink{class_lib_home_screen_a5593ff5ac78f6495ccb649904cf0ab08}{LibHomeScreen::api\_list}.begin(), 
      \hyperlink{class_lib_home_screen_a5593ff5ac78f6495ccb649904cf0ab08}{LibHomeScreen::api\_list}.end(), verb) != 
      \hyperlink{class_lib_home_screen_a5593ff5ac78f6495ccb649904cf0ab08}{LibHomeScreen::api\_list}.end())
561         \textcolor{keywordflow}{return} \textcolor{keyword}{true};
562     \textcolor{keywordflow}{else}
563         \textcolor{keywordflow}{return} \textcolor{keyword}{false};
564 \}
\end{DoxyCode}


\subsection{Variable Documentation}
\mbox{\Hypertarget{libhomescreen_8cpp_a1e2d6e77dd8f0162f830058579eab42f}\label{libhomescreen_8cpp_a1e2d6e77dd8f0162f830058579eab42f}} 
\index{libhomescreen.\+cpp@{libhomescreen.\+cpp}!A\+PI@{A\+PI}}
\index{A\+PI@{A\+PI}!libhomescreen.\+cpp@{libhomescreen.\+cpp}}
\subsubsection{\texorpdfstring{A\+PI}{API}}
{\footnotesize\ttfamily const char A\+PI\mbox{[}$\,$\mbox{]} = \char`\"{}homescreen\char`\"{}\hspace{0.3cm}{\ttfamily [static]}}



Definition at line 40 of file libhomescreen.\+cpp.

