esp-nimble-cpp/index.html
2022-01-15 15:23:57 -07:00

192 lines
9.8 KiB
HTML

<!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">
<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.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>esp-nimble-cpp: Overview</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 style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">esp-nimble-cpp
&#160;<span id="projectnumber">1.3.2</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'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:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(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:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('index.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">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="PageDoc"><div class="header">
<div class="headertitle">
<div class="title">Overview </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p><a class="anchor" id="md_index"></a> This is a C++ BLE library for the ESP32 that uses the NimBLE host stack instead of bluedroid. <br />
The aim is to maintain, as much as reasonable, the original bluedroid C++ &amp; Arduino BLE API by while adding new features <br />
and making improvements in performance, resource use, and stability. <br />
</p>
<p><b>Testing shows a nearly 50% reduction in flash use and approx. 100kB less ram consumed vs the original!</b> <br />
<em>Your results may vary</em> <br />
<br />
</p>
<h1><a class="anchor" id="autotoc_md33"></a>
What is NimBLE?</h1>
<p>NimBLE is a completely open source Bluetooth Low Energy stack produced by <a href="https://github.com/apache/mynewt-nimble">Apache</a>. <br />
It is more suited to resource constrained devices than bluedroid and has now been ported to the ESP32 by Espressif. <br />
<br />
</p>
<h1><a class="anchor" id="autotoc_md34"></a>
Arduino Installation</h1>
<p><b>Arduino Library manager:</b> Go to <code>sketch</code> -&gt; <code>Include Library</code> -&gt; <code>Manage Libraries</code> and search for NimBLE and install. <br />
</p>
<p><b>Alternatively:</b> Download as .zip and extract to Arduino/libraries folder, or in Arduino IDE from Sketch menu -&gt; Include library -&gt; Add .Zip library. <br />
</p>
<p><code>#include "NimBLEDevice.h"</code> at the beginning of your sketch. <br />
</p>
<p>Call <code><a class="el" href="class_nim_b_l_e_device.html#a674d2e68d4ba0e3f84d7993f9da7d15b" title="Initialize the BLE environment.">NimBLEDevice::init</a></code> in <code>setup</code>.</p>
<p>Tested and working with esp32-arduino in Arduino IDE and platform IO. <br />
<br />
<br />
</p>
<h1><a class="anchor" id="autotoc_md35"></a>
ESP-IDF Installation</h1>
<h3><a class="anchor" id="autotoc_md36"></a>
v4.0+</h3>
<p>Download as .zip and extract or clone into the components folder in your esp-idf project.</p>
<p>Run menuconfig, go to <code>Component config-&gt;Bluetooth</code> enable Bluetooth and in <code>Bluetooth host</code> NimBLE. <br />
Configure settings in <code>NimBLE Options</code>. <br />
<code>#include "NimBLEDevice.h"</code> in main.cpp. <br />
Call <code><a class="el" href="class_nim_b_l_e_device.html#a674d2e68d4ba0e3f84d7993f9da7d15b" title="Initialize the BLE environment.">NimBLEDevice::init</a></code> in <code>app_main</code>. <br />
<br />
</p>
<h3><a class="anchor" id="autotoc_md37"></a>
v3.2 &amp; v3.3</h3>
<p>The NimBLE component does not come with these versions of IDF (now included in 3.3.2 and above). <br />
A backport that works in these versions has been created and is <a href="https://github.com/h2zero/esp-nimble-component">available here</a>. <br />
Download or clone that repo into your project/components folder and run menuconfig. Configure settings in <code>main menu -&gt; NimBLE Options</code>. <br />
</p>
<p><code>#include "NimBLEDevice.h"</code> in main.cpp. <br />
Call <code><a class="el" href="class_nim_b_l_e_device.html#a674d2e68d4ba0e3f84d7993f9da7d15b" title="Initialize the BLE environment.">NimBLEDevice::init</a></code> in <code>app_main</code>. <br />
<br />
<br />
</p>
<h1><a class="anchor" id="autotoc_md38"></a>
Using</h1>
<p>This library is intended to be compatible with the original ESP32 BLE functions and types with minor changes. <br />
</p>
<p>If you have not used the original Bluedroid library please refer to the <a class="el" href="md__new_user_guide.html">New user guide</a>.</p>
<p>If you are familiar with the original library, see: <a class="el" href="md__migration_guide.html">The migration guide</a> for details. <br />
</p>
<p>Also see <a class="el" href="md__improvements_and_updates.html">Improvements and updates</a> for information about non-breaking changes. <br />
</p>
<p>For more advanced usage see <a class="el" href="md__usage_tips.html">Usage tips</a> for more performance and optimization. <br />
<br />
</p>
<h3><a class="anchor" id="autotoc_md39"></a>
Arduino specific</h3>
<p>See the Refactored_original_examples in the examples folder for highlights of the differences with the original library. <br />
</p>
<p>More advanced examples highlighting many available features are in examples/NimBLE_Server, NimBLE_Client. <br />
</p>
<p>Beacon examples provided by <a href="https://github.com/beegee-tokyo">beegee-tokyo</a> are in examples/BLE_Beacon_Scanner, BLE_EddystoneTLM_Beacon, BLE_EddystoneURL_Beacon. <br />
</p>
<p>Change the settings in the <a class="el" href="nimconfig_8h.html">nimconfig.h</a> file to customize NimBLE to your project, such as increasing max connections (default is 3). <br />
<br />
</p>
<h3><a class="anchor" id="autotoc_md40"></a>
Arduino command line and platformio</h3>
<p>As an alternative to changing the configuration in <a class="el" href="nimconfig_8h.html">nimconfig.h</a>, Arduino command line and platformio.ini options are available. <br />
See the command line configuration options available in <a class="el" href="md__command_line_config.html">Command line config</a>. <br />
<br />
<br />
</p>
<h1><a class="anchor" id="autotoc_md41"></a>
Need help? Have a question or suggestion?</h1>
<p>Come chat on <a href="https://gitter.im/NimBLE-Arduino/community?utm_source=share-link&amp;utm_medium=link&amp;utm_campaign=share-link">gitter</a> or open an issue at <a href="https://github.com/h2zero/NimBLE-Arduino/issues">NimBLE-Arduino</a> or <a href="https://github.com/h2zero/esp-nimble-cpp/issues">esp-nimble-cpp</a> <br />
<br />
</p>
<h1><a class="anchor" id="autotoc_md42"></a>
Acknowledgments</h1>
<ul>
<li><a href="https://github.com/nkolban">nkolban</a> and <a href="https://github.com/chegewara">chegewara</a> for the <a href="https://github.com/nkolban/esp32-snippets/tree/master/cpp_utils">original esp32 BLE library</a> this project was derived from.</li>
<li><a href="https://github.com/beegee-tokyo">beegee-tokyo</a> for contributing your time to test/debug and contributing the beacon examples.</li>
<li><a href="https://github.com/Jeroen88">Jeroen88</a> for the amazing help debugging and improving the client code. <br />
<br />
</li>
</ul>
</div></div><!-- PageDoc -->
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<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.1 </li>
</ul>
</div>
</body>
</html>