mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2025-12-27 09:08:16 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8add6e86c4 | ||
|
|
10acb004dc | ||
|
|
9cdf60d360 | ||
|
|
26b3ba3e8f |
25
CHANGELOG.md
Normal file
25
CHANGELOG.md
Normal 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.
|
||||
16
README.md
16
README.md
@@ -1,3 +1,7 @@
|
||||
[Latest release 
|
||||
](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 
|
||||
](https://github.com/h2zero/esp-nimble-cpp/releases/latest/)
|
||||

|
||||
<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/>
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user