Skip to content

Commit

Permalink
Release 1.4.0
Browse files Browse the repository at this point in the history
* Fix typos

* Update docs
  • Loading branch information
h2zero committed Jul 31, 2022
1 parent 70ed6e2 commit efa48c0
Show file tree
Hide file tree
Showing 27 changed files with 159 additions and 164 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@

All notable changes to this project will be documented in this file.

## [1.4.0] - 2022-07-31

### Fixed
- Fixed missing data from long notification values.
- Fixed NimbleCharacteristicCallbacks::onRead not being called when a non-long read command is received.
- Prevent a potential crash when retrieving characteristics from a service if the result was successful but no characteristics found.
- logs/typos.

### Changed
- AD flags are no longer set in the advertisements of non-connectable beacons, freeing up 3 bytes of advertisement room.
- Save resources when retrieving descriptors if the characteristic handle is the same as the end handle (no descriptors).
- Subscribing to characteristic notifications/indications will now always use write with response, as per BLE specifications.
- `NimBLEClient::discoverAttributes` now returns a bool value to indicate success/failure.
- Scan result callbacks are no longer called when the scan response data is updated in order to reduce duplicates.

### Added
- Preliminary support for non-esp devices, NRF51 and NRF52 devices supported with [n-able arduino core](https://github.com/h2zero/n-able-Arduino)
- Alias added for `NimBLEServerCallbacks::onMTUChange` to `onMtuChanged` in order to support porting code from original library.
- `NimBLEAttValue` Class added to reduce and control RAM footprint of characteristic/descriptor values and support conversions from Arduino Strings and many other data types.
- Bluetooth 5 extended advertising support for capable devices. CODED Phy, 2M Phy, extended advertising data, and multi-advertising are supported, periodic advertising will be implemented in the future.

## [1.3.3] - 2022-02-15

### Changed
Expand Down
2 changes: 1 addition & 1 deletion Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ config NIMBLE_CPP_ENABLE_GAP_EVENT_CODE_TEXT
messages in the debug log. This will use approximately 1kB
of flash memory.

config NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT
config NIMBLE_CPP_ENABLE_ADVERTISEMENT_TYPE_TEXT
bool "Show advertisment types as text in debug log."
default "n"
help
Expand Down
5 changes: 3 additions & 2 deletions docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = esp-nimble-cpp
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 1.3.2
PROJECT_NUMBER = 1.4.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down Expand Up @@ -2267,7 +2267,8 @@ PREDEFINED = _DOXYGEN_ \
CONFIG_BT_NIMBLE_ROLE_CENTRAL \
CONFIG_BT_NIMBLE_ROLE_OBSERVER \
CONFIG_BT_NIMBLE_ROLE_PERIPHERAL \
CONFIG_BT_NIMBLE_ROLE_BROADCASTER
CONFIG_BT_NIMBLE_ROLE_BROADCASTER \
CONFIG_BT_NIMBLE_EXT_ADV

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand Down
138 changes: 69 additions & 69 deletions docs/Migration_guide.md

Large diffs are not rendered by default.

27 changes: 0 additions & 27 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,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/>

# Arduino Installation
**Arduino Library manager:** Go to `sketch` -> `Include Library` -> `Manage Libraries` and search for NimBLE and install.

**Alternatively:** Download as .zip and extract to Arduino/libraries folder, or in Arduino IDE from Sketch menu -> Include library -> Add .Zip library.

`#include "NimBLEDevice.h"` at the beginning of your sketch.

Call `NimBLEDevice::init` in `setup`.

Tested and working with esp32-arduino in Arduino IDE and platform IO.
<br/>

# ESP-IDF Installation
### v4.0+
Download as .zip and extract or clone into the components folder in your esp-idf project.
Expand Down Expand Up @@ -57,21 +45,6 @@ Also see [Improvements and updates](Improvements_and_updates.md) for information
For more advanced usage see [Usage tips](Usage_tips.md) for more performance and optimization.
<br/>

### Arduino specific
See the Refactored_original_examples in the examples folder for highlights of the differences with the original library.

More advanced examples highlighting many available features are in examples/NimBLE_Server, NimBLE_Client.

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

Change the settings in the nimconfig.h file to customize NimBLE to your project, such as increasing max connections (default is 3).
<br/>

### Arduino command line and platformio
As an alternative to changing the configuration in nimconfig.h, Arduino command line and platformio.ini options are available.
See the command line configuration options available in [Command line config](Command_line_config.md).
<br/>

# Need help? Have a question or suggestion?
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)
<br/>
Expand Down
4 changes: 2 additions & 2 deletions src/NimBLE2904.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
#include "NimBLE2904.h"


