22 Commits

Author SHA1 Message Date
h2zero
9ce2eec0cb Bugfix - Characteristic onRead callback not called.
Fixes detection of the original read request vs a followup read for characteristic values greater than MTU - 3.
2025-03-14 10:57:55 -06:00
Ryan Powell
723cdf0a66 Merge pull request #312 from iranl/patch-3
Fix ESP32-P4 compile when using Arduino as an ESP-IDF component
2025-03-10 18:30:44 -06:00
iranl
148087c508 Fix ESP32-P4 compile when using Arduino as an ESP-IDF component 2025-03-02 21:46:34 +01:00
h2zero
88c5d0c7b7 Bump docs version 2025-02-28 14:56:46 -07:00
h2zero
a6c03a2aaa Release 2.2.1 2025-02-28 09:51:31 -07:00
h2zero
9df8445241 [Bugfix] Check if remote descriptor vector has increased. 2025-02-25 17:08:01 -07:00
h2zero
e5f4d52a5a Update changelog 2025-02-25 14:26:57 -07:00
h2zero
7ef247c8db Partially revert Commit 052c0a04 to restore client connect with device parameter. 2025-02-25 14:23:25 -07:00
h2zero
c582c8c67e Release 2.2.0 2025-02-24 17:58:21 -07:00
William Emfinger
74b5c59887 fix(NimBLEDevice): fix crash when pairing table is full
* Add missing definition for default device callbacks (which prevents calling the `setDeviceCallbacks` method)
* Ensure `m_pDeviceCallbacks` inital value is set to `&defaultDeviceCallbacks` to prevent crash when pairing table is full

After #295 any time the pairing table fills up, the device will crash on the next pairing attempt.
2025-02-13 06:58:54 -07:00
h2zero
60efffdf2b [BugFix] Provide default task data when retrieving all descriptors.
* Update the descriptor filter when trying again with different UUID sizes.
2025-02-08 15:08:32 -07:00
thekurtovic
b6379848ae change(2904|AdvData): Add missing parameter name in declarations 2025-02-05 15:15:49 -07:00
thekurtovic
b29919df96 feat(Device): Implement store status handler 2025-02-05 15:14:42 -07:00
thekurtovic
052c0a0455 feat(AdvDevice): Add convenience operator to NimBLEAddress 2025-02-05 14:07:10 -07:00
thekurtovic
784e6f30fa Merge pull request #301 from thekurtovic/feat-log-condition
feat(Log): Add macros for conditional log print and rc handling
2025-01-28 14:59:53 -05:00
thekurtovic
5490cef129 feat(Log): Add macros for conditional log print and rc handling 2025-01-28 13:40:19 -05:00
h2zero
459e8c9fcd Release 2.1.1 2025-01-26 18:23:11 -07:00
thekurtovic
ffa8414747 refactor(RemoteChar): Reduce nesting
* Renamed desc_filter_t to NimBLEDescriptorFilter
* Added NimBLERemoteDescriptor pointer to NimBLEDescriptorFilter
* retrieveDescriptors changed to take NimBLEDescriptorFilter pointer
* General cleanup
2025-01-26 11:28:48 -07:00
h2zero
8130f88be8 Rename config macros to enable duplicate scan options on s3/c3 2025-01-26 11:09:36 -07:00
h2zero
c39e288c3e Workaround for P4 CI build error. 2025-01-26 09:41:25 -07:00
Guo-Rong
8158a16fbf Fix characteristic discovery with no descriptors.
Avoid discovery of descriptors if there are no handles remaining.
2025-01-15 18:37:47 -07:00
h2zero
57fe9cb77f Release 2.1.0 2025-01-12 19:17:10 -07:00
9 changed files with 44 additions and 14 deletions

View File

@@ -1,11 +1,20 @@
# Changelog
All notable changes to this project will be documented in this file.
## [2.2.1] 2025-02-28
## Fixed
- Added back `NimBLEClient::connect` overload with `NimBLEAdvertisedDevice` parameter to resolve connection error due to NULL address.
- Crash caused by returning invalid vector entry when retrieving remote descriptors.
## [2.2.0] 2025-02-24
## Fixed
- Crash when calling `NimBLEClient::DiscoverAttributes`.
## Added
- Conditional macros for logging.
- `NimBLEDevicecallbacks` class with a callback for handling bond storage.
- `NimBLEDeviceCallbacks` class with a callback for handling bond storage.
## [2.1.1] 2025-01-26

View File

@@ -48,7 +48,7 @@ PROJECT_NAME = esp-nimble-cpp
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 2.2.0
PROJECT_NUMBER = 2.2.1
# 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

View File

@@ -1,5 +1,5 @@
## IDF Component Manager Manifest File
version: "2.2.0"
version: "2.2.1"
license: "Apache-2.0"
description: "C++ wrapper for the NimBLE BLE stack"
url: "https://github.com/h2zero/esp-nimble-cpp"

