Skip to content

Commit 267d8a6

Browse files
committed
Release 2.1.0
Skipping 2.0.0 as it was accidently published in the Arduino library manager already.
1 parent 728c2df commit 267d8a6

File tree

9 files changed

+67
-38
lines changed

9 files changed

+67
-38
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
build_docs:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
1313
- name: Doxygen Action
1414
uses: mattnotmitt/doxygen-action@v1.9.8
1515
with:

.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: 3 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.1.0] 2024-12-14
55

66
## **Breaking changes**
77
- NimBLESecurity class removed.
@@ -57,6 +57,7 @@ All notable changes to this project will be documented in this file.
5757
- `NimBLEAdvertisedDevice::hasRSSI` removed as redundant, RSSI is always available.
5858
- `NimBLEAdvertisedDevice::getPayload` now returns `const std::vector<uint8_t>` instead of a pointer to internal memory.
5959
- `NimBLEAdvertisedDevice` Timestamp removed, if needed then the app should track the time from the callback.
60+
- `NimBLEAddress` constructor; default value for the `type` parameter removed, caller should know the address type and specify it.
6061
- `NimBLEAddress::getNative` replaced with `NimBLEAddress::getBase` and now returns a pointer to `const ble_addr_t` instead of a pointer to the address value.
6162
- `NimBLEAddress::equals` method and `NimBLEAddress::== operator` will now also test if the address types are the same.
6263
- `NimBLEUUID::getNative` method replaced with `NimBLEUUID::getBase` which returns a read-only pointer to the underlying `ble_uuid_t` struct.