NimBLE2904::NimBLE2904(NimBLECharacteristic* pCharacterisitic)
NimBLE2904::NimBLE2904(NimBLECharacteristic* pCharacteristic)
: NimBLEDescriptor(NimBLEUUID((uint16_t) 0x2904),
BLE_GATT_CHR_F_READ,
sizeof(BLE2904_Data),
pCharacterisitic)
pCharacteristic)
{
m_data.m_format = 0;
m_data.m_exponent = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/NimBLEAddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,15 @@ std::string NimBLEAddress::toString() const {


/**
* @brief Convienience operator to check if this address is equal to another.
* @brief Convenience operator to check if this address is equal to another.
*/
bool NimBLEAddress::operator ==(const NimBLEAddress & rhs) const {
return memcmp(rhs.m_address, m_address, sizeof m_address) == 0;
} // operator ==


/**
* @brief Convienience operator to check if this address is not equal to another.
* @brief Convenience operator to check if this address is not equal to another.
*/
bool NimBLEAddress::operator !=(const NimBLEAddress & rhs) const {
return !this->operator==(rhs);
Expand All @@ -186,7 +186,7 @@ NimBLEAddress::operator std::string() const {


/**
* @brief Convienience operator to convert the native address representation to uint_64.
* @brief Convenience operator to convert the native address representation to uint_64.
*/
NimBLEAddress::operator uint64_t() const {
uint64_t address = 0;
Expand Down
12 changes: 6 additions & 6 deletions src/NimBLEAdvertisedDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ NimBLEAddress NimBLEAdvertisedDevice::getAddress() {
* @brief Get the advertisement type.
* @return The advertising type the device is reporting:
* * BLE_HCI_ADV_TYPE_ADV_IND (0) - indirect advertising
* * BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_HD (1) - direct advertisng - high duty cycle
* * BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_HD (1) - direct advertising - high duty cycle
* * BLE_HCI_ADV_TYPE_ADV_SCAN_IND (2) - indirect scan response
* * BLE_HCI_ADV_TYPE_ADV_NONCONN_IND (3) - indirect advertisng - not connectable
* * BLE_HCI_ADV_TYPE_ADV_NONCONN_IND (3) - indirect advertising - not connectable
* * BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_LD (4) - direct advertising - low duty cycle
*/
uint8_t NimBLEAdvertisedDevice::getAdvType() {
Expand All @@ -66,7 +66,7 @@ uint8_t NimBLEAdvertisedDevice::getAdvType() {
* @brief Get the appearance.
*
* A %BLE device can declare its own appearance. The appearance is how it would like to be shown to an end user
* typcially in the form of an icon.
* typically in the form of an icon.
*
* @return The appearance of the advertised device.
*/
Expand Down Expand Up @@ -308,7 +308,7 @@ std::string NimBLEAdvertisedDevice::getServiceData(const NimBLEUUID &uuid) {


/**
* @brief Get the UUID of the serice data at the index.
* @brief Get the UUID of the service data at the index.
* @param [in] index The index of the service data UUID requested.
* @return The advertised service data UUID or an empty UUID if not found.
*/
Expand Down Expand Up @@ -448,7 +448,7 @@ uint8_t NimBLEAdvertisedDevice::getServiceUUIDCount() {


/**
* @brief Check advertised services for existance of the required UUID
* @brief Check advertised services for existence of the required UUID
* @param [in] uuid The service uuid to look for in the advertisement.
* @return Return true if service is advertised
*/
Expand Down Expand Up @@ -794,7 +794,7 @@ void NimBLEAdvertisedDevice::setPayload(const uint8_t *payload, uint8_t length,

/**
* @brief Get the length of the advertisement data in the payload.
* @return The number of bytes in the payload that is from the advertisment.
* @return The number of bytes in the payload that is from the advertisement.
*/
uint8_t NimBLEAdvertisedDevice::getAdvLength() {
return m_advLength;
Expand Down
2 changes: 1 addition & 1 deletion src/NimBLEAdvertising.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ int NimBLEAdvertising::handleGapEvent(struct ble_gap_event *event, void *arg) {
*/
void NimBLEAdvertisementData::addData(const std::string &data) {
if ((m_payload.length() + data.length()) > BLE_HS_ADV_MAX_SZ) {
NIMBLE_LOGE(LOG_TAG, "Advertisement data length exceded");
NIMBLE_LOGE(LOG_TAG, "Advertisement data length exceeded");
return;
}
m_payload.append(data);
Expand Down
2 changes: 1 addition & 1 deletion src/NimBLEAttValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct Has_c_str_len<T, decltype(void(std::declval<T &>().c_str())),
/**
* @brief A specialized container class to hold BLE attribute values.
* @details This class is designed to be more memory efficient than using\n
* standard container types for value storage, while being convertable to\n
* standard container types for value storage, while being convertible to\n
* many different container classes.
*/
class NimBLEAttValue
Expand Down
2 changes: 1 addition & 1 deletion src/NimBLEBeacon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void NimBLEBeacon::setManufacturerId(uint16_t manufacturerId) {
*/
void NimBLEBeacon::setMinor(uint16_t minor) {
m_beaconData.minor = ENDIAN_CHANGE_U16(minor);
} // setMinior
} // setMinor


/**
Expand Down
6 changes: 3 additions & 3 deletions src/NimBLECharacteristic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ void NimBLECharacteristic::addDescriptor(NimBLEDescriptor *pDescriptor) {


/**
* @brief Remove a descriptor from the characterisitc.
* @param[in] pDescriptor A pointer to the descriptor instance to remove from the characterisitc.
* @brief Remove a descriptor from the characteristic.
* @param[in] pDescriptor A pointer to the descriptor instance to remove from the characteristic.
* @param[in] deleteDsc If true it will delete the descriptor instance and free it's resources.
*/
void NimBLECharacteristic::removeDescriptor(NimBLEDescriptor *pDescriptor, bool deleteDsc) {
Expand Down Expand Up @@ -442,7 +442,7 @@ void NimBLECharacteristic::notify(const uint8_t* value, size_t length, bool is_n
!(m_properties & NIMBLE_PROPERTY::INDICATE))
{
NIMBLE_LOGE(LOG_TAG,
"<< notify-Error; Notify/indicate not enabled for characterisitc: %s",
"<< notify-Error; Notify/indicate not enabled for characteristic: %s",
std::string(getUUID()).c_str());
}

Expand Down
26 changes: 13 additions & 13 deletions src/NimBLEClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,35 +157,35 @@ size_t NimBLEClient::deleteService(const NimBLEUUID &uuid) {

/**
* @brief Connect to the BLE Server.
* @param [in] deleteAttibutes If true this will delete any attribute objects this client may already\n
* @param [in] deleteAttributes If true this will delete any attribute objects this client may already\n
* have created and clears the vectors after successful connection.
* @return True on success.
*/
bool NimBLEClient::connect(bool deleteAttibutes) {
return connect(m_peerAddress, deleteAttibutes);
bool NimBLEClient::connect(bool deleteAttributes) {
return connect(m_peerAddress, deleteAttributes);
}

/**
* @brief Connect to an advertising device.
* @param [in] device The device to connect to.
* @param [in] deleteAttibutes If true this will delete any attribute objects this client may already\n
* @param [in] deleteAttributes If true this will delete any attribute objects this client may already\n
* have created and clears the vectors after successful connection.
* @return True on success.
*/
bool NimBLEClient::connect(NimBLEAdvertisedDevice* device, bool deleteAttibutes) {
bool NimBLEClient::connect(NimBLEAdvertisedDevice* device, bool deleteAttributes) {
NimBLEAddress address(device->getAddress());
return connect(address, deleteAttibutes);
return connect(address, deleteAttributes);
}


/**
* @brief Connect to the BLE Server.
* @param [in] address The address of the server.
* @param [in] deleteAttibutes If true this will delete any attribute objects this client may already\n
* @param [in] deleteAttributes If true this will delete any attribute objects this client may already\n
* have created and clears the vectors after successful connection.
* @return True on success.
*/
bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttibutes) {
bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttributes) {
NIMBLE_LOGD(LOG_TAG, ">> connect(%s)", address.toString().c_str());

if(!NimBLEDevice::m_synced) {
Expand Down Expand Up @@ -259,7 +259,7 @@ bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttibutes) {
break;

case BLE_HS_EALREADY:
// Already attemting to connect to this device, cancel the previous
// Already attempting to connect to this device, cancel the previous
// attempt and report failure here so we don't get 2 connections.
NIMBLE_LOGE(LOG_TAG, "Already attempting to connect to %s - cancelling",
std::string(m_peerAddress).c_str());
Expand Down Expand Up @@ -317,7 +317,7 @@ bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttibutes) {
NIMBLE_LOGI(LOG_TAG, "Connection established");
}

if(deleteAttibutes) {
if(deleteAttributes) {
deleteServices();
}

Expand Down Expand Up @@ -390,8 +390,8 @@ int NimBLEClient::disconnect(uint8_t reason) {
// We use a timer to detect a controller error in the event that it does
// not inform the stack when disconnection is complete.
// This is a common error in certain esp-idf versions.
// The disconnect timeout time is the supervison timeout time + 1 second.
// In the case that the event happenss shortly after the supervision timeout
// The disconnect timeout time is the supervision timeout time + 1 second.
// In the case that the event happens shortly after the supervision timeout
// we don't want to prematurely reset the host.
ble_npl_time_t ticks;
ble_npl_time_ms_to_ticks((desc.supervision_timeout + 100) * 10, &ticks);
Expand Down Expand Up @@ -431,7 +431,7 @@ void NimBLEClient::setConnectPhy(uint8_t mask) {


/**
* @brief Set the connection paramaters to use when connecting to a server.
* @brief Set the connection parameters to use when connecting to a server.
* @param [in] minInterval The minimum connection interval in 1.25ms units.
* @param [in] maxInterval The maximum connection interval in 1.25ms units.
* @param [in] latency The number of packets allowed to skip (extends max interval).
Expand Down
8 changes: 4 additions & 4 deletions src/NimBLEClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ class NimBLEAdvertisedDevice;
*/
class NimBLEClient {
public:
bool connect(NimBLEAdvertisedDevice* device, bool deleteAttibutes = true);
bool connect(const NimBLEAddress &address, bool deleteAttibutes = true);
bool connect(bool deleteAttibutes = true);
bool connect(NimBLEAdvertisedDevice* device, bool deleteAttributes = true);
bool connect(const NimBLEAddress &address, bool deleteAttributes = true);
bool connect(bool deleteAttributes = true);
int disconnect(uint8_t reason = BLE_ERR_REM_USER_CONN_TERM);
NimBLEAddress getPeerAddress();
void setPeerAddress(const NimBLEAddress &address);
Expand Down Expand Up @@ -137,7 +137,7 @@ class NimBLEClientCallbacks {
* @brief Called when server requests to update the connection parameters.
* @param [in] pClient A pointer to the calling client object.
* @param [in] params A pointer to the struct containing the connection parameters requested.
* @return True to accept the parmeters.
* @return True to accept the parameters.
*/
virtual bool onConnParamsUpdateRequest(NimBLEClient* pClient, const ble_gap_upd_params* params);

Expand Down
2 changes: 1 addition & 1 deletion src/NimBLEDescriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ void NimBLEDescriptor::setValue(const std::vector<uint8_t>& vec) {

/**
* @brief Set the characteristic this descriptor belongs to.
* @param [in] pChar A pointer to the characteristic this descriptior belongs to.
* @param [in] pChar A pointer to the characteristic this descriptor belongs to.
*/
void NimBLEDescriptor::setCharacteristic(NimBLECharacteristic* pChar) {
m_pCharacteristic = pChar;
Expand Down
4 changes: 2 additions & 2 deletions src/NimBLEDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ void NimBLEDevice::onSync(void)
}
#endif

// Yield for houskeeping before returning to operations.
// Yield for housekeeping before returning to operations.
// Occasionally triggers exception without.
taskYIELD();

Expand Down Expand Up @@ -851,7 +851,7 @@ void NimBLEDevice::init(const std::string &deviceName) {
esp_err_t errRc = ESP_OK;

#ifdef CONFIG_ENABLE_ARDUINO_DEPENDS
// make sure the linker includes esp32-hal-bt.c so ardruino init doesn't release BLE memory.
// make sure the linker includes esp32-hal-bt.c so Arduino init doesn't release BLE memory.
btStarted();
#endif

Expand Down

0 comments on commit efa48c0

Please sign in to comment.