From 88df909cfb01e1233e82523157774acd6307817f Mon Sep 17 00:00:00 2001 From: iranl Date: Mon, 25 Aug 2025 00:07:59 +0200 Subject: [PATCH] Fix undefined reference to ble_svc_gap_device_name_set when GATT server is disabled (#349) * Fix undefined reference to ble_svc_gap_device_name_set when GATT server is disabled * Do not affect ESP-IDF <5.5.0 --- src/NimBLEDevice.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/NimBLEDevice.cpp b/src/NimBLEDevice.cpp index 4b20674..b78a276 100644 --- a/src/NimBLEDevice.cpp +++ b/src/NimBLEDevice.cpp @@ -1290,12 +1290,13 @@ bool NimBLEDevice::injectConfirmPasskey(const NimBLEConnInfo& peerInfo, bool acc * @param [in] deviceName The name to set. */ bool NimBLEDevice::setDeviceName(const std::string& deviceName) { +#if !defined(ESP_IDF_VERSION) || ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 5, 0) || CONFIG_BT_NIMBLE_GAP_SERVICE int rc = ble_svc_gap_device_name_set(deviceName.c_str()); if (rc != 0) { NIMBLE_LOGE(LOG_TAG, "Device name not set - too long"); return false; } - +#endif return true; } // setDeviceName