summaryrefslogtreecommitdiffstats
path: root/doc/api-ref/html/df/d76/hmi-debug_8h_source.html
blob: 80b0c61de8d2a49a11da0e50e006438dd63f6bee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>HomeScreenBinding: include/hmi-debug.h Source File</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">HomeScreenBinding
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('../../',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="../../dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">hmi-debug.h</div>  </div>
</div><!--header-->
<div class="contents">
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>