View File

@@ -1,6 +1,6 @@
{
"name": "esp-nimble-cpp",
"version": "2.2.0",
"version": "2.2.1",
"description": "C++ wrapper for the NimBLE BLE stack",
"keywords": [
"BLE",

View File

@@ -126,6 +126,22 @@ size_t NimBLEClient::deleteService(const NimBLEUUID& uuid) {
return m_svcVec.size();
} // deleteService
/**
* @brief Connect to an advertising device.
* @param [in] pDevice A pointer to the advertised device instance to connect to.
* @param [in] deleteAttributes If true this will delete any attribute objects this client may already\n
* have created when last connected.
* @param [in] asyncConnect If true, the connection will be made asynchronously and this function will return immediately.\n
* If false, this function will block until the connection is established or the connection attempt times out.
* @param [in] exchangeMTU If true, the client will attempt to exchange MTU with the server after connection.\n
* If false, the client will use the default MTU size and the application will need to call exchangeMTU() later.
* @return true on success.
*/
bool NimBLEClient::connect(const NimBLEAdvertisedDevice* pDevice, bool deleteAttributes, bool asyncConnect, bool exchangeMTU) {
NimBLEAddress address(pDevice->getAddress());
return connect(address, deleteAttributes, asyncConnect, exchangeMTU);
} // connect
/**
* @brief Connect to the BLE Server using the address of the last connected device, or the address\n
* passed to the constructor.

View File

@@ -48,6 +48,10 @@ struct NimBLETaskData;
*/
class NimBLEClient {
public:
bool connect(const NimBLEAdvertisedDevice* device,
bool deleteAttributes = true,
bool asyncConnect = false,
bool exchangeMTU = true);
bool connect(const NimBLEAddress& address, bool deleteAttributes = true, bool asyncConnect = false, bool exchangeMTU = true);
bool connect(bool deleteAttributes = true, bool asyncConnect = false, bool exchangeMTU = true);
bool disconnect(uint8_t reason = BLE_ERR_REM_USER_CONN_TERM);

View File

@@ -844,7 +844,7 @@ bool NimBLEDevice::init(const std::string& deviceName) {
if (!m_initialized) {
# ifdef ESP_PLATFORM
# ifdef CONFIG_ENABLE_ARDUINO_DEPENDS
# if defined(CONFIG_ENABLE_ARDUINO_DEPENDS) && SOC_BT_SUPPORTED
// make sure the linker includes esp32-hal-bt.c so Arduino init doesn't release BLE memory.
btStarted();
# endif

View File

@@ -117,6 +117,7 @@ bool NimBLERemoteCharacteristic::retrieveDescriptors(NimBLEDescriptorFilter* pFi
return false;
}
auto prevDscCount = m_vDescriptors.size();
NimBLEUtils::taskWait(pFilter->taskData, BLE_NPL_TIME_FOREVER);
rc = ((NimBLETaskData*)pFilter->taskData)->m_flags;
if (rc != BLE_HS_EDONE) {
@@ -124,8 +125,11 @@ bool NimBLERemoteCharacteristic::retrieveDescriptors(NimBLEDescriptorFilter* pFi
return false;
}
pFilter->dsc = m_vDescriptors.back();
NIMBLE_LOGD(LOG_TAG, "<< retrieveDescriptors(): found %d descriptors.", m_vDescriptors.size());
if (m_vDescriptors.size() > prevDscCount) {
pFilter->dsc = m_vDescriptors.back();
}
NIMBLE_LOGD(LOG_TAG, "<< retrieveDescriptors(): found %d descriptors.", m_vDescriptors.size() - prevDscCount);
return true;
} // retrieveDescriptors

View File

@@ -620,13 +620,10 @@ int NimBLEServer::handleGattEvent(uint16_t connHandle, uint16_t attrHandle, ble_
switch (ctxt->op) {
case BLE_GATT_ACCESS_OP_READ_DSC:
case BLE_GATT_ACCESS_OP_READ_CHR: {
// Don't call readEvent if this is an internal read (handle is NONE)
if (connHandle != BLE_HS_CONN_HANDLE_NONE) {
// If the packet header is only 8 bytes then this is a follow up of a long read
// so we don't want to call the onRead() callback again.
if (ctxt->om->om_pkthdr_len > 8 || val.size() <= (ble_att_mtu(connHandle) - 3)) {
pAtt->readEvent(peerInfo);
}
// Don't call readEvent if the buffer len is 0 (this is a follow up to a previous read),
// or if this is an internal read (handle is NONE)
if (ctxt->om->om_len > 0 && connHandle != BLE_HS_CONN_HANDLE_NONE) {
pAtt->readEvent(peerInfo);
}
ble_npl_hw_enter_critical();