README.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
[Latest release ![Release Version](https://img.shields.io/github/release/h2zero/NimBLE-Arduino.svg?style=plastic)
1+
[![Release Version](https://img.shields.io/github/release/h2zero/NimBLE-Arduino.svg?style=plastic)
22
![Release Date](https://img.shields.io/github/release-date/h2zero/NimBLE-Arduino.svg?style=plastic)](https://github.com/h2zero/NimBLE-Arduino/releases/latest/)
3-
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)
53
<br/>
64

75
# NimBLE-Arduino
86
A fork of the NimBLE stack refactored for compilation in the Arduino IDE.
97

10-
**As of release 1.4.0 Nordic Semiconductor nRF51 and nRF52 series devices are now supported**
8+
> [!IMPORTANT]
9+
> Version 2 is now released!
10+
> 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/NimBLE-Arduino/releases/latest)
1111
1212
## Supported MCU's
1313
- Espressif: ESP32, ESP32C3, ESP32S3
1414
- Nordic: nRF51, nRF52 series (**Requires** using [n-able arduino core](https://github.com/h2zero/n-able-Arduino))
1515

1616
**Note for ESP-IDF users: This repo will not compile correctly in ESP-IDF. An ESP-IDF component version of this library can be [found here.](https://github.com/h2zero/esp-nimble-cpp)**
1717

18-
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 capabilities and stability over the original.
18+
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 but using the NimBLE stack. In addition, this library will be more actively developed and maintained to provide improved capabilities and stability over the original.
1919
<br/>
2020

2121
For Nordic devices, this library provides access to a completely open source and configurable BLE stack. No softdevice to work around, allowing for full debugging and resource management, continuous updates, with a cross platform API.
@@ -31,17 +31,19 @@ For Nordic devices, this library provides access to a completely open source and
3131
* Open platformio.ini, a project configuration file located in the root of PlatformIO project.
3232
* Add the following line to the lib_deps option of [env:] section:
3333
```
34-
h2zero/NimBLE-Arduino@^1.4.0
34+
h2zero/NimBLE-Arduino@^2.1.0
3535
```
3636
* Build a project, PlatformIO will automatically install dependencies.
3737

3838
# Using
39-
This library is intended to be compatible with the original ESP32 BLE functions and types with minor changes.
39+
This library is intended to be compatible with the original ESP32 BLE functions and classes with minor changes.
4040

4141
If you have not used the original Bluedroid library please refer to the [New user guide](docs/New_user_guide.md).
4242

4343
If you are familiar with the original library, see: [The migration guide](docs/Migration_guide.md) for details about breaking changes and migration.
4444

45+
If you already use this library and need to migrate your code to version 2.x see the [1.x to 2.x Migration Guide.](docs/1.x_to2.x_migration_guide.md)
46+
4547
[Full API documentation and class list can be found here.](https://h2zero.github.io/NimBLE-Arduino/)
4648

4749
For added performance and optimizations see [Usage tips](docs/Usage_tips.md).
@@ -60,9 +62,16 @@ such as increasing max connections, default is 3 for the esp32.
6062
This Library is tracking the esp-nimble repo, nimble-1.5.0-idf branch, currently [@e3cbdc0.](https://github.com/espressif/esp-nimble)
6163
<br/>
6264

65+
# Sponsors
66+
Thank you to all the sponsors who support this project!
67+
68+
<!-- sponsors --><!-- sponsors -->
69+
70+
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.
71+
<br/>
72+
6373
# Acknowledgments
6474
* [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.
6575
* [beegee-tokyo](https://github.com/beegee-tokyo) for contributing your time to test/debug and contributing the beacon examples.
6676
* [Jeroen88](https://github.com/Jeroen88) for the amazing help debugging and improving the client code.
6777
<br/>
68-

docs/index.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Call `NimBLEDevice::init` in `setup`.
2424
* Open platformio.ini, a project configuration file located in the root of PlatformIO project.
2525
* Add the following line to the lib_deps option of [env:] section:
2626
```
27-
h2zero/NimBLE-Arduino@^1.4.0
27+
h2zero/NimBLE-Arduino@^2.1.0
2828
```
2929
* Build a project, PlatformIO will automatically install dependencies.
3030
<br/>
@@ -36,13 +36,13 @@ If you have not used the original BLE library please refer to the [New user guid
3636

3737
If you are familiar with the original library, see: [The migration guide](Migration_guide.md) for details.
3838

39+
If you already use this library and need to migrate your code to version 2.x see the [1.x to 2.x Migration Guide.](docs/1.x_to2.x_migration_guide.md)
40+
3941
For more advanced usage see [Usage tips](Usage_tips.md) for more performance and optimization.
4042
<br/>
4143

4244
## Examples
43-
See the Refactored_original_examples in the examples folder for highlights of the differences with the original library.
44-
45-
More advanced examples highlighting many available features are in examples/NimBLE_Server, NimBLE_Client.
45+
Examples highlighting many available features are in examples/NimBLE_Server, NimBLE_Client.
4646

4747
Beacon examples provided by [beegee-tokyo](https://github.com/beegee-tokyo) are in examples/BLE_Beacon_Scanner, BLE_EddystoneTLM_Beacon.
4848

@@ -55,14 +55,14 @@ As an alternative to changing the configuration in nimconfig.h, Arduino command
5555
See the command line configuration options available in [Command line config](Command_line_config.md).
5656
<br/>
5757

58-
# Need help? Have a question or suggestion?
59-
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)
58+
# Sponsors
59+
Thank you to all the sponsors who support this project!
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.
6062
<br/>
6163

6264
# Acknowledgments
63-
6465
* [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.
6566
* [beegee-tokyo](https://github.com/beegee-tokyo) for contributing your time to test/debug and contributing the beacon examples.
6667
* [Jeroen88](https://github.com/Jeroen88) for the amazing help debugging and improving the client code.
6768
<br/>
68-

examples/NimBLE_Client/NimBLE_Client.ino

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

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

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

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

2727
/********************* Security handled here *********************/
@@ -49,10 +49,10 @@ class ClientCallbacks : public NimBLEClientCallbacks {
4949
return;
5050
}
5151
}
52-
} clientCB;
52+
} clientCallbacks;
5353

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

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

123123
Serial.printf("New client created\n");
124124

125-
pClient->setClientCallbacks(&clientCB, false);
125+
pClient->setClientCallbacks(&clientCallbacks, false);
126126
/**
127127
* Set initial connection parameters:
128128
* These settings are safe for 3 clients to connect reliably, can go faster if you have less
@@ -217,7 +217,9 @@ bool connectToServer() {
217217
}
218218

219219
if (pChr->canRead()) {
220-
Serial.printf("The value of: %s is now: %s\n", pChr->getUUID().toString().c_str(), pChr->readValue().c_str());
220+
Serial.printf("The value of: %s is now: %s\n",
221+
pChr->getUUID().toString().c_str(),
222+
pChr->readValue().c_str());
221223
}
222224
}
223225

@@ -272,7 +274,7 @@ void setup() {
272274
NimBLEScan* pScan = NimBLEDevice::getScan();
273275

274276
/** Set the callbacks to call when scan events occur, no duplicates */
275-
pScan->setScanCallbacks(&scanCB, false);
277+
pScan->setScanCallbacks(&scanCallbacks, false);
276278

277279
/** Set scan interval (how often) and window (how long) in milliseconds */
278280
pScan->setInterval(100);
@@ -285,7 +287,7 @@ void setup() {
285287
pScan->setActiveScan(true);
286288

287289
/** Start scanning for advertisers */
288-
pScan->start(scanTime);
290+
pScan->start(scanTimeMs);
289291
Serial.printf("Scanning for peripherals\n");
290292
}
291293

@@ -302,6 +304,6 @@ void loop() {
302304
Serial.printf("Failed to connect, starting scan\n");
303305
}
304306

305-
NimBLEDevice::getScan()->start(scanTime, false, true);
307+
NimBLEDevice::getScan()->start(scanTimeMs, false, true);
306308
}
307309
}

examples/NimBLE_Scan_Continuous/NimBLE_Scan_Continuous.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <Arduino.h>
1515
#include <NimBLEDevice.h>
1616

17-
static constexpr uint32_t scanTime = 30 * 1000; // 30 seconds scan time.
17+
static constexpr uint32_t scanTimeMs = 30 * 1000; // 30 seconds scan time.
1818

1919
class scanCallbacks : public NimBLEScanCallbacks {
2020
/** Initial discovery, advertisement data only. */
@@ -32,7 +32,7 @@ class scanCallbacks : public NimBLEScanCallbacks {
3232

3333
void onScanEnd(const NimBLEScanResults& results, int reason) override {
3434
printf("Scan ended reason = %d; restarting scan\n", reason);
35-
NimBLEDevice::getScan()->start(scanTime, false, true);
35+
NimBLEDevice::getScan()->start(scanTimeMs, false, true);
3636
}
3737
} scanCallbacks;
3838

@@ -42,7 +42,7 @@ void setup() {
4242
pBLEScan->setScanCallbacks(&scanCallbacks, false); // Set the callback for when devices are discovered, no duplicates.
4343
pBLEScan->setActiveScan(true); // Set active scanning, this will get more data from the advertiser.
4444
pBLEScan->setMaxResults(0); // Do not store the scan results, use callback only.
45-
pBLEScan->start(scanTime, false, true); // duration, not a continuation of last scan, restart to get all devices again.
45+
pBLEScan->start(scanTimeMs, false, true); // duration, not a continuation of last scan, restart to get all devices again.
4646
printf("Scanning...\n");
4747
}
4848

examples/NimBLE_Scan_Whitelist/NimBLE_Scan_whitelist.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <Arduino.h>
99
#include <NimBLEDevice.h>
1010

11-
int scanTime = 5 * 1000; // In milliseconds, 0 = scan forever
11+
int scanTimeMs = 5 * 1000; // In milliseconds, 0 = scan forever
1212
NimBLEScan* pBLEScan;
1313

1414
class ScanCallbacks : public NimBLEScanCallbacks {
@@ -42,7 +42,7 @@ void setup() {
4242
}
4343

4444
void loop() {
45-
NimBLEScanResults foundDevices = pBLEScan->getResults(scanTime, false);
45+
NimBLEScanResults foundDevices = pBLEScan->getResults(scanTimeMs, false);
4646
Serial.print("Devices found: ");
4747
Serial.println(foundDevices.getCount());
4848
Serial.println("Scan done!");

library.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name=NimBLE-Arduino
22
version=2.1.0
33
author=h2zero
4-
maintainer=Ryan Powell <powell.rg@gmail.com>
4+
maintainer=Ryan Powell <ryan@nable-embedded.io>
55
sentence=Bluetooth low energy (BLE) library for Arduino based on NimBLE.
6-
paragraph=This is frequently updated and lower resource alternative to the original bluedroid BLE library for esp32 and Nordic nRF5 devices (must use n-able-Arduino core). Uses 50% less flash space and approximately 100KB less ram with the same functionality. Nearly 100% compatible with existing application code, migration guide included.
6+
paragraph=A light-weight alternative to the original bluedroid based BLE library for esp32 and Nordic nRF5 devices (must use n-able-Arduino core). Uses 50% less flash space and approximately 100KB less ram with the same functionality. Nearly 100% compatible with existing application code, migration guide included.
77
url=https://github.com/h2zero/NimBLE-Arduino
88
category=Communication
99
architectures=esp32,arm-ble

0 commit comments

Comments
 (0)