diff options
Diffstat (limited to 'doc/api-ref/latex/dd/d1d/hs-helper_8c.tex')
-rw-r--r-- | doc/api-ref/latex/dd/d1d/hs-helper_8c.tex | 238 |
1 files changed, 238 insertions, 0 deletions
diff --git a/doc/api-ref/latex/dd/d1d/hs-helper_8c.tex b/doc/api-ref/latex/dd/d1d/hs-helper_8c.tex new file mode 100644 index 0000000..74c26fb --- /dev/null +++ b/doc/api-ref/latex/dd/d1d/hs-helper_8c.tex @@ -0,0 +1,238 @@ +\hypertarget{hs-helper_8c}{}\section{homescreen\+\_\+service/hs-\/helper.c File Reference} +\label{hs-helper_8c}\index{homescreen\+\_\+service/hs-\/helper.\+c@{homescreen\+\_\+service/hs-\/helper.\+c}} +{\ttfamily \#include \char`\"{}hs-\/helper.\+h\char`\"{}}\newline +{\ttfamily \#include $<$stdlib.\+h$>$}\newline +{\ttfamily \#include $<$string.\+h$>$}\newline +{\ttfamily \#include $<$limits.\+h$>$}\newline +{\ttfamily \#include $<$json-\/c/json.\+h$>$}\newline +{\ttfamily \#include $<$stdarg.\+h$>$}\newline +\subsection*{Functions} +\begin{DoxyCompactItemize} +\item +\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) +\item +\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) +\item +\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) +\item +void \hyperlink{hs-helper_8c_a1ba31a6a94515ff1730ba0043a67d59e}{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object} (struct json\+\_\+object $\ast$j\+\_\+obj, int count,...) +\item +void \hyperlink{hs-helper_8c_a8777c53f1d4d5412f19b134ad85ffedf}{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+str} (struct json\+\_\+object $\ast$j\+\_\+obj, int count,...) +\item +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,...) +\item +int \hyperlink{hs-helper_8c_a2ff1b894941c3b461ca8119079c4146a}{hs\+\_\+search\+\_\+event\+\_\+name\+\_\+index} (const char $\ast$value) +\end{DoxyCompactItemize} + + +\subsection{Function Documentation} +\mbox{\Hypertarget{hs-helper_8c_a2e62366684e39ea94436bf017e416827}\label{hs-helper_8c_a2e62366684e39ea94436bf017e416827}} +\index{hs-\/helper.\+c@{hs-\/helper.\+c}!get\+\_\+value\+\_\+int16@{get\+\_\+value\+\_\+int16}} +\index{get\+\_\+value\+\_\+int16@{get\+\_\+value\+\_\+int16}!hs-\/helper.\+c@{hs-\/helper.\+c}} +\subsubsection{\texorpdfstring{get\+\_\+value\+\_\+int16()}{get\_value\_int16()}} +{\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})} + + + +Definition at line 48 of file hs-\/helper.\+c. + + +\begin{DoxyCode} +49 \{ +50 \textcolor{keywordtype}{char}* endptr; +51 \textcolor{keyword}{const} \textcolor{keywordtype}{char}* tmp = afb\_req\_value (request, source); +52 \textcolor{keywordflow}{if}(!tmp) +53 \{ +54 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899a96a855966bc63045222b3dcac524cee1}{REQ\_FAIL}; +55 \} +56 \textcolor{keywordtype}{long} tmp\_id = strtol(tmp,&endptr,10); +57 +58 \textcolor{comment}{/* error check of range */} +59 \textcolor{keywordflow}{if}( (tmp\_id > INT16\_MAX) || (tmp\_id < INT16\_MIN) ) +60 \{ +61 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899add1c84bf80c5f80741ee8f37fef1e12b}{OUT\_RANGE}; +62 \} +63 \textcolor{keywordflow}{if}(*endptr != \textcolor{charliteral}{'\(\backslash\)0'}) +64 \{ +65 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899aa223eed65c9bee2bf1f4cdecaf90d66a}{NOT\_NUMBER}; +66 \} +67 +68 *out\_id = (int16\_t)tmp\_id; +69 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899ab093abb14c097b3b7719debb04d5e8ee}{REQ\_OK}; +70 \} +\end{DoxyCode} +\mbox{\Hypertarget{hs-helper_8c_ac5b0370643c520377afd3fd4891918d2}\label{hs-helper_8c_ac5b0370643c520377afd3fd4891918d2}} +\index{hs-\/helper.\+c@{hs-\/helper.\+c}!get\+\_\+value\+\_\+int32@{get\+\_\+value\+\_\+int32}} +\index{get\+\_\+value\+\_\+int32@{get\+\_\+value\+\_\+int32}!hs-\/helper.\+c@{hs-\/helper.\+c}} +\subsubsection{\texorpdfstring{get\+\_\+value\+\_\+int32()}{get\_value\_int32()}} +{\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})} + + + +Definition at line 72 of file hs-\/helper.\+c. + + +\begin{DoxyCode} +73 \{ +74 \textcolor{keywordtype}{char}* endptr; +75 \textcolor{keyword}{const} \textcolor{keywordtype}{char}* tmp = afb\_req\_value (request, source); +76 \textcolor{keywordflow}{if}(!tmp) +77 \{ +78 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899a96a855966bc63045222b3dcac524cee1}{REQ\_FAIL}; +79 \} +80 \textcolor{keywordtype}{long} tmp\_id = strtol(tmp,&endptr,10); +81 +82 \textcolor{comment}{/* error check of range */} +83 \textcolor{keywordflow}{if}( (tmp\_id > INT32\_MAX) || (tmp\_id < INT32\_MIN) ) +84 \{ +85 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899add1c84bf80c5f80741ee8f37fef1e12b}{OUT\_RANGE}; +86 \} +87 \textcolor{keywordflow}{if}(*endptr != \textcolor{charliteral}{'\(\backslash\)0'}) +88 \{ +89 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899aa223eed65c9bee2bf1f4cdecaf90d66a}{NOT\_NUMBER}; +90 \} +91 +92 *out\_id = (int32\_t)tmp\_id; +93 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899ab093abb14c097b3b7719debb04d5e8ee}{REQ\_OK}; +94 \} +\end{DoxyCode} +\mbox{\Hypertarget{hs-helper_8c_a649900645417f2df3a70b9ad67529f53}\label{hs-helper_8c_a649900645417f2df3a70b9ad67529f53}} +\index{hs-\/helper.\+c@{hs-\/helper.\+c}!get\+\_\+value\+\_\+uint16@{get\+\_\+value\+\_\+uint16}} +\index{get\+\_\+value\+\_\+uint16@{get\+\_\+value\+\_\+uint16}!hs-\/helper.\+c@{hs-\/helper.\+c}} +\subsubsection{\texorpdfstring{get\+\_\+value\+\_\+uint16()}{get\_value\_uint16()}} +{\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})} + + + +Definition at line 24 of file hs-\/helper.\+c. + + +\begin{DoxyCode} +25 \{ +26 \textcolor{keywordtype}{char}* endptr; +27 \textcolor{keyword}{const} \textcolor{keywordtype}{char}* tmp = afb\_req\_value (request, source); +28 \textcolor{keywordflow}{if}(!tmp) +29 \{ +30 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899a96a855966bc63045222b3dcac524cee1}{REQ\_FAIL}; +31 \} +32 \textcolor{keywordtype}{long} tmp\_id = strtol(tmp,&endptr,10); +33 +34 \textcolor{comment}{/* error check of range */} +35 \textcolor{keywordflow}{if}( (tmp\_id > UINT16\_MAX) || (tmp\_id < 0) ) +36 \{ +37 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899add1c84bf80c5f80741ee8f37fef1e12b}{OUT\_RANGE}; +38 \} +39 \textcolor{keywordflow}{if}(*endptr != \textcolor{charliteral}{'\(\backslash\)0'}) +40 \{ +41 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899aa223eed65c9bee2bf1f4cdecaf90d66a}{NOT\_NUMBER}; +42 \} +43 +44 *out\_id = (uint16\_t)tmp\_id; +45 \textcolor{keywordflow}{return} \hyperlink{hs-helper_8h_aa49f1dbbf26f01627a5737cf43aad899ab093abb14c097b3b7719debb04d5e8ee}{REQ\_OK}; +46 \} +\end{DoxyCode} +\mbox{\Hypertarget{hs-helper_8c_a1ba31a6a94515ff1730ba0043a67d59e}\label{hs-helper_8c_a1ba31a6a94515ff1730ba0043a67d59e}} +\index{hs-\/helper.\+c@{hs-\/helper.\+c}!hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object@{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object}} +\index{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object@{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object}!hs-\/helper.\+c@{hs-\/helper.\+c}} +\subsubsection{\texorpdfstring{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object()}{hs\_add\_object\_to\_json\_object()}} +{\footnotesize\ttfamily void hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object (\begin{DoxyParamCaption}\item[{struct json\+\_\+object $\ast$}]{j\+\_\+obj, }\item[{int}]{count, }\item[{}]{... }\end{DoxyParamCaption})} + + + +Definition at line 96 of file hs-\/helper.\+c. + + +\begin{DoxyCode} +97 \{ +98 va\_list args; +99 va\_start(args, count); +100 \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int} i = 0; i < count; ++i ) +101 \{ +102 \textcolor{keywordtype}{char} *key = va\_arg(args, \textcolor{keywordtype}{char}*); +103 \textcolor{keywordtype}{int} value = va\_arg(args, \textcolor{keywordtype}{int}); +104 json\_object\_object\_add(j\_obj, key, json\_object\_new\_int((int32\_t)value)); +105 ++i; +106 \} +107 va\_end(args); +108 \} +\end{DoxyCode} +\mbox{\Hypertarget{hs-helper_8c_ae83604a37134e7bdee3ce4f10bb0b47a}\label{hs-helper_8c_ae83604a37134e7bdee3ce4f10bb0b47a}} +\index{hs-\/helper.\+c@{hs-\/helper.\+c}!hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+func@{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+func}} +\index{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+func@{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+func}!hs-\/helper.\+c@{hs-\/helper.\+c}} +\subsubsection{\texorpdfstring{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+func()}{hs\_add\_object\_to\_json\_object\_func()}} +{\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})} + + + +Definition at line 125 of file hs-\/helper.\+c. + + +\begin{DoxyCode} +126 \{ +127 va\_list args; +128 va\_start(args, count); +129 +130 json\_object\_object\_add(j\_obj,\textcolor{stringliteral}{"verb"}, json\_object\_new\_string(verb\_name)); +131 +132 \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int} i = 0; i < count; ++i ) +133 \{ +134 \textcolor{keywordtype}{char} *key = va\_arg(args, \textcolor{keywordtype}{char}*); +135 \textcolor{keywordtype}{int} value = va\_arg(args, \textcolor{keywordtype}{int}); +136 json\_object\_object\_add(j\_obj, key, json\_object\_new\_int((int32\_t)value)); +137 ++i; +138 \} +139 va\_end(args); +140 \} +\end{DoxyCode} +\mbox{\Hypertarget{hs-helper_8c_a8777c53f1d4d5412f19b134ad85ffedf}\label{hs-helper_8c_a8777c53f1d4d5412f19b134ad85ffedf}} +\index{hs-\/helper.\+c@{hs-\/helper.\+c}!hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+str@{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+str}} +\index{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+str@{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+str}!hs-\/helper.\+c@{hs-\/helper.\+c}} +\subsubsection{\texorpdfstring{hs\+\_\+add\+\_\+object\+\_\+to\+\_\+json\+\_\+object\+\_\+str()}{hs\_add\_object\_to\_json\_object\_str()}} +{\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})} + + + +Definition at line 110 of file hs-\/helper.\+c. + + +\begin{DoxyCode} +111 \{ +112 va\_list args; +113 va\_start(args, count); +114 \textcolor{keywordflow}{for}(\textcolor{keywordtype}{int} i = 0; i < count; ++i ) +115 \{ +116 \textcolor{keywordtype}{char} *key = va\_arg(args, \textcolor{keywordtype}{char}*); +117 \textcolor{keywordtype}{char} *value = va\_arg(args, \textcolor{keywordtype}{char}*); +118 json\_object\_object\_add(j\_obj, key, json\_object\_new\_string(value)); +119 ++i; +120 \} +121 va\_end(args); +122 \} +\end{DoxyCode} +\mbox{\Hypertarget{hs-helper_8c_a2ff1b894941c3b461ca8119079c4146a}\label{hs-helper_8c_a2ff1b894941c3b461ca8119079c4146a}} +\index{hs-\/helper.\+c@{hs-\/helper.\+c}!hs\+\_\+search\+\_\+event\+\_\+name\+\_\+index@{hs\+\_\+search\+\_\+event\+\_\+name\+\_\+index}} +\index{hs\+\_\+search\+\_\+event\+\_\+name\+\_\+index@{hs\+\_\+search\+\_\+event\+\_\+name\+\_\+index}!hs-\/helper.\+c@{hs-\/helper.\+c}} +\subsubsection{\texorpdfstring{hs\+\_\+search\+\_\+event\+\_\+name\+\_\+index()}{hs\_search\_event\_name\_index()}} +{\footnotesize\ttfamily int hs\+\_\+search\+\_\+event\+\_\+name\+\_\+index (\begin{DoxyParamCaption}\item[{const char $\ast$}]{value }\end{DoxyParamCaption})} + + + +Definition at line 142 of file hs-\/helper.\+c. + + +\begin{DoxyCode} +143 \{ +144 \textcolor{keywordtype}{size\_t} buf\_size = 50; +145 \textcolor{keywordtype}{size\_t} size = \textcolor{keyword}{sizeof} \hyperlink{hs-helper_8h_a0cd84b1a2184c9b84d1b7bf24582f28e}{evlist} / \textcolor{keyword}{sizeof} *\hyperlink{hs-helper_8h_a0cd84b1a2184c9b84d1b7bf24582f28e}{evlist}; +146 \textcolor{keywordtype}{int} ret = -1; +147 \textcolor{keywordflow}{for}(\textcolor{keywordtype}{size\_t} i = 0 ; i < size ; ++i) +148 \{ +149 \textcolor{keywordflow}{if}(!strncmp(value, \hyperlink{hs-helper_8h_a0cd84b1a2184c9b84d1b7bf24582f28e}{evlist}[i], buf\_size)) +150 \{ +151 ret = i; +152 \textcolor{keywordflow}{break}; +153 \} +154 \} +155 \textcolor{keywordflow}{return} ret; +156 \} +\end{DoxyCode} |