Find a file
h2zero 6279817143 [BREAKING] Refactor NimBLEAddress - use NimBLE core representation.
This simplifies the NimBLEAddress code by directly using the NimBLE core `ble_addr_t` type to hold the address
and allows using NimBLE core functions and macros to replace code in some methods.

* `getNative()` replaced with `getBase()` and now returns a pointer to `const ble_addr_t` instead of a pointer to the address value.
* Adds `isNrpa()` method to test if an address is random non-resolvable.
* Adds `isStatic()` method to test if an address is random static.
* Adds `isPublic()` method to test if an address is a public address.
* Adds `isNull()` methods to test if an address is NULL.
* Adds `getValue()` method which returns a read-only pointer to the address value.
* Adds `reverseByteOrder()` method which will reverse the byte order of the address value.
* `equals()` method and == operator will now also test if the address types are the same.
* Code cleanup.
2024-07-17 19:38:35 -06:00
.github/workflows [NimBLEServer] Add getPeerName and get peer name on connect. 2024-06-30 16:44:49 -06:00
docs [BREAKING] Asynchronous pin injections for Numeric Comparison and PassKey Input (#165) 2024-06-06 19:36:14 -06:00
examples [BREAKING] Use an array to manage created client instances. 2024-07-10 07:05:47 -06:00
src [BREAKING] Refactor NimBLEAddress - use NimBLE core representation. 2024-07-17 19:38:35 -06:00
.gitignore Add docs build. 2022-08-27 13:02:29 -06:00
CHANGELOG.md Remove NimBLESecurity class. (#75) 2022-08-21 21:33:39 -06:00
CMakeLists.txt add h2 2024-06-18 06:30:35 -06:00
CMakeLists.txt_idf3 Remove FreeRTOS from CmakeLists. 2021-07-14 10:30:41 -06:00
component.mk Add missing component.mk file. 2020-03-29 19:13:59 -06:00
Kconfig Replace NimBLEAttValue asserts with user defineable action. 2024-07-04 18:47:28 -06:00
LICENSE Initial commit. 2020-03-29 17:44:20 -06:00
package.json Create package.json 2024-06-15 09:22:31 -06:00
README.md Update documentation. 2021-07-12 13:33:56 -06:00

Latest release Release Version Release Date

Need help? Have questions or suggestions? Join the Gitter

esp-nimble-cpp

NimBLE CPP library for use with ESP32 that attempts to maintain compatibility with the nkolban cpp_uitls BLE API.

An Arduino version of this library, including NimBLE, can be found here.

This library significantly reduces resource usage and improves performance for ESP32 BLE applications as compared
with the bluedroid based library. The goal is to maintain, as much as reasonable, compatibility with the original
library but refactored to use the NimBLE stack. In addition, this library will be more actively developed and maintained
to provide improved capabilites and stability over the original.

Testing shows a nearly 50% reduction in flash use and approx. 100kB less ram consumed vs the original!
Your results may vary

What is NimBLE?

NimBLE is a completely open source Bluetooth Low Energy stack produced by Apache.
It is more suited to resource constrained devices than bluedroid and has now been ported to the ESP32 by Espressif.

Installation

ESP-IDF v4.0+

Download as .zip and extract or clone into the components folder in your esp-idf project.

Run menuconfig, go to Component config->Bluetooth enable Bluetooth and in Bluetooth host NimBLE.
Configure settings in NimBLE Options.
#include "NimBLEDevice.h" in main.cpp.
Call NimBLEDevice::init(""); in app_main.

ESP-IDF v3.2 & v3.3

The NimBLE component does not come with these versions of IDF (now included in 3.3.2 and above).
A backport that works in these versions has been created and is available here.
Download or clone that repo into your project/components folder and run menuconfig. Configure settings in main menu -> NimBLE Options.

#include "NimBLEDevice.h" in main.cpp.
Call NimBLEDevice::init(""); in app_main.

Using

This library is intended to be compatible with the original ESP32 BLE functions and types with minor changes.

If you have not used the original Bluedroid library please refer to the New user guide.

If you are familiar with the original library, see: The migration guide for details about breaking changes and migration.

Also see Improvements_and_updates for information about non-breaking changes.

Full API documentation and class list can be found here.

Using with Arduino as an IDF component and CMake

When using this library along with Arduino and compiling with CMake you must add add_compile_definitions(ARDUINO_ARCH_ESP32=1)
in your project/CMakeLists.txt after the line include($ENV{IDF_PATH}/tools/cmake/project.cmake) to prevent Arduino from releasing BLE memory.

Acknowledgments