4 Commits
1.0.0 ... 1.0.1

Author SHA1 Message Date
h2zero
8add6e86c4 Release v1.0.1 2020-09-02 19:45:08 -06:00
h2zero
10acb004dc NimBLEAddress: New constructor added to create blank addresses
* Docuement NimBLEAddress::getNative in migration docs.
2020-09-02 14:52:34 -06:00
Cornelius Munz
9cdf60d360 Change notify_callback typedef to enable the usage of member function as callback
With this change the callback function could be also a member function
2020-09-02 12:15:02 -06:00
h2zero
26b3ba3e8f Fix delayed advertising when first called. 2020-09-02 12:05:05 -06:00
7 changed files with 56 additions and 10 deletions

25
CHANGELOG.md Normal file
View File

@@ -0,0 +1,25 @@
# Changelog
All notable changes to this project will be documented in this file.
## [1.0.1] - 2020-09-02
### Added
- Empty `NimBLEAddress` constructor: `NimBLEAddress()` produces an address of 00:00:00:00:00:00 type 0.
- Documentation of the difference of NimBLEAddress::getNative vs the original bluedroid library.
### Changed
- notify_callback typedef is now defined as std::function to enable the use of std::bind to call a class member function.
### Fixed
- Fix advertising start delay when first called.
## [1.0.0] - 2020-08-22
First stable release.
All the original library functionality is complete and many extras added with full documentation.

View File

@@ -1,3 +1,7 @@
[Latest release ![Release Version](https://img.shields.io/github/release/h2zero/esp-nimble-cpp.svg?style=plastic)
![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/)
<br/>
# esp-nimble-cpp
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).
@@ -18,12 +22,6 @@ NimBLE is a completely open source Bluetooth Low Energy stack produced by [Apach
It is more suited to resource constrained devices than bluedroid and has now been ported to the ESP32 by Espressif.
<br/>
# Development Status
[Latest release ![Release Version](https://img.shields.io/github/release/h2zero/esp-nimble-cpp.svg?style=plastic)
![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/)
![Downloads](https://img.shields.io/github/downloads/h2zero/esp-nimble-cpp/latest/total.svg?style=plastic)
<br/>
# Installation
### ESP-IDF v4.0+
@@ -64,6 +62,8 @@ Also see [Improvements_and_updates](docs/Improvements_and_updates.md) for inform
<br/>
# Todo
1. Implement random addresses.
2. Add BLE Mesh code.
- Improve host reset handler
- Implement random address handling
- Implement bond management
- Add Bluetooth Mesh
<br/>

View File

@@ -47,6 +47,12 @@ For example `BLEAddress addr(11:22:33:44:55:66, 1)` will create the address obje
As this paramameter is optional no changes to existing code are needed, it is mentioned here for information.
<br/>
`BLEAddress::getNative` (`NimBLEAddress::getNative`) returns a uint8_t pointer to the native address byte array.
In this library the address bytes are stored in reverse order from the original library. This is due to the way
the NimBLE stack expects addresses to be presented to it. All other functions such as `toString` are
not affected as the endian change is made within them.
<br/>
<a name="server-api"></a>
## Server API
Creating a `BLEServer` instance is the same as original, no changes required.

View File

@@ -37,6 +37,14 @@ NimBLEAddress::NimBLEAddress(ble_addr_t address) {
} // NimBLEAddress
/**
* @brief Create a blank address, i.e. 00:00:00:00:00:00, type 0.
*/
NimBLEAddress::NimBLEAddress() {
NimBLEAddress("");
} // NimBLEAddress
/**
* @brief Create an address from a hex string
*

View File

@@ -33,6 +33,7 @@
*/
class NimBLEAddress {
public:
NimBLEAddress();
NimBLEAddress(ble_addr_t address);
NimBLEAddress(uint8_t address[6], uint8_t type = BLE_ADDR_PUBLIC);
NimBLEAddress(const std::string &stringAddress, uint8_t type = BLE_ADDR_PUBLIC);

View File

@@ -227,6 +227,11 @@ void NimBLEAdvertising::start() {
if(pServer != nullptr) {
if(!pServer->m_gattsStarted){
pServer->start();
// When the server instance is created it resets GATT which
// seems to put the controller in a sleep loop? This causes a delay when
// advertising is started the first time. To avoid this we call ble_gap_adv_stop
// to get the controller ready.
ble_gap_adv_stop();
} else if(pServer->getConnectedCount() >= NIMBLE_MAX_CONNECTIONS) {
NIMBLE_LOGW(LOG_TAG, "Max connections reached - not advertising");
return;

View File

@@ -24,13 +24,14 @@
#include "NimBLERemoteDescriptor.h"
#include <vector>
#include <functional>
class NimBLERemoteService;
class NimBLERemoteDescriptor;
typedef void (*notify_callback)(NimBLERemoteCharacteristic* pBLERemoteCharacteristic,
uint8_t* pData, size_t length, bool isNotify);
typedef std::function<void (NimBLERemoteCharacteristic* pBLERemoteCharacteristic,
uint8_t* pData, size_t length, bool isNotify)> notify_callback;
typedef struct {
const NimBLEUUID *uuid;