mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2025-12-23 23:28:08 +01:00
Compare commits
22 Commits
2.2.0
...
bugfix/onr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ce2eec0cb | ||
|
|
723cdf0a66 | ||
|
|
148087c508 | ||
|
|
88c5d0c7b7 | ||
|
|
a6c03a2aaa | ||
|
|
9df8445241 | ||
|
|
e5f4d52a5a | ||
|
|
7ef247c8db | ||
|
|
c582c8c67e | ||
|
|
74b5c59887 | ||
|
|
60efffdf2b | ||
|
|
b6379848ae | ||
|
|
b29919df96 | ||
|
|
052c0a0455 | ||
|
|
784e6f30fa | ||
|
|
5490cef129 | ||
|
|
459e8c9fcd | ||
|
|
ffa8414747 | ||
|
|
8130f88be8 | ||
|
|
c39e288c3e | ||
|
|
8158a16fbf | ||
|
|
57fe9cb77f |
11
CHANGELOG.md
11
CHANGELOG.md
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user