Find a file
h2zero 10e50a8791 Add iterators to client remote attributes.
Add iterators for NimBLEScan: NimBLEadvertisedDevice, NimBLEClient: NimBLERemoteService, NimBLERemoteService: NimBLERemoteCharacteristic and NimBLERemoteCharacteristic: NimBLERemoteDescriptor

This is handy e.g. for showing every address of the advertised devices from a scan. To do so, first get a new scan and next:
```
for(auto pAdvertisedDevice: pBLEScan->getResults()) {
  Serial.printf("Address is %s\n", std::string(pAdvertisedDevice->getAddress()).c_str());
}
```
Of course any other property of the advertised device can be shown (or looked up, if that is your use case)

Also this is handy e.g. for showing every UUID in a peripheral. To do so, first connect to a peripheral and next:
```
for(auto pService: *pClient) {
  Serial.printf("Service UUID is %s\n", std::string(pService->getUUID()).c_str());
  for(auto pCharacteristic: *pService) {
    Serial.printf("Characteristic UUID is %s\n", std::string(pCharacteristic->getUUID()).c_str());
    for(auto pDescriptor: *pCharacteristic) {
      Serial.printf("Descriptor UUID is %s\n", std::string(pDescriptor->getUUID()).c_str());
    }
  }
}
```
Again of course any other property can be shown, or looked up.
2020-05-22 20:13:52 -06:00
src Add iterators to client remote attributes. 2020-05-22 20:13:52 -06:00
API_DIFFERENCES.md Breaking: Use std::vector instead of std::map in client classes (#46) 2020-05-17 20:22:58 -06:00
CMakeLists.txt Add CMakeLists.txt. 2020-03-31 20:16:27 -06:00
component.mk Add missing component.mk file. 2020-03-29 19:13:59 -06:00
Kconfig Conditionally compile code for specific roles. 2020-05-13 22:03:56 -06:00
Kconfig.projbuild Implement selective log messages. 2020-05-10 21:30:15 -06:00
LICENSE Initial commit. 2020-03-29 17:44:20 -06:00
README.md Breaking: Use std::vector instead of std::map in client classes (#46) 2020-05-17 20:22:58 -06:00

*** UPDATE ***

Breaking change: Client and scan now use std::vector instead of std::map for storing the remote attribute database.

This change will affect your application code if you use NimBLEClient::getServices() or NimBLERemoteService::getCharacteristics()
in your application as they now return a pointer to std::vector of the respective attributes.

In addition NimBLERemoteService::getCharacteristicsByHandle() has been removed as it is no longer maintained in the library.

These changes were necessary due to the amount of resources required to use std::map, it was not justifed by any benfit it provided.

It is expected that there will be minimal impact on most applications, if you need help adjusting your code please create an issue.

esp-nimble-cpp

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

Why? Because the Bluedroid library is too bulky.

Initial client code testing has resulted in code size reduction of ~115k and reduced ram consumption of ~37k.

Installation:

Download as .zip and extract to components folder in your esp-idf project.

Run menuconfig, go to Component config->Bluetooth-> enable Bluetooth and select NimBLE host.

#include "NimBLEDevice.h" in main.cpp.

Usage:

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

Check API_DIFFERENCES for details.

Acknowledgments:

  • @nkolban and @chegewara for the original esp32 BLE library this project was derived from.
  • @beegee-tokyo for contributing your time to test/debug and contributing the beacon examples.

Todo:

  1. Code cleanup.
  2. Create documentation.
  3. Expose more NimBLE features.
  4. Add BLE Mesh code.