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>ISSDK: drivers/host/data_format_json.c File Reference</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="issdk_stylesheet.css" rel="stylesheet" type="text/css" /> 13</head> 14<body> 15<div id="top"><!-- do not remove this div, it is closed by doxygen! --> 16<div id="titlearea"> 17<table cellspacing="0" cellpadding="0"> 18 <tbody> 19 <tr style="height: 56px;"> 20 <td id="projectlogo"><img alt="Logo" src="nxp_logo_small.png"/></td> 21 <td id="projectalign" style="padding-left: 0.5em;"> 22 <div id="projectname">ISSDK 23  <span id="projectnumber">1.8</span> 24 </div> 25 <div id="projectbrief">IoT Sensing Software Development Kit</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" src="menudata.js"></script> 34<script type="text/javascript" src="menu.js"></script> 35<script type="text/javascript"> 36$(function() { 37 initMenu('',false,false,'search.php','Search'); 38}); 39</script> 40<div id="main-nav"></div> 41<div id="nav-path" class="navpath"> 42 <ul> 43<li class="navelem"><a class="el" href="dir_14bc92f4b96c8519b376567118ac28b3.html">drivers</a></li><li class="navelem"><a class="el" href="dir_32464e4af507982e116bd625f186503f.html">host</a></li> </ul> 44</div> 45</div><!-- top --> 46<div class="header"> 47 <div class="summary"> 48<a href="#typedef-members">Typedefs</a> | 49<a href="#enum-members">Enumerations</a> | 50<a href="#func-members">Functions</a> | 51<a href="#var-members">Variables</a> </div> 52 <div class="headertitle"> 53<div class="title">data_format_json.c File Reference</div> </div> 54</div><!--header--> 55<div class="contents"> 56 57<p>The <a class="el" href="a00515.html" title="The data_format_json.c file implements JSON data format interfaces and services. ">data_format_json.c</a> file implements JSON data format interfaces and services. 58<a href="#details">More...</a></p> 59<div class="textblock"><code>#include <stddef.h></code><br /> 60<code>#include <stdint.h></code><br /> 61<code>#include <string.h></code><br /> 62<code>#include <stdbool.h></code><br /> 63<code>#include "<a class="el" href="a00518_source.html">data_format_json.h</a>"</code><br /> 64</div><div class="textblock"><div class="dynheader"> 65Include dependency graph for data_format_json.c:</div> 66<div class="dyncontent"> 67<div class="center"><img src="a00516.png" border="0" usemap="#drivers_2host_2data__format__json_8c" alt=""/></div> 68<map name="drivers_2host_2data__format__json_8c" id="drivers_2host_2data__format__json_8c"> 69<area shape="rect" id="node6" href="a00518.html" title="The format_json.h file describes the structures and definitions for the data-format standard JSON..." alt="" coords="119,95,251,121"/> 70</map> 71</div> 72</div> 73<p><a href="a00515_source.html">Go to the source code of this file.</a></p> 74<table class="memberdecls"> 75<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> 76Typedefs</h2></td></tr> 77<tr class="memitem:a5d3d87cba8b8251cd733a3d2e05bbc69"><td class="memItemLeft" align="right" valign="top">typedef enum <a class="el" href="a00515.html#ab1508ba25371674f0983a7ad139a7ada">_json_packet_state_</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00515.html#a5d3d87cba8b8251cd733a3d2e05bbc69">json_packet_state_t</a></td></tr> 78<tr class="separator:a5d3d87cba8b8251cd733a3d2e05bbc69"><td class="memSeparator" colspan="2"> </td></tr> 79</table><table class="memberdecls"> 80<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a> 81Enumerations</h2></td></tr> 82<tr class="memitem:ab1508ba25371674f0983a7ad139a7ada"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="a00515.html#ab1508ba25371674f0983a7ad139a7ada">_json_packet_state_</a> { <a class="el" href="a00515.html#ab1508ba25371674f0983a7ad139a7adaac36e5c9ac597253191be83acf0b51d25">STATE_NONE</a>, 83<a class="el" href="a00515.html#ab1508ba25371674f0983a7ad139a7adaa2941d8fde4a53bd9278dfb772e56368a">STATE_START_PACKET</a>, 84<a class="el" href="a00515.html#ab1508ba25371674f0983a7ad139a7adaa2e6b4f5e66a3f2cabc44f28b8e273871">STATE_PAYLOAD</a>, 85<a class="el" href="a00515.html#ab1508ba25371674f0983a7ad139a7adaa8f86e84d0e6eda1efff87cddd51969a0">STATE_END_PACKET</a> 86 }</td></tr> 87<tr class="separator:ab1508ba25371674f0983a7ad139a7ada"><td class="memSeparator" colspan="2"> </td></tr> 88</table><table class="memberdecls"> 89<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> 90Functions</h2></td></tr> 91<tr class="memitem:a0e2d3b161cc458e4e69a2165518a9ac3"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00521.html#a5d7069350a7d7e65686c77a8038f462f">int32_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00515.html#a0e2d3b161cc458e4e69a2165518a9ac3">JSON_Serialize</a> (char *pStr, char *pDataTagStr, char *pDataValue, <a class="el" href="a00518.html#ae0038000e88bf208b3967036ea637ac8">json_format_t</a> type, bool end)</td></tr> 92<tr class="memdesc:a0e2d3b161cc458e4e69a2165518a9ac3"><td class="mdescLeft"> </td><td class="mdescRight">The function to serialize the data,. <a href="#a0e2d3b161cc458e4e69a2165518a9ac3">More...</a><br /></td></tr> 93<tr class="separator:a0e2d3b161cc458e4e69a2165518a9ac3"><td class="memSeparator" colspan="2"> </td></tr> 94<tr class="memitem:a8e245cde75a5f95724bffe0ba96ce8ef"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00521.html#a5d7069350a7d7e65686c77a8038f462f">int32_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00515.html#a8e245cde75a5f95724bffe0ba96ce8ef">JSON_Deserialize</a> (void *pInData, void *pDataTag, char *pDataValue, <a class="el" href="a00518.html#ae0038000e88bf208b3967036ea637ac8">json_format_t</a> type)</td></tr> 95<tr class="memdesc:a8e245cde75a5f95724bffe0ba96ce8ef"><td class="mdescLeft"> </td><td class="mdescRight">The function to deserialize the data,. <a href="#a8e245cde75a5f95724bffe0ba96ce8ef">More...</a><br /></td></tr> 96<tr class="separator:a8e245cde75a5f95724bffe0ba96ce8ef"><td class="memSeparator" colspan="2"> </td></tr> 97<tr class="memitem:a72cbdc06fad472bcc047c7e7761ec67c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00515.html#a72cbdc06fad472bcc047c7e7761ec67c">JSON_BlockDataRead_BlockingCall</a> (<a class="el" href="a00527.html#abaf1b61f9d5a80cabf1f3351bbd569e8">host_interface_handle_t</a> *pHandle, void *pRecvData)</td></tr> 98<tr class="memdesc:a72cbdc06fad472bcc047c7e7761ec67c"><td class="mdescLeft"> </td><td class="mdescRight">The function provides block data read for the JSON stream, This is for Blocking receive call. <a href="#a72cbdc06fad472bcc047c7e7761ec67c">More...</a><br /></td></tr> 99<tr class="separator:a72cbdc06fad472bcc047c7e7761ec67c"><td class="memSeparator" colspan="2"> </td></tr> 100<tr class="memitem:ac17175f026a8004c8faa6e5217704797"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00521.html#a5d7069350a7d7e65686c77a8038f462f">int32_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00515.html#ac17175f026a8004c8faa6e5217704797">JSON_Get_Stream_NonBlockingCall</a> (void *pRecvData, uint8_t <a class="el" href="a00428.html#a0155cf01983779a6f386fb8eac40d37c">data</a>, uint8_t *state, uint8_t *buffIndex)</td></tr> 101<tr class="memdesc:ac17175f026a8004c8faa6e5217704797"><td class="mdescLeft"> </td><td class="mdescRight">This function is a helper function to get json stream where the data length is unknown. <a href="#ac17175f026a8004c8faa6e5217704797">More...</a><br /></td></tr> 102<tr class="separator:ac17175f026a8004c8faa6e5217704797"><td class="memSeparator" colspan="2"> </td></tr> 103<tr class="memitem:a82cfef5d07d5b3c2b1f8795309ab9e67"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="a00515.html#a82cfef5d07d5b3c2b1f8795309ab9e67">JSON_Process_Rx_Byte</a> (uint8_t c, <a class="el" href="a02927.html">host_rx_packet_t</a> *pHostRxPkt)</td></tr> 104<tr class="memdesc:a82cfef5d07d5b3c2b1f8795309ab9e67"><td class="mdescLeft"> </td><td class="mdescRight">Function to handle incomming JSON encoded bytes form the Host over UART. <a href="#a82cfef5d07d5b3c2b1f8795309ab9e67">More...</a><br /></td></tr> 105<tr class="separator:a82cfef5d07d5b3c2b1f8795309ab9e67"><td class="memSeparator" colspan="2"> </td></tr> 106<tr class="memitem:abab3c54ca70a6f8384cd4aab3e475c19"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00515.html#abab3c54ca70a6f8384cd4aab3e475c19">JSON_Process_Tx_Msg</a> (const uint8_t *pBuffer, uint8_t *pMsg, size_t <a class="el" href="a00521.html#a18e09d6eabccd6dfc2d5066542020e59">size</a>)</td></tr> 107<tr class="separator:abab3c54ca70a6f8384cd4aab3e475c19"><td class="memSeparator" colspan="2"> </td></tr> 108</table><table class="memberdecls"> 109<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a> 110Variables</h2></td></tr> 111<tr class="memitem:a3f2c348b5e628fc5b008a52cb7955d1f"><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="a00515.html#a3f2c348b5e628fc5b008a52cb7955d1f">gpJsonHeader</a> = {"{\"d\":{"}</td></tr> 112<tr class="separator:a3f2c348b5e628fc5b008a52cb7955d1f"><td class="memSeparator" colspan="2"> </td></tr> 113<tr class="memitem:a0ffa857c07814f48d027f9580b545b27"><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="a00515.html#a0ffa857c07814f48d027f9580b545b27">gpJsonFooter</a> = "}}"</td></tr> 114<tr class="separator:a0ffa857c07814f48d027f9580b545b27"><td class="memSeparator" colspan="2"> </td></tr> 115</table> 116<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> 117<div class="textblock"><p>The <a class="el" href="a00515.html" title="The data_format_json.c file implements JSON data format interfaces and services. ">data_format_json.c</a> file implements JSON data format interfaces and services. </p> 118 119<p class="definition">Definition in file <a class="el" href="a00515_source.html">data_format_json.c</a>.</p> 120</div><h2 class="groupheader">Typedef Documentation</h2> 121<a id="a5d3d87cba8b8251cd733a3d2e05bbc69"></a> 122<h2 class="memtitle"><span class="permalink"><a href="#a5d3d87cba8b8251cd733a3d2e05bbc69">◆ </a></span>json_packet_state_t</h2> 123 124<div class="memitem"> 125<div class="memproto"> 126 <table class="memname"> 127 <tr> 128 <td class="memname">typedef enum <a class="el" href="a00515.html#ab1508ba25371674f0983a7ad139a7ada">_json_packet_state_</a> <a class="el" href="a00515.html#a5d3d87cba8b8251cd733a3d2e05bbc69">json_packet_state_t</a></td> 129 </tr> 130 </table> 131</div><div class="memdoc"> 132 133</div> 134</div> 135<h2 class="groupheader">Enumeration Type Documentation</h2> 136<a id="ab1508ba25371674f0983a7ad139a7ada"></a> 137<h2 class="memtitle"><span class="permalink"><a href="#ab1508ba25371674f0983a7ad139a7ada">◆ </a></span>_json_packet_state_</h2> 138 139<div class="memitem"> 140<div class="memproto"> 141 <table class="memname"> 142 <tr> 143 <td class="memname">enum <a class="el" href="a00515.html#ab1508ba25371674f0983a7ad139a7ada">_json_packet_state_</a></td> 144 </tr> 145 </table> 146</div><div class="memdoc"> 147<table class="fieldtable"> 148<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="ab1508ba25371674f0983a7ad139a7adaac36e5c9ac597253191be83acf0b51d25"></a>STATE_NONE </td><td class="fielddoc"></td></tr> 149<tr><td class="fieldname"><a id="ab1508ba25371674f0983a7ad139a7adaa2941d8fde4a53bd9278dfb772e56368a"></a>STATE_START_PACKET </td><td class="fielddoc"></td></tr> 150<tr><td class="fieldname"><a id="ab1508ba25371674f0983a7ad139a7adaa2e6b4f5e66a3f2cabc44f28b8e273871"></a>STATE_PAYLOAD </td><td class="fielddoc"></td></tr> 151<tr><td class="fieldname"><a id="ab1508ba25371674f0983a7ad139a7adaa8f86e84d0e6eda1efff87cddd51969a0"></a>STATE_END_PACKET </td><td class="fielddoc"></td></tr> 152</table> 153 154<p class="definition">Definition at line <a class="el" href="a00515_source.html#l00028">28</a> of file <a class="el" href="a00515_source.html">data_format_json.c</a>.</p> 155 156</div> 157</div> 158<h2 class="groupheader">Function Documentation</h2> 159<a id="a72cbdc06fad472bcc047c7e7761ec67c"></a> 160<h2 class="memtitle"><span class="permalink"><a href="#a72cbdc06fad472bcc047c7e7761ec67c">◆ </a></span>JSON_BlockDataRead_BlockingCall()</h2> 161 162<div class="memitem"> 163<div class="memproto"> 164 <table class="memname"> 165 <tr> 166 <td class="memname">void JSON_BlockDataRead_BlockingCall </td> 167 <td>(</td> 168 <td class="paramtype"><a class="el" href="a00527.html#abaf1b61f9d5a80cabf1f3351bbd569e8">host_interface_handle_t</a> * </td> 169 <td class="paramname"><em>pHandle</em>, </td> 170 </tr> 171 <tr> 172 <td class="paramkey"></td> 173 <td></td> 174 <td class="paramtype">void * </td> 175 <td class="paramname"><em>pRecvData</em> </td> 176 </tr> 177 <tr> 178 <td></td> 179 <td>)</td> 180 <td></td><td></td> 181 </tr> 182 </table> 183</div><div class="memdoc"> 184 185<p>The function provides block data read for the JSON stream, This is for Blocking receive call. </p> 186<p>This can be the argument to host interface</p> 187<dl class="params"><dt>Parameters</dt><dd> 188 <table class="params"> 189 <tr><td class="paramdir">[in]</td><td class="paramname">pHandle</td><td>- pointer to a formated data stream </td></tr> 190 <tr><td class="paramdir">[out]</td><td class="paramname">pRecvData</td><td>- Pointer to RecvBuffer; </td></tr> 191 </table> 192 </dd> 193</dl> 194<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl> 195<dl class="section user"><dt>Constraints:</dt><dd>None</dd></dl> 196<dl class="section user"><dt>Reentrant: Yes</dt><dd></dd></dl> 197 198<p class="definition">Definition at line <a class="el" href="a00515_source.html#l00075">75</a> of file <a class="el" href="a00515_source.html">data_format_json.c</a>.</p> 199 200<p class="reference">References <a class="el" href="a00527_source.html#l00036">_host_interface_handle_::commHandle</a>, <a class="el" href="a00428_source.html#l00174">data</a>, <a class="el" href="a00527_source.html#l00033">_host_interface_handle_::pCommInterface</a>, <a class="el" href="a00506_source.html#l00084">_comm_interface_::Receive</a>, <a class="el" href="a00515_source.html#l00030">STATE_NONE</a>, <a class="el" href="a00515_source.html#l00032">STATE_PAYLOAD</a>, and <a class="el" href="a00515_source.html#l00031">STATE_START_PACKET</a>.</p> 201 202</div> 203</div> 204<a id="a8e245cde75a5f95724bffe0ba96ce8ef"></a> 205<h2 class="memtitle"><span class="permalink"><a href="#a8e245cde75a5f95724bffe0ba96ce8ef">◆ </a></span>JSON_Deserialize()</h2> 206 207<div class="memitem"> 208<div class="memproto"> 209 <table class="memname"> 210 <tr> 211 <td class="memname"><a class="el" href="a00521.html#a5d7069350a7d7e65686c77a8038f462f">int32_t</a> JSON_Deserialize </td> 212 <td>(</td> 213 <td class="paramtype">void * </td> 214 <td class="paramname"><em>pInData</em>, </td> 215 </tr> 216 <tr> 217 <td class="paramkey"></td> 218 <td></td> 219 <td class="paramtype">void * </td> 220 <td class="paramname"><em>pDataTag</em>, </td> 221 </tr> 222 <tr> 223 <td class="paramkey"></td> 224 <td></td> 225 <td class="paramtype">char * </td> 226 <td class="paramname"><em>pDataValue</em>, </td> 227 </tr> 228 <tr> 229 <td class="paramkey"></td> 230 <td></td> 231 <td class="paramtype"><a class="el" href="a00518.html#ae0038000e88bf208b3967036ea637ac8">json_format_t</a> </td> 232 <td class="paramname"><em>type</em> </td> 233 </tr> 234 <tr> 235 <td></td> 236 <td>)</td> 237 <td></td><td></td> 238 </tr> 239 </table> 240</div><div class="memdoc"> 241 242<p>The function to deserialize the data,. </p> 243<p>it applys the deserialization in a single data element,</p> 244<dl class="params"><dt>Parameters</dt><dd> 245 <table class="params"> 246 <tr><td class="paramdir">[in]</td><td class="paramname">pStr</td><td>- pointer to a formated data stream </td></tr> 247 <tr><td class="paramdir">[out]</td><td class="paramname">pDataTagStr</td><td>- Data tag name for a data </td></tr> 248 <tr><td class="paramdir">[out]</td><td class="paramname">pDataValue</td><td>- Data value </td></tr> 249 <tr><td class="paramdir">[in]</td><td class="paramname">type</td><td>- Json data type </td></tr> 250 </table> 251 </dd> 252</dl> 253<dl class="section return"><dt>Returns</dt><dd><a class="el" href="a00518.html#a8e245cde75a5f95724bffe0ba96ce8ef" title="The function to deserialize the data,. ">JSON_Deserialize()</a> returns the status .</dd></dl> 254<dl class="section user"><dt>Constraints:</dt><dd>None</dd></dl> 255<dl class="section user"><dt>Reentrant: Yes</dt><dd></dd></dl> 256 257<p class="definition">Definition at line <a class="el" href="a00515_source.html#l00069">69</a> of file <a class="el" href="a00515_source.html">data_format_json.c</a>.</p> 258 259<p class="reference">References <a class="el" href="a00518_source.html#l00023">DATA_FORMAT_JSON_OK</a>.</p> 260 261</div> 262</div> 263<a id="ac17175f026a8004c8faa6e5217704797"></a> 264<h2 class="memtitle"><span class="permalink"><a href="#ac17175f026a8004c8faa6e5217704797">◆ </a></span>JSON_Get_Stream_NonBlockingCall()</h2> 265 266<div class="memitem"> 267<div class="memproto"> 268 <table class="memname"> 269 <tr> 270 <td class="memname"><a class="el" href="a00521.html#a5d7069350a7d7e65686c77a8038f462f">int32_t</a> JSON_Get_Stream_NonBlockingCall </td> 271 <td>(</td> 272 <td class="paramtype">void * </td> 273 <td class="paramname"><em>pRecvData</em>, </td> 274 </tr> 275 <tr> 276 <td class="paramkey"></td> 277 <td></td> 278 <td class="paramtype">uint8_t </td> 279 <td class="paramname"><em>data</em>, </td> 280 </tr> 281 <tr> 282 <td class="paramkey"></td> 283 <td></td> 284 <td class="paramtype">uint8_t * </td> 285 <td class="paramname"><em>state</em>, </td> 286 </tr> 287 <tr> 288 <td class="paramkey"></td> 289 <td></td> 290 <td class="paramtype">uint8_t * </td> 291 <td class="paramname"><em>buffIndex</em> </td> 292 </tr> 293 <tr> 294 <td></td> 295 <td>)</td> 296 <td></td><td></td> 297 </tr> 298 </table> 299</div><div class="memdoc"> 300 301<p>This function is a helper function to get json stream where the data length is unknown. </p> 302<p>Basically look for start and end packets and form a packet</p> 303<dl class="params"><dt>Parameters</dt><dd> 304 <table class="params"> 305 <tr><td class="paramdir">[out]</td><td class="paramname">pRecvData</td><td>- Pointer to RecvBuffer; </td></tr> 306 <tr><td class="paramdir">[out]</td><td class="paramname">data</td><td>- one byte of data received. [in] event - status event for send complete and receive complete </td></tr> 307 </table> 308 </dd> 309</dl> 310<dl class="section return"><dt>Returns</dt><dd>DATA_FORMAT_JSON_OK, if data read is completed. else still get more data.</dd></dl> 311<dl class="section user"><dt>Constraints:</dt><dd>None</dd></dl> 312<dl class="section user"><dt>Reentrant: Yes</dt><dd></dd></dl> 313 314<p class="definition">Definition at line <a class="el" href="a00515_source.html#l00117">117</a> of file <a class="el" href="a00515_source.html">data_format_json.c</a>.</p> 315 316<p class="reference">References <a class="el" href="a00518_source.html#l00023">DATA_FORMAT_JSON_OK</a>, <a class="el" href="a00515_source.html#l00030">STATE_NONE</a>, <a class="el" href="a00515_source.html#l00032">STATE_PAYLOAD</a>, and <a class="el" href="a00515_source.html#l00031">STATE_START_PACKET</a>.</p> 317 318</div> 319</div> 320<a id="a82cfef5d07d5b3c2b1f8795309ab9e67"></a> 321<h2 class="memtitle"><span class="permalink"><a href="#a82cfef5d07d5b3c2b1f8795309ab9e67">◆ </a></span>JSON_Process_Rx_Byte()</h2> 322 323<div class="memitem"> 324<div class="memproto"> 325 <table class="memname"> 326 <tr> 327 <td class="memname">bool JSON_Process_Rx_Byte </td> 328 <td>(</td> 329 <td class="paramtype">uint8_t </td> 330 <td class="paramname"><em>c</em>, </td> 331 </tr> 332 <tr> 333 <td class="paramkey"></td> 334 <td></td> 335 <td class="paramtype"><a class="el" href="a02927.html">host_rx_packet_t</a> * </td> 336 <td class="paramname"><em>pHostRxPkt</em> </td> 337 </tr> 338 <tr> 339 <td></td> 340 <td>)</td> 341 <td></td><td></td> 342 </tr> 343 </table> 344</div><div class="memdoc"> 345 346<p>Function to handle incomming JSON encoded bytes form the Host over UART. </p> 347<p>This function will be called on receipt of every UART Byte and will do the JSON combination to create a Host Message. </p><dl class="params"><dt>Parameters</dt><dd> 348 <table class="params"> 349 <tr><td class="paramdir">[in]</td><td class="paramname">uint8_t</td><td>c The character in the UART payload. </td></tr> 350 <tr><td class="paramdir">[in]</td><td class="paramname"><a class="el" href="a02927.html" title="This structure holds information to receive a packet of data to the host. ">host_rx_packet_t</a></td><td>*pHostRxPkt The Host Packet context structure. </td></tr> 351 </table> 352 </dd> 353</dl> 354<dl class="section return"><dt>Returns</dt><dd>bool Success/Failure. </dd></dl> 355<dl class="section user"><dt>Constraints:</dt><dd>This should be the called only after DEBUG/UART has been initialized. No </dd></dl> 356 357<p class="definition">Definition at line <a class="el" href="a00515_source.html#l00158">158</a> of file <a class="el" href="a00515_source.html">data_format_json.c</a>.</p> 358 359<p class="reference">Referenced by <a class="el" href="a00098_source.html#l00207">Host_IO_Receive()</a>.</p> 360<div class="dynheader"> 361Here is the caller graph for this function:</div> 362<div class="dyncontent"> 363<div class="center"><img src="a00515_a82cfef5d07d5b3c2b1f8795309ab9e67_icgraph.png" border="0" usemap="#a00515_a82cfef5d07d5b3c2b1f8795309ab9e67_icgraph" alt=""/></div> 364<map name="a00515_a82cfef5d07d5b3c2b1f8795309ab9e67_icgraph" id="a00515_a82cfef5d07d5b3c2b1f8795309ab9e67_icgraph"> 365<area shape="rect" id="node2" href="a00101.html#a3924d21a0703878695ebdb68f720fff9" title="Host_IO_Receive" alt="" coords="221,5,343,32"/> 366</map> 367</div> 368 369</div> 370</div> 371<a id="abab3c54ca70a6f8384cd4aab3e475c19"></a> 372<h2 class="memtitle"><span class="permalink"><a href="#abab3c54ca70a6f8384cd4aab3e475c19">◆ </a></span>JSON_Process_Tx_Msg()</h2> 373 374<div class="memitem"> 375<div class="memproto"> 376 <table class="memname"> 377 <tr> 378 <td class="memname">size_t JSON_Process_Tx_Msg </td> 379 <td>(</td> 380 <td class="paramtype">const uint8_t * </td> 381 <td class="paramname"><em>pBuffer</em>, </td> 382 </tr> 383 <tr> 384 <td class="paramkey"></td> 385 <td></td> 386 <td class="paramtype">uint8_t * </td> 387 <td class="paramname"><em>pMsg</em>, </td> 388 </tr> 389 <tr> 390 <td class="paramkey"></td> 391 <td></td> 392 <td class="paramtype">size_t </td> 393 <td class="paramname"><em>size</em> </td> 394 </tr> 395 <tr> 396 <td></td> 397 <td>)</td> 398 <td></td><td></td> 399 </tr> 400 </table> 401</div><div class="memdoc"> 402 403<p class="definition">Definition at line <a class="el" href="a00515_source.html#l00164">164</a> of file <a class="el" href="a00515_source.html">data_format_json.c</a>.</p> 404 405<p class="reference">Referenced by <a class="el" href="a00098_source.html#l00136">Host_IO_Send()</a>.</p> 406<div class="dynheader"> 407Here is the caller graph for this function:</div> 408<div class="dyncontent"> 409<div class="center"><img src="a00515_abab3c54ca70a6f8384cd4aab3e475c19_icgraph.png" border="0" usemap="#a00515_abab3c54ca70a6f8384cd4aab3e475c19_icgraph" alt=""/></div> 410<map name="a00515_abab3c54ca70a6f8384cd4aab3e475c19_icgraph" id="a00515_abab3c54ca70a6f8384cd4aab3e475c19_icgraph"> 411<area shape="rect" id="node2" href="a00101.html#a719ad6da4502e713f1573b5353af9617" title="Host_IO_Send" alt="" coords="217,5,324,32"/> 412</map> 413</div> 414 415</div> 416</div> 417<a id="a0e2d3b161cc458e4e69a2165518a9ac3"></a> 418<h2 class="memtitle"><span class="permalink"><a href="#a0e2d3b161cc458e4e69a2165518a9ac3">◆ </a></span>JSON_Serialize()</h2> 419 420<div class="memitem"> 421<div class="memproto"> 422 <table class="memname"> 423 <tr> 424 <td class="memname"><a class="el" href="a00521.html#a5d7069350a7d7e65686c77a8038f462f">int32_t</a> JSON_Serialize </td> 425 <td>(</td> 426 <td class="paramtype">char * </td> 427 <td class="paramname"><em>pStr</em>, </td> 428 </tr> 429 <tr> 430 <td class="paramkey"></td> 431 <td></td> 432 <td class="paramtype">char * </td> 433 <td class="paramname"><em>pDataTagStr</em>, </td> 434 </tr> 435 <tr> 436 <td class="paramkey"></td> 437 <td></td> 438 <td class="paramtype">char * </td> 439 <td class="paramname"><em>pDataValue</em>, </td> 440 </tr> 441 <tr> 442 <td class="paramkey"></td> 443 <td></td> 444 <td class="paramtype"><a class="el" href="a00518.html#ae0038000e88bf208b3967036ea637ac8">json_format_t</a> </td> 445 <td class="paramname"><em>type</em>, </td> 446 </tr> 447 <tr> 448 <td class="paramkey"></td> 449 <td></td> 450 <td class="paramtype">bool </td> 451 <td class="paramname"><em>end</em> </td> 452 </tr> 453 <tr> 454 <td></td> 455 <td>)</td> 456 <td></td><td></td> 457 </tr> 458 </table> 459</div><div class="memdoc"> 460 461<p>The function to serialize the data,. </p> 462<p>it applys the serialization in single data element, Once user finishes the data stream with different data tag, set end flag to TRUE.</p> 463<dl class="params"><dt>Parameters</dt><dd> 464 <table class="params"> 465 <tr><td class="paramdir">[in]</td><td class="paramname">pStr</td><td>- pointer to the data stream - formated data put into this buffer </td></tr> 466 <tr><td class="paramdir">[in]</td><td class="paramname">pDataTagStr</td><td>- Data tag name for a data </td></tr> 467 <tr><td class="paramdir">[in]</td><td class="paramname">pDataValue</td><td>- Data value </td></tr> 468 <tr><td class="paramdir">[in]</td><td class="paramname">type</td><td>- Json data type </td></tr> 469 <tr><td class="paramdir">[in]</td><td class="paramname">end</td><td>- flag determine the end of data stream serialization. </td></tr> 470 </table> 471 </dd> 472</dl> 473<dl class="section return"><dt>Returns</dt><dd><a class="el" href="a00518.html#a0e2d3b161cc458e4e69a2165518a9ac3" title="The function to serialize the data,. ">JSON_Serialize()</a> returns the status .</dd></dl> 474<dl class="section user"><dt>Constraints:</dt><dd>None</dd></dl> 475<dl class="section user"><dt>Reentrant: Yes</dt><dd></dd></dl> 476 477<p class="definition">Definition at line <a class="el" href="a00515_source.html#l00038">38</a> of file <a class="el" href="a00515_source.html">data_format_json.c</a>.</p> 478 479<p class="reference">References <a class="el" href="a00518_source.html#l00023">DATA_FORMAT_JSON_OK</a>, <a class="el" href="a00515_source.html#l00021">gpJsonFooter</a>, <a class="el" href="a00515_source.html#l00020">gpJsonHeader</a>, and <a class="el" href="a00518_source.html#l00030">JSON_TYPE_OBJECT</a>.</p> 480 481</div> 482</div> 483<h2 class="groupheader">Variable Documentation</h2> 484<a id="a0ffa857c07814f48d027f9580b545b27"></a> 485<h2 class="memtitle"><span class="permalink"><a href="#a0ffa857c07814f48d027f9580b545b27">◆ </a></span>gpJsonFooter</h2> 486 487<div class="memitem"> 488<div class="memproto"> 489 <table class="memname"> 490 <tr> 491 <td class="memname">const char* gpJsonFooter = "}}"</td> 492 </tr> 493 </table> 494</div><div class="memdoc"> 495 496<p class="definition">Definition at line <a class="el" href="a00515_source.html#l00021">21</a> of file <a class="el" href="a00515_source.html">data_format_json.c</a>.</p> 497 498<p class="reference">Referenced by <a class="el" href="a00515_source.html#l00038">JSON_Serialize()</a>.</p> 499 500</div> 501</div> 502<a id="a3f2c348b5e628fc5b008a52cb7955d1f"></a> 503<h2 class="memtitle"><span class="permalink"><a href="#a3f2c348b5e628fc5b008a52cb7955d1f">◆ </a></span>gpJsonHeader</h2> 504 505<div class="memitem"> 506<div class="memproto"> 507 <table class="memname"> 508 <tr> 509 <td class="memname">const char* gpJsonHeader = {"{\"d\":{"}</td> 510 </tr> 511 </table> 512</div><div class="memdoc"> 513 514<p class="definition">Definition at line <a class="el" href="a00515_source.html#l00020">20</a> of file <a class="el" href="a00515_source.html">data_format_json.c</a>.</p> 515 516<p class="reference">Referenced by <a class="el" href="a00515_source.html#l00038">JSON_Serialize()</a>.</p> 517 518</div> 519</div> 520</div><!-- contents --> 521 522<hr class="footer"/><address class="footer"><small> 523© Copyright 2016-2022 NXP. All Rights Reserved. SPDX-License-Identifier: BSD-3-Clause 524</small></address> 525</body> 526</html> 527