esp-nimble-cpp/class_nim_b_l_e_utils.html

419 lines
19 KiB
HTML
Raw Normal View History

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
2022-01-15 23:23:57 +01:00
<title>esp-nimble-cpp: NimBLEUtils Class Reference</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="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.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 id="projectrow">
<td id="projectalign">
<div id="projectname">esp-nimble-cpp<span id="projectnumber">&#160;2.0.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('class_nim_b_l_e_utils.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- 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">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="class_nim_b_l_e_utils-members.html">List of all members</a> </div>
<div class="headertitle"><div class="title">NimBLEUtils Class Reference</div></div>
</div><!--header-->
<div class="contents">
<p>A BLE Utility class with methods for debugging and general purpose use.
<a href="class_nim_b_l_e_utils.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="_nim_b_l_e_utils_8h_source.html">NimBLEUtils.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-static-methods" name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:afb2df39418324f93a2477e314883ccae" id="r_afb2df39418324f93a2477e314883ccae"><td class="memItemLeft" align="right" valign="top">static const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_utils.html#afb2df39418324f93a2477e314883ccae">gapEventToString</a> (uint8_t eventType)</td></tr>
<tr class="memdesc:afb2df39418324f93a2477e314883ccae"><td class="mdescLeft">&#160;</td><td class="mdescRight">Convert a GAP event type to a string representation. <br /></td></tr>
<tr class="separator:afb2df39418324f93a2477e314883ccae"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a53f0b19687b0706ec48d6b630e209acb" id="r_a53f0b19687b0706ec48d6b630e209acb"><td class="memItemLeft" align="right" valign="top">static std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_utils.html#a53f0b19687b0706ec48d6b630e209acb">dataToHexString</a> (const uint8_t *source, uint8_t length)</td></tr>
<tr class="memdesc:a53f0b19687b0706ec48d6b630e209acb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a hexadecimal string representation of the input data. <br /></td></tr>
<tr class="separator:a53f0b19687b0706ec48d6b630e209acb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6de9354eeba9f126aa14cfa7ed43cda4" id="r_a6de9354eeba9f126aa14cfa7ed43cda4"><td class="memItemLeft" align="right" valign="top">static const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_utils.html#a6de9354eeba9f126aa14cfa7ed43cda4">advTypeToString</a> (uint8_t advType)</td></tr>
<tr class="memdesc:a6de9354eeba9f126aa14cfa7ed43cda4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Convert the advertising type flag to a string. <br /></td></tr>
<tr class="separator:a6de9354eeba9f126aa14cfa7ed43cda4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9885eda5c51477aefc0ba9e1c96d5a34" id="r_a9885eda5c51477aefc0ba9e1c96d5a34"><td class="memItemLeft" align="right" valign="top">static const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_utils.html#a9885eda5c51477aefc0ba9e1c96d5a34">returnCodeToString</a> (int rc)</td></tr>
<tr class="memdesc:a9885eda5c51477aefc0ba9e1c96d5a34"><td class="mdescLeft">&#160;</td><td class="mdescRight">Converts a return code from the NimBLE stack to a text string. <br /></td></tr>
<tr class="separator:a9885eda5c51477aefc0ba9e1c96d5a34"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6d47cf1adecd01d0102e0feec8232538" id="r_a6d47cf1adecd01d0102e0feec8232538"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="class_nim_b_l_e_address.html">NimBLEAddress</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_utils.html#a6d47cf1adecd01d0102e0feec8232538">generateAddr</a> (bool nrpa)</td></tr>
<tr class="memdesc:a6d47cf1adecd01d0102e0feec8232538"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generate a random BLE address. <br /></td></tr>
<tr class="separator:a6d47cf1adecd01d0102e0feec8232538"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6b3a170f26ce51f353ff960f59739181" id="r_a6b3a170f26ce51f353ff960f59739181"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_utils.html#a6b3a170f26ce51f353ff960f59739181">taskWait</a> (const <a class="el" href="struct_nim_b_l_e_task_data.html">NimBLETaskData</a> &amp;taskData, uint32_t timeout)</td></tr>
<tr class="memdesc:a6b3a170f26ce51f353ff960f59739181"><td class="mdescLeft">&#160;</td><td class="mdescRight">Blocks the calling task until released or timeout. <br /></td></tr>
<tr class="separator:a6b3a170f26ce51f353ff960f59739181"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7b2de1e3827f9f6750550623dc6d9288" id="r_a7b2de1e3827f9f6750550623dc6d9288"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_utils.html#a7b2de1e3827f9f6750550623dc6d9288">taskRelease</a> (const <a class="el" href="struct_nim_b_l_e_task_data.html">NimBLETaskData</a> &amp;taskData, int rc=0)</td></tr>
<tr class="memdesc:a7b2de1e3827f9f6750550623dc6d9288"><td class="mdescLeft">&#160;</td><td class="mdescRight">Release a task. <br /></td></tr>
<tr class="separator:a7b2de1e3827f9f6750550623dc6d9288"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A BLE Utility class with methods for debugging and general purpose use. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a6de9354eeba9f126aa14cfa7ed43cda4" name="a6de9354eeba9f126aa14cfa7ed43cda4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6de9354eeba9f126aa14cfa7ed43cda4">&#9670;&#160;</a></span>advTypeToString()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const char * NimBLEUtils::advTypeToString </td>
<td>(</td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>advType</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Convert the advertising type flag to a string. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">advType</td><td>The type to convert. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A string representation of the advertising flags. </dd></dl>
</div>
</div>
<a id="a53f0b19687b0706ec48d6b630e209acb" name="a53f0b19687b0706ec48d6b630e209acb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a53f0b19687b0706ec48d6b630e209acb">&#9670;&#160;</a></span>dataToHexString()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">std::string NimBLEUtils::dataToHexString </td>
<td>(</td>
<td class="paramtype">const uint8_t *&#160;</td>
<td class="paramname"><em>source</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>length</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Create a hexadecimal string representation of the input data. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">source</td><td>The start of the binary data. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">length</td><td>The length of the data to convert. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A string representation of the data. </dd></dl>
</div>
</div>
<a id="afb2df39418324f93a2477e314883ccae" name="afb2df39418324f93a2477e314883ccae"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afb2df39418324f93a2477e314883ccae">&#9670;&#160;</a></span>gapEventToString()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const char * NimBLEUtils::gapEventToString </td>
<td>(</td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>eventType</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Convert a GAP event type to a string representation. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">eventType</td><td>The type of event. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A string representation of the event type. </dd></dl>
</div>
</div>
<a id="a6d47cf1adecd01d0102e0feec8232538" name="a6d47cf1adecd01d0102e0feec8232538"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6d47cf1adecd01d0102e0feec8232538">&#9670;&#160;</a></span>generateAddr()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="class_nim_b_l_e_address.html">NimBLEAddress</a> NimBLEUtils::generateAddr </td>
<td>(</td>
<td class="paramtype">bool&#160;</td>
<td class="paramname"><em>nrpa</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Generate a random BLE address. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">nrpa</td><td>True to generate a non-resolvable private address, false to generate a random static address </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The generated address or a NULL address if there was an error. </dd></dl>
</div>
</div>
<a id="a9885eda5c51477aefc0ba9e1c96d5a34" name="a9885eda5c51477aefc0ba9e1c96d5a34"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9885eda5c51477aefc0ba9e1c96d5a34">&#9670;&#160;</a></span>returnCodeToString()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const char * NimBLEUtils::returnCodeToString </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>rc</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Converts a return code from the NimBLE stack to a text string. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">rc</td><td>The return code to convert. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A string representation of the return code. </dd></dl>
</div>
</div>
<a id="a7b2de1e3827f9f6750550623dc6d9288" name="a7b2de1e3827f9f6750550623dc6d9288"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7b2de1e3827f9f6750550623dc6d9288">&#9670;&#160;</a></span>taskRelease()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void NimBLEUtils::taskRelease </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="struct_nim_b_l_e_task_data.html">NimBLETaskData</a> &amp;&#160;</td>
<td class="paramname"><em>taskData</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>flags</em> = <code>0</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Release a task. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">taskData</td><td>A pointer to the task data structure. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">flags</td><td>A return value to set in the task data structure. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a6b3a170f26ce51f353ff960f59739181" name="a6b3a170f26ce51f353ff960f59739181"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6b3a170f26ce51f353ff960f59739181">&#9670;&#160;</a></span>taskWait()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool NimBLEUtils::taskWait </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="struct_nim_b_l_e_task_data.html">NimBLETaskData</a> &amp;&#160;</td>
<td class="paramname"><em>taskData</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>timeout</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Blocks the calling task until released or timeout. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">taskData</td><td>A pointer to the task data structure. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">timeout</td><td>The time to wait in milliseconds. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>True if the task completed, false if the timeout was reached. </dd></dl>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="class_nim_b_l_e_utils.html">NimBLEUtils</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8 </li>
</ul>
</div>
</body>
</html>