80b0c61de8d2a49a11da0e50e006438dd63f6bee
[apps/agl-service-homescreen.git] / doc / api-ref / html / df / d76 / hmi-debug_8h_source.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5 <meta http-equiv="X-UA-Compatible" content="IE=9"/>
6 <meta name="generator" content="Doxygen 1.8.13"/>
7 <meta name="viewport" content="width=device-width, initial-scale=1"/>
8 <title>HomeScreenBinding: include/hmi-debug.h Source File</title>
9 <link href="../../tabs.css" rel="stylesheet" type="text/css"/>
10 <script type="text/javascript" src="../../jquery.js"></script>
11 <script type="text/javascript" src="../../dynsections.js"></script>
12 <link href="../../search/search.css" rel="stylesheet" type="text/css"/>
13 <script type="text/javascript" src="../../search/searchdata.js"></script>
14 <script type="text/javascript" src="../../search/search.js"></script>
15 <link href="../../doxygen.css" rel="stylesheet" type="text/css" />
16 </head>
17 <body>
18 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
19 <div id="titlearea">
20 <table cellspacing="0" cellpadding="0">
21  <tbody>
22  <tr style="height: 56px;">
23   <td id="projectalign" style="padding-left: 0.5em;">
24    <div id="projectname">HomeScreenBinding
25    </div>
26   </td>
27  </tr>
28  </tbody>
29 </table>
30 </div>
31 <!-- end header part -->
32 <!-- Generated by Doxygen 1.8.13 -->
33 <script type="text/javascript">
34 var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
35 </script>
36 <script type="text/javascript" src="../../menudata.js"></script>
37 <script type="text/javascript" src="../../menu.js"></script>
38 <script type="text/javascript">
39 $(function() {
40   initMenu('../../',true,false,'search.php','Search');
41   $(document).ready(function() { init_search(); });
42 });
43 </script>
44 <div id="main-nav"></div>
45 <!-- window showing the filter options -->
46 <div id="MSearchSelectWindow"
47      onmouseover="return searchBox.OnSearchSelectShow()"
48      onmouseout="return searchBox.OnSearchSelectHide()"
49      onkeydown="return searchBox.OnSearchSelectKey(event)">
50 </div>
51
52 <!-- iframe showing the search results (closed by default) -->
53 <div id="MSearchResultsWindow">
54 <iframe src="javascript:void(0)" frameborder="0" 
55         name="MSearchResults" id="MSearchResults">
56 </iframe>
57 </div>
58
59 <div id="nav-path" class="navpath">
60   <ul>
61 <li class="navelem"><a class="el" href="../../dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li>  </ul>
62 </div>
63 </div><!-- top -->
64 <div class="header">
65   <div class="headertitle">
66 <div class="title">hmi-debug.h</div>  </div>
67 </div><!--header-->
68 <div class="contents">
69 <a href="../../df/d76/hmi-debug_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#ifndef __HMI_DEBUG_H__</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#define __HMI_DEBUG_H__</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;</div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &lt;time.h&gt;</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &lt;stdio.h&gt;</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &lt;afb/afb-binding.h&gt;</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;</div><div class="line"><a name="l00008"></a><span class="lineno"><a class="line" href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583">    8</a></span>&#160;<span class="keyword">enum</span> <a class="code" href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583">LOG_LEVEL</a>{</div><div class="line"><a name="l00009"></a><span class="lineno"><a class="line" href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583a69dacb1837e1e37c6ed34cc2ee1d8848">    9</a></span>&#160;    <a class="code" href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583a69dacb1837e1e37c6ed34cc2ee1d8848">LOG_LEVEL_NONE</a> = 0,</div><div class="line"><a name="l00010"></a><span class="lineno"><a class="line" href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583a5b40f003febbc3b535649d63f4b8a44f">   10</a></span>&#160;    <a class="code" href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583a5b40f003febbc3b535649d63f4b8a44f">LOG_LEVEL_ERROR</a>,</div><div class="line"><a name="l00011"></a><span class="lineno"><a class="line" href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583a5b4dd81b4dc7eefbc55ba03415c627ef">   11</a></span>&#160;    <a class="code" href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583a5b4dd81b4dc7eefbc55ba03415c627ef">LOG_LEVEL_WARNING</a>,</div><div class="line"><a name="l00012"></a><span class="lineno"><a class="line" href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583a23ae4d711a7bbb3900240cb7316b4b4e">   12</a></span>&#160;    <a class="code" href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583a23ae4d711a7bbb3900240cb7316b4b4e">LOG_LEVEL_NOTICE</a>,</div><div class="line"><a name="l00013"></a><span class="lineno"><a class="line" href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583aedee1e3159bfe7d918b6e29873c5aee4">   13</a></span>&#160;    <a class="code" href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583aedee1e3159bfe7d918b6e29873c5aee4">LOG_LEVEL_INFO</a>,</div><div class="line"><a name="l00014"></a><span class="lineno"><a class="line" href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583a538b2b6e011479d408ecd2be0f6d6177">   14</a></span>&#160;    <a class="code" href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583a538b2b6e011479d408ecd2be0f6d6177">LOG_LEVEL_DEBUG</a>,</div><div class="line"><a name="l00015"></a><span class="lineno"><a class="line" href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583a0459003454bc8bb17752e6d8e5787444">   15</a></span>&#160;    <a class="code" href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583a0459003454bc8bb17752e6d8e5787444">LOG_LEVEL_MAX</a> = <a class="code" href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583a5b40f003febbc3b535649d63f4b8a44f">LOG_LEVEL_ERROR</a></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;};</div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;</div><div class="line"><a name="l00018"></a><span class="lineno"><a class="line" href="../../df/d76/hmi-debug_8h.html#a65bb6c7cfe38f8a724beab5059d36fb2">   18</a></span>&#160;<span class="preprocessor">#define HMI_ERROR(prefix, args,...) _HMI_LOG(LOG_LEVEL_ERROR, __FILE__, __FUNCTION__, __LINE__, prefix, args, ##__VA_ARGS__)</span></div><div class="line"><a name="l00019"></a><span class="lineno"><a class="line" href="../../df/d76/hmi-debug_8h.html#a25361812432cd2480bc8f1a8e56ecbf7">   19</a></span>&#160;<span class="preprocessor">#define HMI_WARNING(prefix, args,...) _HMI_LOG(LOG_LEVEL_WARNING, __FILE__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)</span></div><div class="line"><a name="l00020"></a><span class="lineno"><a class="line" href="../../df/d76/hmi-debug_8h.html#abc0d6e0760017d8ae48b836925b2ef15">   20</a></span>&#160;<span class="preprocessor">#define HMI_NOTICE(prefix, args,...) _HMI_LOG(LOG_LEVEL_NOTICE, __FILE__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)</span></div><div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="../../df/d76/hmi-debug_8h.html#a11b249a67108f0f4c50a0fc8a3eb4f5c">   21</a></span>&#160;<span class="preprocessor">#define HMI_INFO(prefix, args,...)  _HMI_LOG(LOG_LEVEL_INFO, __FILE__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)</span></div><div class="line"><a name="l00022"></a><span class="lineno"><a class="line" href="../../df/d76/hmi-debug_8h.html#a0d26d8b8201011dade787236519711c0">   22</a></span>&#160;<span class="preprocessor">#define HMI_DEBUG(prefix, args,...) _HMI_LOG(LOG_LEVEL_DEBUG, __FILE__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;</div><div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="../../df/d76/hmi-debug_8h.html#a13d4c7647aad2e84766f8b48a6caab09">   24</a></span>&#160;<span class="keyword">static</span> <span class="keywordtype">char</span> <a class="code" href="../../df/d76/hmi-debug_8h.html#a13d4c7647aad2e84766f8b48a6caab09">ERROR_FLAG</a>[6][20] = {<span class="stringliteral">&quot;NONE&quot;</span>, <span class="stringliteral">&quot;ERROR&quot;</span>, <span class="stringliteral">&quot;WARNING&quot;</span>, <span class="stringliteral">&quot;NOTICE&quot;</span>, <span class="stringliteral">&quot;INFO&quot;</span>, <span class="stringliteral">&quot;DEBUG&quot;</span>};</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;</div><div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="../../df/d76/hmi-debug_8h.html#a0846b9d51e2e0612c4825a9a581aa40a">   26</a></span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="../../df/d76/hmi-debug_8h.html#a0846b9d51e2e0612c4825a9a581aa40a">_HMI_LOG</a>(<span class="keyword">enum</span> <a class="code" href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583">LOG_LEVEL</a> level, <span class="keyword">const</span> <span class="keywordtype">char</span>* file, <span class="keyword">const</span> <span class="keywordtype">char</span>* func, <span class="keyword">const</span> <span class="keywordtype">int</span> line, <span class="keyword">const</span> <span class="keywordtype">char</span>* prefix, <span class="keyword">const</span> <span class="keywordtype">char</span>* log, ...)</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;{</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">int</span> log_level = (getenv(<span class="stringliteral">&quot;USE_HMI_DEBUG&quot;</span>) == NULL)?0:atoi(getenv(<span class="stringliteral">&quot;USE_HMI_DEBUG&quot;</span>));</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;    <span class="keywordflow">if</span>(log_level &lt; level)</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    {</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;        <span class="keywordflow">return</span>;</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    }</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;    <span class="keywordtype">char</span> *message;</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;    <span class="keyword">struct </span>timespec tp;</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;    <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> time;</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    clock_gettime(CLOCK_REALTIME, &amp;tp);</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;    time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    va_list args;</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    va_start(args, log);</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;    <span class="keywordflow">if</span> (log == NULL || vasprintf(&amp;message, log, args) &lt; 0)</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;        message = NULL;</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    fprintf(stderr,  <span class="stringliteral">&quot;[%10.3f] [%s %s] [%s:%d] &gt;&gt;&gt; %s \n&quot;</span>, time / 1000.0, prefix, <a class="code" href="../../df/d76/hmi-debug_8h.html#a13d4c7647aad2e84766f8b48a6caab09">ERROR_FLAG</a>[level], func, line, message);</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;    va_end(args);</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    free(message);</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;}</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;<span class="preprocessor">#endif  //__HMI_DEBUG_H__</span></div><div class="ttc" id="hmi-debug_8h_html_aa5a9053636a30269210c54e734e0d583a5b40f003febbc3b535649d63f4b8a44f"><div class="ttname"><a href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583a5b40f003febbc3b535649d63f4b8a44f">LOG_LEVEL_ERROR</a></div><div class="ttdef"><b>Definition:</b> <a href="../../df/d76/hmi-debug_8h_source.html#l00010">hmi-debug.h:10</a></div></div>
70 <div class="ttc" id="hmi-debug_8h_html_aa5a9053636a30269210c54e734e0d583a23ae4d711a7bbb3900240cb7316b4b4e"><div class="ttname"><a href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583a23ae4d711a7bbb3900240cb7316b4b4e">LOG_LEVEL_NOTICE</a></div><div class="ttdef"><b>Definition:</b> <a href="../../df/d76/hmi-debug_8h_source.html#l00012">hmi-debug.h:12</a></div></div>
71 <div class="ttc" id="hmi-debug_8h_html_aa5a9053636a30269210c54e734e0d583a538b2b6e011479d408ecd2be0f6d6177"><div class="ttname"><a href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583a538b2b6e011479d408ecd2be0f6d6177">LOG_LEVEL_DEBUG</a></div><div class="ttdef"><b>Definition:</b> <a href="../../df/d76/hmi-debug_8h_source.html#l00014">hmi-debug.h:14</a></div></div>
72 <div class="ttc" id="hmi-debug_8h_html_aa5a9053636a30269210c54e734e0d583aedee1e3159bfe7d918b6e29873c5aee4"><div class="ttname"><a href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583aedee1e3159bfe7d918b6e29873c5aee4">LOG_LEVEL_INFO</a></div><div class="ttdef"><b>Definition:</b> <a href="../../df/d76/hmi-debug_8h_source.html#l00013">hmi-debug.h:13</a></div></div>
73 <div class="ttc" id="hmi-debug_8h_html_a13d4c7647aad2e84766f8b48a6caab09"><div class="ttname"><a href="../../df/d76/hmi-debug_8h.html#a13d4c7647aad2e84766f8b48a6caab09">ERROR_FLAG</a></div><div class="ttdeci">static char ERROR_FLAG[6][20]</div><div class="ttdef"><b>Definition:</b> <a href="../../df/d76/hmi-debug_8h_source.html#l00024">hmi-debug.h:24</a></div></div>
74 <div class="ttc" id="hmi-debug_8h_html_aa5a9053636a30269210c54e734e0d583"><div class="ttname"><a href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583">LOG_LEVEL</a></div><div class="ttdeci">LOG_LEVEL</div><div class="ttdef"><b>Definition:</b> <a href="../../df/d76/hmi-debug_8h_source.html#l00008">hmi-debug.h:8</a></div></div>
75 <div class="ttc" id="hmi-debug_8h_html_aa5a9053636a30269210c54e734e0d583a0459003454bc8bb17752e6d8e5787444"><div class="ttname"><a href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583a0459003454bc8bb17752e6d8e5787444">LOG_LEVEL_MAX</a></div><div class="ttdef"><b>Definition:</b> <a href="../../df/d76/hmi-debug_8h_source.html#l00015">hmi-debug.h:15</a></div></div>
76 <div class="ttc" id="hmi-debug_8h_html_aa5a9053636a30269210c54e734e0d583a5b4dd81b4dc7eefbc55ba03415c627ef"><div class="ttname"><a href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583a5b4dd81b4dc7eefbc55ba03415c627ef">LOG_LEVEL_WARNING</a></div><div class="ttdef"><b>Definition:</b> <a href="../../df/d76/hmi-debug_8h_source.html#l00011">hmi-debug.h:11</a></div></div>
77 <div class="ttc" id="hmi-debug_8h_html_a0846b9d51e2e0612c4825a9a581aa40a"><div class="ttname"><a href="../../df/d76/hmi-debug_8h.html#a0846b9d51e2e0612c4825a9a581aa40a">_HMI_LOG</a></div><div class="ttdeci">static void _HMI_LOG(enum LOG_LEVEL level, const char *file, const char *func, const int line, const char *prefix, const char *log,...)</div><div class="ttdef"><b>Definition:</b> <a href="../../df/d76/hmi-debug_8h_source.html#l00026">hmi-debug.h:26</a></div></div>
78 <div class="ttc" id="hmi-debug_8h_html_aa5a9053636a30269210c54e734e0d583a69dacb1837e1e37c6ed34cc2ee1d8848"><div class="ttname"><a href="../../df/d76/hmi-debug_8h.html#aa5a9053636a30269210c54e734e0d583a69dacb1837e1e37c6ed34cc2ee1d8848">LOG_LEVEL_NONE</a></div><div class="ttdef"><b>Definition:</b> <a href="../../df/d76/hmi-debug_8h_source.html#l00009">hmi-debug.h:9</a></div></div>
79 </div><!-- fragment --></div><!-- contents -->
80 <!-- start footer part -->
81 <hr class="footer"/><address class="footer"><small>
82 Generated by &#160;<a href="http://www.doxygen.org/index.html">
83 <img class="footer" src="../../doxygen.png" alt="doxygen"/>
84 </a> 1.8.13
85 </small></address>
86 </body>
87 </html>