Skip to content

Commit a6ed193

Browse files
committed
Release 2.0.0
1 parent 675d6bb commit a6ed193

File tree

8 files changed

+60
-56
lines changed

8 files changed

+60
-56
lines changed

.github/workflows/sponsors.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Generate Sponsors README
2+
on:
3+
workflow_dispatch:
4+
permissions:
5+
contents: write
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout 🛎️
11+
uses: actions/checkout@v4
12+
13+
- name: Generate Sponsors 💖
14+
uses: JamesIves/github-sponsors-readme-action@v1.5.4
15+
with:
16+
token: ${{ secrets.PAT }}
17+
file: 'README.md'

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Changelog
2-
32
All notable changes to this project will be documented in this file.
4-
## [Unreleased]
3+
4+
## [2.0.0] 2024-12-14
55

66
## **Breaking changes**
77
- All connection oriented callbacks now receive a reference to `NimBLEConnInfo`, the `ble_gap_conn_desc` has also been replace with `NimBLEConnInfo` in the functions that received it.

README.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
[Latest release ![Release Version](https://img.shields.io/github/release/h2zero/esp-nimble-cpp.svg?style=plastic)
1+
[![Release Version](https://img.shields.io/github/release/h2zero/esp-nimble-cpp.svg?style=plastic)
22
![Release Date](https://img.shields.io/github/release-date/h2zero/esp-nimble-cpp.svg?style=plastic)](https://github.com/h2zero/esp-nimble-cpp/releases/latest/)
33

4-
Need help? Have questions or suggestions? Join the [![Gitter](https://badges.gitter.im/NimBLE-Arduino/community.svg)](https://gitter.im/NimBLE-Arduino/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
5-
<br/>
4+
> [!IMPORTANT]
5+
> Version 2 is now released!
6+
> Check out the [1.x to 2.x Migration Guide](docs/1.x_to2.x_migration_guide.md) and [Release Notes](https://github.com/h2zero/esp-nimble-cpp/releases/latest/)
67
78
# esp-nimble-cpp
89

9-
NimBLE CPP library for use with ESP32 that attempts to maintain compatibility with the [nkolban cpp_uitls BLE API](https://github.com/nkolban/esp32-snippets/tree/master/cpp_utils).
10+
NimBLE CPP library for use with ESP32 that attempts to maintain compatibility with the [nkolban cpp_utils BLE API](https://github.com/nkolban/esp32-snippets/tree/master/cpp_utils).
1011

1112
**An Arduino version of this library, including NimBLE, can be [found here.](https://github.com/h2zero/NimBLE-Arduino)**
1213

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

1819
**Testing shows a nearly 50% reduction in flash use and approx. 100kB less ram consumed vs the original!**
1920
*Your results may vary*
@@ -35,16 +36,6 @@ Configure settings in `NimBLE Options`.
3536
Call `NimBLEDevice::init("");` in `app_main`.
3637
<br/>
3738

38-
### ESP-IDF v3.2 & v3.3
39-
The NimBLE component does not come with these versions of IDF (now included in 3.3.2 and above).
40-
A backport that works in these versions has been created and is [available here](https://github.com/h2zero/esp-nimble-component).
41-
Download or clone that repo into your project/components folder and run menuconfig.
42-
Configure settings in `main menu -> NimBLE Options`.
43-
44-
`#include "NimBLEDevice.h"` in main.cpp.
45-
Call `NimBLEDevice::init("");` in `app_main`.
46-
<br/>
47-
4839
# Using
4940
This library is intended to be compatible with the original ESP32 BLE functions and types with minor changes.
5041

@@ -62,6 +53,14 @@ When using this library along with Arduino and compiling with *CMake* you must a
6253
in your project/CMakeLists.txt after the line `include($ENV{IDF_PATH}/tools/cmake/project.cmake)` to prevent Arduino from releasing BLE memory.
6354
<br>
6455

56+
# Sponsors
57+
Thank you to all the sponsors who support this project!
58+
59+
<!-- sponsors --><!-- sponsors -->
60+
61+
If you use this library for a commercial product please consider [sponsoring the development](https://github.com/sponsors/h2zero) to ensure the continued updates and maintenance.
62+
<br/>
63+
6564
# Acknowledgments
6665
* [nkolban](https://github.com/nkolban) and [chegewara](https://github.com/chegewara) for the [original esp32 BLE library](https://github.com/nkolban/esp32-snippets/tree/master/cpp_utils) this project was derived from.
6766
* [beegee-tokyo](https://github.com/beegee-tokyo) for contributing your time to test/debug and contributing the beacon examples.

docs/index.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Overview
2-
32
This is a C++ BLE library for the ESP32 that uses the NimBLE host stack instead of bluedroid.
43
The aim is to maintain, as much as reasonable, the original bluedroid C++ & Arduino BLE API by while adding new features
54
and making improvements in performance, resource use, and stability.
@@ -23,16 +22,6 @@ Configure settings in `NimBLE Options`.
2322
Call `NimBLEDevice::init` in `app_main`.
2423
<br/>
2524

26-
### v3.2 & v3.3
27-
The NimBLE component does not come with these versions of IDF (now included in 3.3.2 and above).
28-
A backport that works in these versions has been created and is [available here](https://github.com/h2zero/esp-nimble-component).
29-
Download or clone that repo into your project/components folder and run menuconfig.
30-
Configure settings in `main menu -> NimBLE Options`.
31-
32-
`#include "NimBLEDevice.h"` in main.cpp.
33-
Call `NimBLEDevice::init` in `app_main`.
34-
<br/>
35-
3625
# Using
3726
This library is intended to be compatible with the original ESP32 BLE functions and types with minor changes.
3827

@@ -43,12 +32,13 @@ If you are familiar with the original library, see: [The migration guide](Migrat
4332
For more advanced usage see [Usage tips](Usage_tips.md) for more performance and optimization.
4433
<br/>
4534

46-
# Need help? Have a question or suggestion?
47-
Come chat on [gitter](https://gitter.im/NimBLE-Arduino/community?utm_source=share-link&utm_medium=link&utm_campaign=share-link) or open an issue at [NimBLE-Arduino](https://github.com/h2zero/NimBLE-Arduino/issues) or [esp-nimble-cpp](https://github.com/h2zero/esp-nimble-cpp/issues)
35+
# Sponsors
36+
Thank you to all the sponsors who support this project!
37+
38+
If you use this library for a commercial product please consider [sponsoring the development](https://github.com/sponsors/h2zero) to ensure the continued updates and maintenance.
4839
<br/>
4940

5041
# Acknowledgments
51-
5242
* [nkolban](https://github.com/nkolban) and [chegewara](https://github.com/chegewara) for the [original esp32 BLE library](https://github.com/nkolban/esp32-snippets/tree/master/cpp_utils) this project was derived from.
5343
* [beegee-tokyo](https://github.com/beegee-tokyo) for contributing your time to test/debug and contributing the beacon examples.
5444
* [Jeroen88](https://github.com/Jeroen88) for the amazing help debugging and improving the client code.

examples/Bluetooth_5/NimBLE_extended_client/main/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#define CHARACTERISTIC_UUID "1234"
1515

1616
static const NimBLEAdvertisedDevice* advDevice;
17-
static bool doConnect = false;
18-
static uint32_t scanTime = 10 * 1000; // In milliseconds, 0 = scan forever
17+
static bool doConnect = false;
18+
static uint32_t scanTimeMs = 10 * 1000; // In milliseconds, 0 = scan forever
1919

2020
/** Define the PHY's to use when connecting to peer devices, can be 1, 2, or all 3 (default).*/
2121
static uint8_t connectPhys = BLE_GAP_LE_PHY_CODED_MASK | BLE_GAP_LE_PHY_1M_MASK /*| BLE_GAP_LE_PHY_2M_MASK */;
@@ -26,7 +26,7 @@ class ClientCallbacks : public NimBLEClientCallbacks {
2626

2727
void onDisconnect(NimBLEClient* pClient, int reason) override {
2828
printf("%s Disconnected, reason = %d - Starting scan\n", pClient->getPeerAddress().toString().c_str(), reason);
29-
NimBLEDevice::getScan()->start(scanTime);
29+
NimBLEDevice::getScan()->start(scanTimeMs);
3030
}
3131
} clientCallbacks;
3232

@@ -123,7 +123,7 @@ extern "C" void app_main(void) {
123123
* Start scanning for advertisers for the scan time specified (in milliseconds) 0 = forever
124124
* Optional callback for when scanning stops.
125125
*/
126-
pScan->start(scanTime);
126+
pScan->start(scanTimeMs);
127127

128128
printf("Scanning for peripherals\n");
129129

@@ -137,7 +137,7 @@ extern "C" void app_main(void) {
137137
}
138138

139139
doConnect = false;
140-
NimBLEDevice::getScan()->start(scanTime);
140+
NimBLEDevice::getScan()->start(scanTimeMs);
141141
}
142142
vTaskDelay(pdMS_TO_TICKS(10));
143143
}

examples/Bluetooth_5/NimBLE_extended_scan/main/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
#include <NimBLEDevice.h>
1111

12-
static uint32_t scanTime = 10 * 1000; // In milliseconds, 0 = scan forever
13-
static NimBLEScan::Phy scanPhy = NimBLEScan::Phy::SCAN_ALL;
12+
static uint32_t scanTimeMs = 10 * 1000; // In milliseconds, 0 = scan forever
13+
static NimBLEScan::Phy scanPhy = NimBLEScan::Phy::SCAN_ALL;
1414

1515
/** Define a class to handle the callbacks when advertisements are received */
1616
class ScanCallbacks : public NimBLEScanCallbacks {
@@ -43,7 +43,7 @@ class ScanCallbacks : public NimBLEScanCallbacks {
4343

4444
NimBLEScan* pScan = NimBLEDevice::getScan();
4545
pScan->setPhy(scanPhy);
46-
pScan->start(scanTime);
46+
pScan->start(scanTimeMs);
4747
}
4848
} scanCallbacks;
4949

@@ -63,7 +63,7 @@ extern "C" void app_main(void) {
6363
/** Set the initial PHY's to scan on, default is SCAN_ALL */
6464
pScan->setPhy(scanPhy);
6565

66-
/** Start scanning for scanTime */
67-
pScan->start(scanTime);
66+
/** Start scanning for scanTimeMs */
67+
pScan->start(scanTimeMs);
6868
printf("Scanning for peripherals\n");
6969
}

examples/NimBLE_Client/main/main.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
#include <NimBLEDevice.h>
1111

1212
static const NimBLEAdvertisedDevice* advDevice;
13-
static bool doConnect = false;
14-
static uint32_t scanTime = 5000; /** scan time in milliseconds, 0 = scan forever */
13+
static bool doConnect = false;
14+
static uint32_t scanTimeMs = 5000; /** scan time in milliseconds, 0 = scan forever */
1515

1616
/** None of these are required as they will be handled by the library with defaults. **
1717
** Remove as you see fit for your needs */
@@ -20,7 +20,7 @@ class ClientCallbacks : public NimBLEClientCallbacks {
2020

2121
void onDisconnect(NimBLEClient* pClient, int reason) override {
2222
printf("%s Disconnected, reason = %d - Starting scan\n", pClient->getPeerAddress().toString().c_str(), reason);
23-
NimBLEDevice::getScan()->start(scanTime, false, true);
23+
NimBLEDevice::getScan()->start(scanTimeMs, false, true);
2424
}
2525

2626
/********************* Security handled here *********************/
@@ -48,10 +48,10 @@ class ClientCallbacks : public NimBLEClientCallbacks {
4848
return;
4949
}
5050
}
51-
} clientCB;
51+
} clientCallbacks;
5252

5353
/** Define a class to handle the callbacks when scan events are received */
54-
class scanCallbacks : public NimBLEScanCallbacks {
54+
class ScanCallbacks : public NimBLEScanCallbacks {
5555
void onResult(const NimBLEAdvertisedDevice* advertisedDevice) override {
5656
printf("Advertised Device found: %s\n", advertisedDevice->toString().c_str());
5757
if (advertisedDevice->isAdvertisingService(NimBLEUUID("DEAD"))) {
@@ -68,9 +68,9 @@ class scanCallbacks : public NimBLEScanCallbacks {
6868
/** Callback to process the results of the completed scan or restart it */
6969
void onScanEnd(const NimBLEScanResults& results, int reason) override {
7070
printf("Scan Ended, reason: %d, device count: %d; Restarting scan\n", reason, results.getCount());
71-
NimBLEDevice::getScan()->start(scanTime, false, true);
71+
NimBLEDevice::getScan()->start(scanTimeMs, false, true);
7272
}
73-
} scanCB;
73+
} scanCallbacks;
7474

7575
/** Notification / Indication receiving handler callback */
7676
void notifyCB(NimBLERemoteCharacteristic* pRemoteCharacteristic, uint8_t* pData, size_t length, bool isNotify) {
@@ -121,7 +121,7 @@ bool connectToServer() {
121121

122122
printf("New client created\n");
123123

124-
pClient->setClientCallbacks(&clientCB, false);
124+
pClient->setClientCallbacks(&clientCallbacks, false);
125125
/**
126126
* Set initial connection parameters:
127127
* These settings are safe for 3 clients to connect reliably, can go faster if you have less
@@ -241,8 +241,7 @@ bool connectToServer() {
241241
return true;
242242
}
243243

244-
extern "C"
245-
void app_main(void) {
244+
extern "C" void app_main(void) {
246245
printf("Starting NimBLE Client\n");
247246
/** Initialize NimBLE and set the device name */
248247
NimBLEDevice::init("NimBLE-Client");
@@ -270,7 +269,7 @@ void app_main(void) {
270269
NimBLEScan* pScan = NimBLEDevice::getScan();
271270

272271
/** Set the callbacks to call when scan events occur, no duplicates */
273-
pScan->setScanCallbacks(&scanCB, false);
272+
pScan->setScanCallbacks(&scanCallbacks, false);
274273

275274
/** Set scan interval (how often) and window (how long) in milliseconds */
276275
pScan->setInterval(100);
@@ -283,7 +282,7 @@ void app_main(void) {
283282
pScan->setActiveScan(true);
284283

285284
/** Start scanning for advertisers */
286-
pScan->start(scanTime);
285+
pScan->start(scanTimeMs);
287286
printf("Scanning for peripherals\n");
288287

289288
/** Loop here until we find a device we want to connect to */
@@ -299,7 +298,7 @@ void app_main(void) {
299298
printf("Failed to connect, starting scan\n");
300299
}
301300

302-
NimBLEDevice::getScan()->start(scanTime, false, true);
301+
NimBLEDevice::getScan()->start(scanTimeMs, false, true);
303302
}
304303
}
305304
}

library.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"keywords": [
66
"BLE",
77
"espidf",
8-
"arduino",
98
"espressif",
109
"esp32",
1110
"nimble"

0 commit comments

Comments
 (0)