From 6e104dfb45d290b481b24ae61215ee596b08c9f0 Mon Sep 17 00:00:00 2001 From: h2zero Date: Sat, 6 Feb 2021 14:29:03 -0700 Subject: [PATCH] Allow custom scan response data without custom advertising. This lets applications use custom scan response data while using the advertisment data added by the NimBLEAdvertising add/set methods. --- src/NimBLEAdvertising.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/NimBLEAdvertising.cpp b/src/NimBLEAdvertising.cpp index e74d3e7..64524dd 100644 --- a/src/NimBLEAdvertising.cpp +++ b/src/NimBLEAdvertising.cpp @@ -419,7 +419,7 @@ bool NimBLEAdvertising::start(uint32_t duration, void (*advCompleteCB)(NimBLEAdv // check if there is room for the name, if not put it in scan data if((payloadLen + (2 + m_advData.name_len)) > BLE_HS_ADV_MAX_SZ) { - if(m_scanResp){ + if(m_scanResp && !m_customScanResponseData){ m_scanData.name = m_advData.name; m_scanData.name_len = m_advData.name_len; if(m_scanData.name_len > BLE_HS_ADV_MAX_SZ - 2) { @@ -446,7 +446,7 @@ bool NimBLEAdvertising::start(uint32_t duration, void (*advCompleteCB)(NimBLEAdv } } - if(m_scanResp) { + if(m_scanResp && !m_customScanResponseData) { rc = ble_gap_adv_rsp_set_fields(&m_scanData); switch(rc) { case 0: