1 \hypertarget{hs-helper_8c}{}\section{homescreen\+\_\+service/hs-\/helper.c File Reference}
2 \label{hs-helper_8c}\index{homescreen\+\_\+service/hs-\/helper.\+c@{homescreen\+\_\+service/hs-\/helper.\+c}}
3 {\ttfamily \#include \char`\"{}hs-\/helper.\+h\char`\"{}}\newline
4 {\ttfamily \#include $<$stdlib.\+h$>$}\newline
5 {\ttfamily \#include $<$string.\+h$>$}\newline
6 {\ttfamily \#include $<$limits.\+h$>$}\newline
7 {\ttfamily \#include $<$json-\/c/json.\+h$>$}\newline
8 {\ttfamily \#include $<$stdarg.\+h$>$}\newline
9 \subsection*{Functions}
10 \begin{DoxyCompactItemize}
12 \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899}{R\+E\+Q\+\_\+\+E\+R\+R\+OR} \hyperlink{hs-helper_8c_a649900645417f2df3a70b9ad67529f53}{get\+\_\+value\+\_\+uint16} (const struct afb\+\_\+req request, const char $\ast$source, uint16\+\_\+t $\ast$out\+\_\+id)
14 \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899}{R\+E\+Q\+\_\+\+E\+R\+R\+OR} \hyperlink{hs-helper_8c_a2e62366684e39ea94436bf017e416827}{get\+\_\+value\+\_\+int16} (const struct afb\+\_\+req request, const char $\ast$source, int16\+\_\+t $\ast$out\+\_\+id)
16 \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899}{R\+E\+Q\+\_\+\+E\+R\+R\+OR} \hyperlink{hs-helper_8c_ac5b0370643c520377afd3fd4891918d2}{get\+\_\+value\+\_\+int32} (const struct afb\+\_\+req request, const char $\ast$source, int32\+\_\+t $\ast$out\+\_\+id)
18 void \hyperlink{hs-helper_8c_a1ba31a6a94515ff1730ba0043a67d59e}{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object} (struct json\+\_\+object $\ast$j\+\_\+obj, int count,...)
20 void \hyperlink{hs-helper_8c_a8777c53f1d4d5412f19b134ad85ffedf}{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+str} (struct json\+\_\+object $\ast$j\+\_\+obj, int count,...)
22 void \hyperlink{hs-helper_8c_ae83604a37134e7bdee3ce4f10bb0b47a}{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+func} (struct json\+\_\+object $\ast$j\+\_\+obj, const char $\ast$verb\+\_\+name, int count,...)
24 int \hyperlink{hs-helper_8c_a2ff1b894941c3b461ca8119079c4146a}{hs\+\_\+search\+\_\+event\+\_\+name\+\_\+index} (const char $\ast$value)
25 \end{DoxyCompactItemize}
28 \subsection{Function Documentation}
29 \mbox{\Hypertarget{hs-helper_8c_a2e62366684e39ea94436bf017e416827}\label{hs-helper_8c_a2e62366684e39ea94436bf017e416827}}
30 \index{hs-\/helper.\+c@{hs-\/helper.\+c}!get\+\_\+value\+\_\+int16@{get\+\_\+value\+\_\+int16}}
31 \index{get\+\_\+value\+\_\+int16@{get\+\_\+value\+\_\+int16}!hs-\/helper.\+c@{hs-\/helper.\+c}}
32 \subsubsection{\texorpdfstring{get\+\_\+value\+\_\+int16()}{get\_value\_int16()}}
33 {\footnotesize\ttfamily \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899}{R\+E\+Q\+\_\+\+E\+R\+R\+OR} get\+\_\+value\+\_\+int16 (\begin{DoxyParamCaption}\item[{const struct afb\+\_\+req}]{request, }\item[{const char $\ast$}]{source, }\item[{int16\+\_\+t $\ast$}]{out\+\_\+id }\end{DoxyParamCaption})}
37 Definition at line 48 of file hs-\/helper.\+c.
42 50 \textcolor{keywordtype}{char}* endptr;
43 51 \textcolor{keyword}{const} \textcolor{keywordtype}{char}* tmp = afb\_req\_value (request, source);
44 52 \textcolor{keywordflow}{if}(!tmp)
46 54 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899a96a855966bc63045222b3dcac524cee1}{REQ\_FAIL};
48 56 \textcolor{keywordtype}{long} tmp\_id = strtol(tmp,&endptr,10);
50 58 \textcolor{comment}{/* error check of range */}
51 59 \textcolor{keywordflow}{if}( (tmp\_id > INT16\_MAX) || (tmp\_id < INT16\_MIN) )
53 61 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899add1c84bf80c5f80741ee8f37fef1e12b}{OUT\_RANGE};
55 63 \textcolor{keywordflow}{if}(*endptr != \textcolor{charliteral}{'\(\backslash\)0'})
57 65 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899aa223eed65c9bee2bf1f4cdecaf90d66a}{NOT\_NUMBER};
60 68 *out\_id = (int16\_t)tmp\_id;
61 69 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899ab093abb14c097b3b7719debb04d5e8ee}{REQ\_OK};
64 \mbox{\Hypertarget{hs-helper_8c_ac5b0370643c520377afd3fd4891918d2}\label{hs-helper_8c_ac5b0370643c520377afd3fd4891918d2}}
65 \index{hs-\/helper.\+c@{hs-\/helper.\+c}!get\+\_\+value\+\_\+int32@{get\+\_\+value\+\_\+int32}}
66 \index{get\+\_\+value\+\_\+int32@{get\+\_\+value\+\_\+int32}!hs-\/helper.\+c@{hs-\/helper.\+c}}
67 \subsubsection{\texorpdfstring{get\+\_\+value\+\_\+int32()}{get\_value\_int32()}}
68 {\footnotesize\ttfamily \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899}{R\+E\+Q\+\_\+\+E\+R\+R\+OR} get\+\_\+value\+\_\+int32 (\begin{DoxyParamCaption}\item[{const struct afb\+\_\+req}]{request, }\item[{const char $\ast$}]{source, }\item[{int32\+\_\+t $\ast$}]{out\+\_\+id }\end{DoxyParamCaption})}
72 Definition at line 72 of file hs-\/helper.\+c.
77 74 \textcolor{keywordtype}{char}* endptr;
78 75 \textcolor{keyword}{const} \textcolor{keywordtype}{char}* tmp = afb\_req\_value (request, source);
79 76 \textcolor{keywordflow}{if}(!tmp)
81 78 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899a96a855966bc63045222b3dcac524cee1}{REQ\_FAIL};
83 80 \textcolor{keywordtype}{long} tmp\_id = strtol(tmp,&endptr,10);
85 82 \textcolor{comment}{/* error check of range */}
86 83 \textcolor{keywordflow}{if}( (tmp\_id > INT32\_MAX) || (tmp\_id < INT32\_MIN) )
88 85 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899add1c84bf80c5f80741ee8f37fef1e12b}{OUT\_RANGE};
90 87 \textcolor{keywordflow}{if}(*endptr != \textcolor{charliteral}{'\(\backslash\)0'})
92 89 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899aa223eed65c9bee2bf1f4cdecaf90d66a}{NOT\_NUMBER};
95 92 *out\_id = (int32\_t)tmp\_id;
96 93 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899ab093abb14c097b3b7719debb04d5e8ee}{REQ\_OK};
99 \mbox{\Hypertarget{hs-helper_8c_a649900645417f2df3a70b9ad67529f53}\label{hs-helper_8c_a649900645417f2df3a70b9ad67529f53}}
100 \index{hs-\/helper.\+c@{hs-\/helper.\+c}!get\+\_\+value\+\_\+uint16@{get\+\_\+value\+\_\+uint16}}
101 \index{get\+\_\+value\+\_\+uint16@{get\+\_\+value\+\_\+uint16}!hs-\/helper.\+c@{hs-\/helper.\+c}}
102 \subsubsection{\texorpdfstring{get\+\_\+value\+\_\+uint16()}{get\_value\_uint16()}}
103 {\footnotesize\ttfamily \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899}{R\+E\+Q\+\_\+\+E\+R\+R\+OR} get\+\_\+value\+\_\+uint16 (\begin{DoxyParamCaption}\item[{const struct afb\+\_\+req}]{request, }\item[{const char $\ast$}]{source, }\item[{uint16\+\_\+t $\ast$}]{out\+\_\+id }\end{DoxyParamCaption})}
107 Definition at line 24 of file hs-\/helper.\+c.
112 26 \textcolor{keywordtype}{char}* endptr;
113 27 \textcolor{keyword}{const} \textcolor{keywordtype}{char}* tmp = afb\_req\_value (request, source);
114 28 \textcolor{keywordflow}{if}(!tmp)
116 30 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899a96a855966bc63045222b3dcac524cee1}{REQ\_FAIL};
118 32 \textcolor{keywordtype}{long} tmp\_id = strtol(tmp,&endptr,10);
120 34 \textcolor{comment}{/* error check of range */}
121 35 \textcolor{keywordflow}{if}( (tmp\_id > UINT16\_MAX) || (tmp\_id < 0) )
123 37 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899add1c84bf80c5f80741ee8f37fef1e12b}{OUT\_RANGE};
125 39 \textcolor{keywordflow}{if}(*endptr != \textcolor{charliteral}{'\(\backslash\)0'})
127 41 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899aa223eed65c9bee2bf1f4cdecaf90d66a}{NOT\_NUMBER};
130 44 *out\_id = (uint16\_t)tmp\_id;
131 45 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899ab093abb14c097b3b7719debb04d5e8ee}{REQ\_OK};
134 \mbox{\Hypertarget{hs-helper_8c_a1ba31a6a94515ff1730ba0043a67d59e}\label{hs-helper_8c_a1ba31a6a94515ff1730ba0043a67d59e}}
135 \index{hs-\/helper.\+c@{hs-\/helper.\+c}!hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object@{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object}}
136 \index{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object@{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object}!hs-\/helper.\+c@{hs-\/helper.\+c}}
137 \subsubsection{\texorpdfstring{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object()}{hs\_add\_object\_to\_json\_object()}}
138 {\footnotesize\ttfamily void hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object (\begin{DoxyParamCaption}\item[{struct json\+\_\+object $\ast$}]{j\+\_\+obj, }\item[{int}]{count, }\item[{}]{... }\end{DoxyParamCaption})}
142 Definition at line 96 of file hs-\/helper.\+c.
148 99 va\_start(args, count);
149 100 \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int} i = 0; i < count; ++i )
151 102 \textcolor{keywordtype}{char} *key = va\_arg(args, \textcolor{keywordtype}{char}*);
152 103 \textcolor{keywordtype}{int} value = va\_arg(args, \textcolor{keywordtype}{int});
153 104 json\_object\_object\_add(j\_obj, key, json\_object\_new\_int((int32\_t)value));
159 \mbox{\Hypertarget{hs-helper_8c_ae83604a37134e7bdee3ce4f10bb0b47a}\label{hs-helper_8c_ae83604a37134e7bdee3ce4f10bb0b47a}}
160 \index{hs-\/helper.\+c@{hs-\/helper.\+c}!hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+func@{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+func}}
161 \index{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+func@{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+func}!hs-\/helper.\+c@{hs-\/helper.\+c}}
162 \subsubsection{\texorpdfstring{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+func()}{hs\_add\_object\_to\_json\_object\_func()}}
163 {\footnotesize\ttfamily void hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+func (\begin{DoxyParamCaption}\item[{struct json\+\_\+object $\ast$}]{j\+\_\+obj, }\item[{const char $\ast$}]{verb\+\_\+name, }\item[{int}]{count, }\item[{}]{... }\end{DoxyParamCaption})}
167 Definition at line 125 of file hs-\/helper.\+c.
173 128 va\_start(args, count);
175 130 json\_object\_object\_add(j\_obj,\textcolor{stringliteral}{"verb"}, json\_object\_new\_string(verb\_name));
177 132 \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int} i = 0; i < count; ++i )
179 134 \textcolor{keywordtype}{char} *key = va\_arg(args, \textcolor{keywordtype}{char}*);
180 135 \textcolor{keywordtype}{int} value = va\_arg(args, \textcolor{keywordtype}{int});
181 136 json\_object\_object\_add(j\_obj, key, json\_object\_new\_int((int32\_t)value));
187 \mbox{\Hypertarget{hs-helper_8c_a8777c53f1d4d5412f19b134ad85ffedf}\label{hs-helper_8c_a8777c53f1d4d5412f19b134ad85ffedf}}
188 \index{hs-\/helper.\+c@{hs-\/helper.\+c}!hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+str@{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+str}}
189 \index{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+str@{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+str}!hs-\/helper.\+c@{hs-\/helper.\+c}}
190 \subsubsection{\texorpdfstring{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+str()}{hs\_add\_object\_to\_json\_object\_str()}}
191 {\footnotesize\ttfamily void hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+str (\begin{DoxyParamCaption}\item[{struct json\+\_\+object $\ast$}]{j\+\_\+obj, }\item[{int}]{count, }\item[{}]{... }\end{DoxyParamCaption})}
195 Definition at line 110 of file hs-\/helper.\+c.
201 113 va\_start(args, count);
202 114 \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int} i = 0; i < count; ++i )
204 116 \textcolor{keywordtype}{char} *key = va\_arg(args, \textcolor{keywordtype}{char}*);
205 117 \textcolor{keywordtype}{char} *value = va\_arg(args, \textcolor{keywordtype}{char}*);
206 118 json\_object\_object\_add(j\_obj, key, json\_object\_new\_string(value));
212 \mbox{\Hypertarget{hs-helper_8c_a2ff1b894941c3b461ca8119079c4146a}\label{hs-helper_8c_a2ff1b894941c3b461ca8119079c4146a}}
213 \index{hs-\/helper.\+c@{hs-\/helper.\+c}!hs\+\_\+search\+\_\+event\+\_\+name\+\_\+index@{hs\+\_\+search\+\_\+event\+\_\+name\+\_\+index}}
214 \index{hs\+\_\+search\+\_\+event\+\_\+name\+\_\+index@{hs\+\_\+search\+\_\+event\+\_\+name\+\_\+index}!hs-\/helper.\+c@{hs-\/helper.\+c}}
215 \subsubsection{\texorpdfstring{hs\+\_\+search\+\_\+event\+\_\+name\+\_\+index()}{hs\_search\_event\_name\_index()}}
216 {\footnotesize\ttfamily int hs\+\_\+search\+\_\+event\+\_\+name\+\_\+index (\begin{DoxyParamCaption}\item[{const char $\ast$}]{value }\end{DoxyParamCaption})}
220 Definition at line 142 of file hs-\/helper.\+c.
225 144 \textcolor{keywordtype}{size\_t} buf\_size = 50;
226 145 \textcolor{keywordtype}{size\_t} size = \textcolor{keyword}{sizeof} \hyperlink{hs-helper_8h_a0cd84b1a2184c9b84d1b7bf24582f28e}{evlist} / \textcolor{keyword}{sizeof} *\hyperlink{hs-helper_8h_a0cd84b1a2184c9b84d1b7bf24582f28e}{evlist};
227 146 \textcolor{keywordtype}{int} ret = -1;
228 147 \textcolor{keywordflow}{for}(\textcolor{keywordtype}{size\_t} i = 0 ; i < size ; ++i)
230 149 \textcolor{keywordflow}{if}(!strncmp(value, \hyperlink{hs-helper_8h_a0cd84b1a2184c9b84d1b7bf24582f28e}{evlist}[i], buf\_size))
233 152 \textcolor{keywordflow}{break};
236 155 \textcolor{keywordflow}{return} ret;