mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2025-12-25 16:18:08 +01:00
Compare commits
3 Commits
stream-cla
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c07a1d892 | ||
|
|
9a7db6a16e | ||
|
|
25af28bcad |
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
||||
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html
|
||||
# for details.
|
||||
idf_ver: ["release-v4.4", "release-v5.4", "release-v5.5"]
|
||||
idf_target: ["esp32", "esp32s3", "esp32c2", "esp32c3", "esp32c5", "esp32c6", "esp32h2", "esp32p4"]
|
||||
idf_target: ["esp32", "esp32s3", "esp32c2", "esp32c3", "esp32c5", "esp32c6", "esp32c61", "esp32h2", "esp32p4"]
|
||||
example:
|
||||
- NimBLE_Client
|
||||
- NimBLE_Server
|
||||
@@ -35,6 +35,10 @@ jobs:
|
||||
idf_target: "esp32c5"
|
||||
- idf_ver: release-v4.4
|
||||
idf_target: "esp32c6"
|
||||
- idf_ver: release-v4.4
|
||||
idf_target: "esp32c61"
|
||||
- idf_ver: release-v5.4
|
||||
idf_target: "esp32c61"
|
||||
- idf_ver: release-v4.4
|
||||
idf_target: "esp32h2"
|
||||
- idf_ver: release-v4.4
|
||||
|
||||
@@ -37,6 +37,7 @@ idf_component_register(
|
||||
"esp32c3"
|
||||
"esp32c5"
|
||||
"esp32c6"
|
||||
"esp32c61"
|
||||
"esp32h2"
|
||||
"esp32p4"
|
||||
INCLUDE_DIRS
|
||||
|
||||
@@ -1303,10 +1303,11 @@ bool NimBLEDevice::setDeviceName(const std::string& deviceName) {
|
||||
/**
|
||||
* @brief Set a custom callback for gap events.
|
||||
* @param [in] handler The function to call when gap events occur.
|
||||
* @param [in] arg Argument to pass to the handler.
|
||||
* @returns
|
||||
*/
|
||||
bool NimBLEDevice::setCustomGapHandler(gap_event_handler handler) {
|
||||
int rc = ble_gap_event_listener_register(&m_listener, handler, NULL);
|
||||
bool NimBLEDevice::setCustomGapHandler(gap_event_handler handler, void* arg) {
|
||||
int rc = ble_gap_event_listener_register(&m_listener, handler, arg);
|
||||
if (rc == BLE_HS_EALREADY) {
|
||||
NIMBLE_LOGI(LOG_TAG, "Already listening to GAP events.");
|
||||
return true;
|
||||
|
||||
@@ -133,7 +133,7 @@ class NimBLEDevice {
|
||||
static void setScanDuplicateCacheSize(uint16_t cacheSize);
|
||||
static void setScanFilterMode(uint8_t type);
|
||||
static void setScanDuplicateCacheResetTime(uint16_t time);
|
||||
static bool setCustomGapHandler(gap_event_handler handler);
|
||||
static bool setCustomGapHandler(gap_event_handler handler, void* arg = nullptr);
|
||||
static void setSecurityAuth(bool bonding, bool mitm, bool sc);
|
||||
static void setSecurityAuth(uint8_t auth);
|
||||
static void setSecurityIOCap(uint8_t iocap);
|
||||
|
||||
@@ -94,8 +94,24 @@ int NimBLERemoteCharacteristic::descriptorDiscCB(
|
||||
bool NimBLERemoteCharacteristic::retrieveDescriptors(NimBLEDescriptorFilter* pFilter) const {
|
||||
NIMBLE_LOGD(LOG_TAG, ">> retrieveDescriptors() for characteristic: %s", getUUID().toString().c_str());
|
||||
|
||||
const auto pSvc = getRemoteService();
|
||||
uint16_t endHandle = pSvc->getEndHandle();
|
||||
|
||||
// Find the handle of the next characteristic to limit the descriptor search range.
|
||||
const auto& chars = pSvc->getCharacteristics(false);
|
||||
for (auto it = chars.begin(); it != chars.end(); ++it) {
|
||||
if ((*it)->getHandle() == this->getHandle()) {
|
||||
auto next_it = std::next(it);
|
||||
if (next_it != chars.end()) {
|
||||
endHandle = (*next_it)->getHandle() - 1;
|
||||
NIMBLE_LOGD(LOG_TAG, "Search range limited to handle 0x%04X", endHandle);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If this is the last handle then there are no descriptors
|
||||
if (getHandle() == getRemoteService()->getEndHandle()) {
|
||||
if (getHandle() == endHandle) {
|
||||
NIMBLE_LOGD(LOG_TAG, "<< retrieveDescriptors(): found 0 descriptors.");
|
||||
return true;
|
||||
}
|
||||
@@ -108,7 +124,7 @@ bool NimBLERemoteCharacteristic::retrieveDescriptors(NimBLEDescriptorFilter* pFi
|
||||
|
||||
int rc = ble_gattc_disc_all_dscs(getClient()->getConnHandle(),
|
||||
getHandle(),
|
||||
getRemoteService()->getEndHandle(),
|
||||
endHandle,
|
||||
NimBLERemoteCharacteristic::descriptorDiscCB,
|
||||
pFilter);
|
||||
if (rc != 0) {
|
||||
|
||||
Reference in New Issue
Block a user